* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.86 2003/04/30 07:35:32 chriskl Exp $
+ * $Id: Postgres.php,v 1.87 2003/04/30 07:37:39 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
/**
* Drops a type.
* @param $typname The name of the type to drop
+ * @param $cascade True to cascade drop, false to restrict
* @return 0 success
*/
- function dropType($typname) {
+ function dropType($typname, $cascade) {
$this->fieldClean($typname);
$sql = "DROP TYPE \"{$typname}\"";
+ if ($cascade) $sql .= " CASCADE";
return $this->execute($sql);
}
/**
* Manage types in a database
*
- * $Id: types.php,v 1.5 2003/03/17 05:20:30 chriskl Exp $
+ * $Id: types.php,v 1.6 2003/04/30 07:37:39 chriskl Exp $
*/
// Include application functions
echo "<input type=\"hidden\" name=\"action\" value=\"drop\">\n";
echo "<input type=\"hidden\" name=\"type\" value=\"", htmlspecialchars($_REQUEST['type']), "\">\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=\"choice\" value=\"{$lang['stryes']}\"> <input type=submit name=choice value=\"{$lang['strno']}\">\n";
echo "</form>\n";
}
else {
- $status = $localData->dropType($_POST['type']);
+ $status = $localData->dropType($_POST['type'], isset($_POST['cascade']));
if ($status == 0)
doDefault($lang['strtypedropped']);
else