]> git.joonet.de Git - adminer.git/commitdiff
Connect if the eponymous database does not exist (bug #3391619)
authorJakub Vrana <jakub@vrana.cz>
Mon, 22 Aug 2011 14:28:15 +0000 (16:28 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 22 Aug 2011 14:28:15 +0000 (16:28 +0200)
adminer/drivers/pgsql.inc.php
changes.txt

index fb11223a07fe214355ac1b1122f6c80e54a5c47c..6eea08c3897e02a58ee9666290768f1cee310f0b 100644 (file)
@@ -21,7 +21,7 @@ if (isset($_GET["pgsql"])) {
                                $db = $adminer->database();
                                set_error_handler(array($this, '_error'));
                                $this->_string = "host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' user='" . addcslashes($username, "'\\") . "' password='" . addcslashes($password, "'\\") . "'";
-                               $this->_link = @pg_connect($this->_string . ($db != "" ? " dbname='" . addcslashes($db, "'\\") . "'" : " dbname='template1'"), PGSQL_CONNECT_FORCE_NEW);
+                               $this->_link = @pg_connect("$this->_string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "template1") . "'", PGSQL_CONNECT_FORCE_NEW);
                                if (!$this->_link && $db != "") {
                                        // try to connect directly with database for performance
                                        $this->_database = false;
@@ -132,7 +132,7 @@ if (isset($_GET["pgsql"])) {
                                global $adminer;
                                $db = $adminer->database();
                                $string = "pgsql:host='" . str_replace(":", "' port='", addcslashes($server, "'\\")) . "' options='-c client_encoding=utf8'";
-                               $this->dsn($string . ($db != "" ? " dbname='" . addcslashes($db, "'\\") . "'" : ""), $username, $password);
+                               $this->dsn("$string dbname='" . ($db != "" ? addcslashes($db, "'\\") : "template1") . "'", $username, $password);
                                //! connect without DB in case of an error
                                return true;
                        }
index 775ec0a94831c57e5f9214d7370d2b752e99e03f..b48a020363abaeac8862d3684f339b22bc57fa2c 100644 (file)
@@ -1,3 +1,6 @@
+Adminer 3.3.4-dev:
+PostgreSQL over PDO: connect if the eponymous database does not exist (bug #3391619)
+
 Adminer 3.3.3 (released 2011-08-12):
 Highlight checked rows
 Titles of links in database overview and navigation