mirror of
https://github.com/vrana/adminer.git
synced 2025-09-02 19:02:36 +02:00
PostgreSQL: Fix renaming database
This commit is contained in:
@@ -71,6 +71,11 @@ if (isset($_GET["pgsql"])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function query($query, $unbuffered = false) {
|
function query($query, $unbuffered = false) {
|
||||||
|
if (!$this->_link) {
|
||||||
|
$this->error = "Invalid connection";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$result = @pg_query($this->_link, $query);
|
$result = @pg_query($this->_link, $query);
|
||||||
$this->error = "";
|
$this->error = "";
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
@@ -497,12 +502,17 @@ ORDER BY connamespace, conname") as $row) {
|
|||||||
|
|
||||||
function drop_databases($databases) {
|
function drop_databases($databases) {
|
||||||
global $connection;
|
global $connection;
|
||||||
|
|
||||||
$connection->close();
|
$connection->close();
|
||||||
|
|
||||||
return apply_queries("DROP DATABASE", $databases, 'idf_escape');
|
return apply_queries("DROP DATABASE", $databases, 'idf_escape');
|
||||||
}
|
}
|
||||||
|
|
||||||
function rename_database($name, $collation) {
|
function rename_database($name, $collation) {
|
||||||
//! current database cannot be renamed
|
global $connection;
|
||||||
|
|
||||||
|
$connection->close();
|
||||||
|
|
||||||
return queries("ALTER DATABASE " . idf_escape(DB) . " RENAME TO " . idf_escape($name));
|
return queries("ALTER DATABASE " . idf_escape(DB) . " RENAME TO " . idf_escape($name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user