* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.85 2003/04/30 07:31:16 chriskl Exp $
+ * $Id: Postgres.php,v 1.86 2003/04/30 07:35:32 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
* @param $cascade True to cascade drop, false to restrict
* @return 0 success
*/
- function &dropSequence($sequence, $cascade) {
+ function dropSequence($sequence, $cascade) {
$this->fieldClean($sequence);
$sql = "DROP SEQUENCE \"{$sequence}\"";
* Drops a trigger
* @param $tgname The name of the trigger to drop
* @param $table The table from which to drop the trigger
+ * @param $cascade True to cascade drop, false to restrict
* @return 0 success
*/
- function dropTrigger($tgname, $table) {
+ function dropTrigger($tgname, $table, $cascade) {
$this->fieldClean($tgname);
$this->fieldClean($table);
$sql = "DROP TRIGGER \"{$tgname}\" ON \"{$table}\"";
+ if ($cascade) $sql .= " CASCADE";
return $this->execute($sql);
}
/**
* List triggers on a table
*
- * $Id: triggers.php,v 1.11 2003/04/18 11:08:27 chriskl Exp $
+ * $Id: triggers.php,v 1.12 2003/04/30 07:35:32 chriskl Exp $
*/
// Include application functions
echo "<input type=\"hidden\" name=\"table\" value=\"", htmlspecialchars($_REQUEST['table']), "\">\n";
echo "<input type=\"hidden\" name=\"trigger\" value=\"", htmlspecialchars($_REQUEST['trigger']), "\">\n";
echo $misc->form;
+ // Show cascade drop option if supportd
+ if ($localData->hasDropBehavior()) {
+ echo "<p><input type=\"checkbox\" name=\"cascade\"> {$lang['strcascade']}</p>\n";
+ }
echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\"> <input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\">\n";
echo "</form>\n";
}
else {
- $status = $localData->dropTrigger($_POST['trigger'], $_POST['table']);
+ $status = $localData->dropTrigger($_POST['trigger'], $_POST['table'], isset($_POST['cascade']));
if ($status == 0)
doDefault($lang['strtriggerdropped']);
else