* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.37 2003/04/30 07:02:22 chriskl Exp $
+ * $Id: Postgres73.php,v 1.38 2003/04/30 07:28:11 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
/**
* Drops a schema.
* @param $schemaname The name of the schema to drop
+ * @param $cascade True to cascade drop, false to restrict
* @return 0 success
*/
- function dropSchema($schemaname) {
+ function dropSchema($schemaname, $cascade) {
$this->fieldClean($schemaname);
$sql = "DROP SCHEMA \"{$schemaname}\"";
+ if ($cascade) $sql .= " CASCADE";
return $this->execute($sql);
}
return $this->selectRow($sql);
}
- /**
- * Creates a new conversion.
- * @param $schemaname The name of the schema to create
- * @param $authorization (optional) The username to create the schema for.
- * @param $authorization (optional) If omitted, defaults to current user.
- * @return 0 success
- */
- /*
- function createSchema($schemaname, $authorization = '') {
- $this->clean($schemaname);
- $this->clean($authorization);
-
- $sql = "CREATE SCHEMA \"{$schemaname}\"";
- if ($authorization != '') $sql .= " AUTHORIZATION \"{$authorization}\"";
-
- return $this->execute($sql);
- }
- */
- /**
- * Drops a schema.
- * @param $schemaname The name of the schema to drop
- * @return 0 success
- */
- /*
- function dropSchema($schemaname) {
- $this->clean($schemaname);
-
- $sql = "DROP SCHEMA \"{$schemaname}\"";
-
- return $this->execute($sql);
- }
-*/
// Table functions
/**
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.13 2003/04/19 11:59:09 chriskl Exp $
+ * $Id: database.php,v 1.14 2003/04/30 07:28:10 chriskl Exp $
*/
// Include application functions
echo "<input type=\"hidden\" name=\"action\" value=\"drop\">\n";
echo "<input type=\"hidden\" name=\"database\" value=\"", htmlspecialchars($_REQUEST['database']), "\">\n";
echo "<input type=\"hidden\" name=\"schema\" value=\"", htmlspecialchars($_REQUEST['schema']), "\">\n";
+ // 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->dropSchema($_POST['schema']);
+ $status = $localData->dropSchema($_POST['schema'], isset($_POST['cascade']));
if ($status == 0) {
$_reload_browser = true;
doDefault($lang['strschemadropped']);