* Add support for PostgreSQL 8.1devel
* primary key and unique key at table creation (Andreas Huber)
* Add row|statement level options to create trigger for >= 7.4 (Robert Treat)
+* Allow altering name (for >= 7.4) and owner (for >= 8.0) of a database (Bryan Encina)
Bugs
* Tree Icons are displayed middle instead of top
* Fix timeouts on long running operations (Adrian Nida)
* Allow Multiline character and character varying editing and inserting
* Add automatic browser language selection for all languages
-* Fix using schema enabled dump on non-schema enabled backend
-* Reload browser after executing arbitrary SQL
-* Fix inability to drop database using the drop link
* Stop duplicate insert on re-POST of data
-* Correct last internal oid value for PostgreSQL 8.0
* Fix bug with exporting schema for servers < 7.3
-* Fix dumping on v8 for windows, exclude dumping some objects.
Translations
* Japanese from Tadashi Jokagi
* Danish from Arne Eckmann
* Arabic from Zaki
+
+Version 3.5.3
+-------------
+
+Bugs
+* Fix using schema enabled dump on non-schema enabled backend
+* Don't try setting no timeout when in safe mode
+* Reload browser after executing arbitrary SQL
+* Fix browser in RTL languages
+* Fix inability to drop database using the drop link
+* Fix last internal oid value for PostgreSQL 8.0
+* Fix (again) dumping on v8 for windows, exclude dumping some objects.
+
+Translations
* Portuguese from Francisco
Version 3.5.2
/**
* Manage databases within a server
*
- * $Id: all_db.php,v 1.36 2005/03/05 06:53:49 mr-russ Exp $
+ * $Id: all_db.php,v 1.37 2005/04/30 18:01:58 soranzo Exp $
*/
// Include application functions
if (!isset($msg)) $msg = '';
$PHP_SELF = $_SERVER['PHP_SELF'];
+ /**
+ * Display a form for alter and perform actual alter
+ */
+ function doAlter($confirm) {
+ global $data, $misc, $_reload_browser;
+ global $PHP_SELF, $lang;
+
+ if ($confirm) {
+ $misc->printTrail('database');
+ $misc->printTitle($lang['stralter'], 'pg.database.alter');
+
+ echo "<form action=\"$PHP_SELF\" method=\"post\">\n";
+ echo "<table>\n";
+ echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n";
+ echo "<td class=\"data1\">";
+ echo "<input name=\"newname\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"",
+ htmlspecialchars($_REQUEST['alterdatabase']), "\" /></td></tr>\n";
+
+ if ($data->hasAlterDatabaseOwner() && $data->isSuperUser($_SESSION['webdbUsername'])) {
+ // Fetch all users
+
+ $rs = $data->getDatabaseOwner($_REQUEST['alterdatabase']);
+ $owner = isset($rs->fields['usename']) ? $rs->fields['usename'] : '';
+ $users = &$data->getUsers();
+
+ echo "<tr><th class=\"data left required\">{$lang['strowner']}</th>\n";
+ echo "<td class=\"data1\"><select name=\"owner\">";
+ while (!$users->EOF) {
+ $uname = $users->f['usename'];
+ echo "<option value=\"", htmlspecialchars($uname), "\"",
+ ($uname == $owner) ? ' selected="selected"' : '', ">", htmlspecialchars($uname), "</option>\n";
+ $users->moveNext();
+ }
+ echo "</select></td></tr>\n";
+ }
+ echo "</table>\n";
+ echo "<input type=\"hidden\" name=\"action\" value=\"alter\" />\n";
+ echo "<input type=\"hidden\" name=\"oldname\" value=\"",
+ htmlspecialchars($_REQUEST['alterdatabase']), "\" />\n";
+ echo "<input type=\"submit\" name=\"alter\" value=\"{$lang['stralter']}\" />\n";
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />\n";
+ echo "</form>\n";
+ }
+ else {
+ //all versions that support the alter database functionality (starting 7.4) support renaming a db
+ $newOwner = isset($_POST['owner']) ? $_POST['owner'] : '';
+ if ($data->AlterDatabase($_POST['oldname'], $_POST['newname'], $newOwner) == 0) {
+ $_reload_browser = true;
+ doDefault($lang['strdatabasealtered']);
+ }
+ else
+ doDefault($lang['strdatabasealteredbad']);
+ }
+ }
+
/**
* Show confirmation of drop and perform actual drop
*/
else
doDefault($lang['strdatabasedroppedbad']);
}
-
}
/**
'vars' => array('database' => 'datname'),
)
);
+ if ($data->hasAlterDatabase() ) {
+ $actions['alter'] = array(
+ 'title' => $lang['stralter'],
+ 'url' => "{$PHP_SELF}?action=confirm_alter&subject=database&",
+ 'vars' => array('alterdatabase' => 'datname')
+ );
+ }
if (!$data->hasTablespaces()) unset($columns['tablespace']);
if (!isset($data->privlist['database'])) unset($actions['privileges']);
break;
case 'confirm_drop':
doDrop(true);
+ break;
+ case 'alter':
+ if (isset($_POST['oldname']) && isset($_POST['newname']) && !isset($_POST['cancel']) ) doAlter(false);
+ else doDefault();
break;
+ case 'confirm_alter':
+ doAlter(true);
+ break;
default:
doDefault();
break;
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.259 2005/04/14 18:20:12 xzilla Exp $
+ * $Id: Postgres.php,v 1.260 2005/04/30 18:01:59 soranzo Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
return $this->selectSet($sql);
}
+ /**
+ * Return the database owner of a db
+ * @param string $database the name of the database to get the owner for
+ * @return recordset of the db owner info
+ */
+ function &getDatabaseOwner($database) {
+ $this->clean($database);
+ $sql = "SELECT usename FROM pg_user, pg_database WHERE pg_user.usesysid = pg_database.datdba AND pg_database.datname = '{$database}' ";
+ return $this->selectSet($sql);
+ }
+
/**
* Return all information about a particular database
* @param $database The name of the database to retrieve
}
// Capabilities
+ function hasAlterDatabaseOwner() { return false; }
+ function hasAlterDatabaseRename() { return false; }
+ function hasAlterDatabase() { return $this->hasAlterDatabaseRename(); }
function hasSchemas() { return false; }
function hasConversions() { return false; }
function hasGrantOption() { return false; }
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres74.php,v 1.43 2005/04/15 03:56:48 xzilla Exp $
+ * $Id: Postgres74.php,v 1.44 2005/04/30 18:02:01 soranzo Exp $
*/
include_once('./classes/database/Postgres73.php');
return $this->help_page;
}
+ // Database functions
+
+ /**
+ * Alters a database
+ * the multiple return vals are for postgres 8+ which support more functionality in alter database
+ * @param $dbName The name of the database
+ * @param $newName new name for the database
+ * @param $newOwner The new owner for the database
+ * @return 0 success
+ * @return -1 transaction error
+ * @return -2 owner error
+ * @return -3 rename error
+ */
+ function alterDatabase($dbName, $newName, $newOwner = '')
+ {
+ //ignore $newowner, not supported pre 8.0
+ $this->clean($dbName);
+ $this->clean($newName);
+
+ $status = $this->alterDatabaseRename($dbName, $newName);
+ if ($status != 0) return -3;
+ else return 0;
+ }
+
+ /**
+ * Renames a database, note that this operation cannot be
+ * performed on a database that is currently being connected to
+ * @param string $oldName name of database to rename
+ * @param string $newName new name of database
+ * @return int 0 on success
+ */
+ function alterDatabaseRename($oldName, $newName) {
+ $this->clean($oldName);
+ $this->clean($newName);
+
+ if ($oldName != $newName) {
+ $sql = "ALTER DATABASE \"{$oldName}\" RENAME TO \"{$newName}\"";
+ return $this->execute($sql);
+ }
+ else //just return success, we're not going to do anything
+ return 0;
+ }
+
// Table functions
/**
}
// Capabilities
+ function hasAlterDatabaseRename() { return true; }
function hasGrantOption() { return true; }
function hasDomainConstraints() { return true; }
function hasUserRename() { return true; }
/**
* PostgreSQL 8.0 support
*
- * $Id: Postgres80.php,v 1.11 2005/03/15 02:55:45 chriskl Exp $
+ * $Id: Postgres80.php,v 1.12 2005/04/30 18:02:01 soranzo Exp $
*/
include_once('./classes/database/Postgres74.php');
return $this->selectSet($sql);
}
+ /**
+ * Alters a database
+ * the multiple return vals are for postgres 8+ which support more functionality in alter database
+ * @param $dbName The name of the database
+ * @param $newName new name for the database
+ * @param $newOwner The new owner for the database
+ * @return 0 success
+ * @return -1 transaction error
+ * @return -2 owner error
+ * @return -3 rename error
+ */
+ function alterDatabase($dbName, $newName, $newOwner = '')
+ {
+ $this->clean($dbName);
+ $this->clean($newName);
+ $this->clean($newOwner);
+
+ $status = $this->beginTransaction();
+ if ($status != 0) {
+ $this->rollbackTransaction();
+ return -1;
+ }
+
+ if ($dbName != $newName) {
+ $status = $this->alterDatabaseRename($dbName, $newName);
+ if ($status != 0) {
+ $this->rollbackTransaction();
+ return -3;
+ }
+ }
+
+ $status = $this->alterDatabaseOwner($newName, $newOwner);
+ if ($status != 0) {
+ $this->rollbackTransaction();
+ return -2;
+ }
+ return $this->endTransaction();
+ }
+ /**
+ * Changes ownership of a database
+ * This can only be done by a superuser or the owner of the database
+ * @param string $dbName database to change ownership of
+ * @param string $newOwner user that will own the database
+ * @return int 0 on success
+ */
+ function alterDatabaseOwner($dbName, $newOwner) {
+ $this->clean($dbName);
+ $this->clean($newOwner);
+
+ $sql = "ALTER DATABASE \"{$dbName}\" OWNER TO \"{$newOwner}\"";
+ return $this->execute($sql);
+ }
// Schema functions
/**
return $this->selectSet($sql);
}
+ // Capabilities
+ function hasAlterDatabaseOwner() { return true; }
function hasAlterColumnType() { return true; }
function hasTablespaces() { return true; }
function hasSignals() { return true; }
/**
* Help links for PostgreSQL 7.3 documentation
*
- * $Id: PostgresDoc73.php,v 1.3 2005/02/16 10:27:44 jollytoad Exp $
+ * $Id: PostgresDoc73.php,v 1.4 2005/04/30 18:02:01 soranzo Exp $
*/
include('./help/PostgresDoc72.php');
$this->help_base = sprintf($GLOBALS['conf']['help_base'], '7.3');
+$this->help_page['pg.database.alter'] = 'sql-alterdatabase.html';
$this->help_page['pg.database.create'][1] = 'manage-ag-createdb.html';
?>
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.173 2005/04/14 18:20:15 xzilla Exp $
+ * $Id: english.php,v 1.174 2005/04/30 18:02:02 soranzo Exp $
*/
// Language and character set
$lang['strsignalsent'] = 'Signal sent.';
$lang['strsignalsentbad'] = 'Sending signal failed.';
$lang['strallobjects'] = 'All objects';
+ $lang['strdatabasealtered'] = 'Database altered.';
+ $lang['strdatabasealteredbad'] = 'Database alter failed.';
// Views
$lang['strview'] = 'View';
* Italian language file, based on the english language file for phpPgAdmin.
*
- * $Id: italian.php,v 1.40 2005/01/04 23:49:20 soranzo Exp $
+ * $Id: italian.php,v 1.41 2005/04/30 18:02:02 soranzo Exp $
*/
// Language and character set - Lingua e set di caratteri
$lang['strsignalsent'] = 'Segnale inviato.';
$lang['strsignalsentbad'] = 'Invio del segnale fallito.';
$lang['strallobjects'] = 'Tutti gli oggetti';
+ $lang['strdatabasealtered'] = 'Database modificato.';
+ $lang['strdatabasealteredbad'] = 'Modifica del database fallita.';
// Views - Viste
$lang['strview'] = 'Vista';
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.125 2005/04/14 18:20:15 xzilla Exp $
+ * $Id: english.php,v 1.126 2005/04/30 18:02:03 soranzo Exp $
*/
// Language and character set
$lang['strsignalsent'] = 'Signal sent.';
$lang['strsignalsentbad'] = 'Sending signal failed.';
$lang['strallobjects'] = 'All objects';
+ $lang['strdatabasealtered'] = 'Database altered.';
+ $lang['strdatabasealteredbad'] = 'Database alter failed.';
// Views
$lang['strview'] = 'View';
* Italian language file, based on the english language file for phpPgAdmin.
*
- * $Id: italian.php,v 1.35 2005/01/04 23:49:38 soranzo Exp $
+ * $Id: italian.php,v 1.36 2005/04/30 18:02:03 soranzo Exp $
*/
// Language and character set - Lingua e set di caratteri
$lang['strsignalsent'] = 'Segnale inviato.';
$lang['strsignalsentbad'] = 'Invio del segnale fallito.';
$lang['strallobjects'] = 'Tutti gli oggetti';
+ $lang['strdatabasealtered'] = 'Database modificato.';
+ $lang['strdatabasealteredbad'] = 'Modifica del database fallita.';
// Views - Viste
$lang['strview'] = 'Vista';