* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres73.php,v 1.140 2004/11/10 01:46:36 chriskl Exp $
+ * $Id: Postgres73.php,v 1.141 2004/11/29 01:48:38 chriskl Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
* Creates a new schema.
* @param $schemaname The name of the schema to create
* @param $authorization (optional) The username to create the schema for.
- * @param $tablespace (optional) The tablespace for the schema, '' indicates default.
* @param $comment (optional) If omitted, defaults to nothing
* @return 0 success
*/
- function createSchema($schemaname, $authorization = '', $tablespace = '', $comment = '') {
+ function createSchema($schemaname, $authorization = '', $comment = '') {
$this->fieldClean($schemaname);
$this->fieldClean($authorization);
- $this->fieldClean($tablespace);
$this->clean($comment);
$sql = "CREATE SCHEMA \"{$schemaname}\"";
if ($authorization != '') $sql .= " AUTHORIZATION \"{$authorization}\"";
- if ($tablespace != '' && $this->hasTablespaces()) $sql .= " TABLESPACE \"{$tablespace}\"";
$status = $this->beginTransaction();
if ($status != 0) return -1;
/**
* PostgreSQL 8.0 support
*
- * $Id: Postgres80.php,v 1.7 2004/11/10 01:46:36 chriskl Exp $
+ * $Id: Postgres80.php,v 1.8 2004/11/29 01:48:39 chriskl Exp $
*/
include_once('./classes/database/Postgres74.php');
if (!$conf['show_system']) $and = "AND nspname NOT LIKE 'pg\\\\_%' AND nspname != 'information_schema'";
else $and = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'";
- $sql = "SELECT pn.nspname, pu.usename AS nspowner, pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment,
- (SELECT spcname FROM pg_catalog.pg_tablespace pt WHERE pt.oid=pn.nsptablespace) AS tablespace
+ $sql = "SELECT pn.nspname, pu.usename AS nspowner, pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment
FROM pg_catalog.pg_namespace pn, pg_catalog.pg_user pu
WHERE pn.nspowner = pu.usesysid
{$and} ORDER BY nspname";
/**
* Manage schemas within a database
*
- * $Id: database.php,v 1.64 2004/11/04 02:56:50 chriskl Exp $
+ * $Id: database.php,v 1.65 2004/11/29 01:48:38 chriskl Exp $
*/
// Include application functions
// Fetch all users from the database
$users = &$data->getUsers();
- // Fetch all tablespaces from the database
- if ($data->hasTablespaces()) $tablespaces = &$data->getTablespaces();
$misc->printTrail('database');
$misc->printTitle($lang['strcreateschema'],'pg.schema.create');
($uname == $_POST['formAuth']) ? ' selected="selected"' : '', ">{$uname}</option>\n";
$users->moveNext();
}
- echo "\t\t\t</select>\n\t\t</td>\n\t\n";
-
- // Tablespace (if there are any)
- if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) {
- echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strtablespace']}</th>\n";
- echo "\t\t<td class=\"data1\">\n\t\t\t<select name=\"formSpc\">\n";
- // Always offer the default (empty) option
- echo "\t\t\t\t<option value=\"\"",
- ($_POST['formSpc'] == '') ? ' selected="selected"' : '', "></option>\n";
- // Display all other tablespaces
- while (!$tablespaces->EOF) {
- $spcname = htmlspecialchars($tablespaces->f['spcname']);
- echo "\t\t\t\t<option value=\"{$spcname}\"",
- ($spcname == $_POST['formSpc']) ? ' selected="selected"' : '', ">{$spcname}</option>\n";
- $tablespaces->moveNext();
- }
- echo "\t\t\t</select>\n\t\t</td>\n\t</tr>\n";
- }
-
+ echo "\t\t\t</select>\n\t\t</td>\n\t\n";
echo "\t<tr>\n\t\t<th class=\"data left\">{$lang['strcomment']}</th>\n";
echo "\t\t<td class=\"data1\"><textarea name=\"formComment\" rows=\"3\" cols=\"32\" wrap=\"virtual\">",
htmlspecialchars($_POST['formComment']), "</textarea></td>\n\t</tr>\n";
function doSaveCreate() {
global $data, $lang, $_reload_browser;
- // Default tablespace to null if it isn't set
- if (!isset($_POST['formSpc'])) $_POST['formSpc'] = null;
-
// Check that they've given a name
if ($_POST['formName'] == '') doCreate($lang['strschemaneedsname']);
else {
- $status = $data->createSchema($_POST['formName'], $_POST['formAuth'], $_POST['formSpc'], $_POST['formComment']);
+ $status = $data->createSchema($_POST['formName'], $_POST['formAuth'], $_POST['formComment']);
if ($status == 0) {
$_reload_browser = true;
doDefault($lang['strschemacreated']);
'title' => $lang['strowner'],
'field' => 'nspowner',
),
- 'tablespace' => array(
- 'title' => $lang['strtablespace'],
- 'field' => 'tablespace',
- ),
'actions' => array(
'title' => $lang['stractions'],
),
),
);
- if (!$data->hasTablespaces()) unset($columns['tablespace']);
-
$misc->printTable($schemas, $columns, $actions, $lang['strnoschemas']);
echo "<p><a class=\"navlink\" href=\"$PHP_SELF?database=", urlencode($_REQUEST['database']),