]> git.joonet.de Git - adminer.git/commitdiff
Use template1 database as default (bug #3088192)
authorJakub Vrana <jakub@vrana.cz>
Sun, 17 Oct 2010 19:39:34 +0000 (21:39 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sun, 17 Oct 2010 19:39:34 +0000 (21:39 +0200)
adminer/drivers/pgsql.inc.php
changes.txt

index 6398aa4593772ebc3c5c64c52df82e0b30932e85..2cc9a0a3ed30741349cb8712db4e2e17ce44eeee 100644 (file)
@@ -22,11 +22,11 @@ if (isset($_GET["pgsql"])) {
                        function connect($server, $username, $password) {
                                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, "'\\") . "'" : ""), PGSQL_CONNECT_FORCE_NEW);
+                               $this->_link = @pg_connect($this->_string . (DB != "" ? " dbname='" . addcslashes(DB, "'\\") . "'" : " dbname='template1'"), PGSQL_CONNECT_FORCE_NEW);
                                if (!$this->_link && DB != "") {
                                        // try to connect directly with database for performance
                                        $this->_database = false;
-                                       $this->_link = @pg_connect($this->_string, PGSQL_CONNECT_FORCE_NEW);
+                                       $this->_link = @pg_connect("$this->_string dbname='template1'", PGSQL_CONNECT_FORCE_NEW);
                                }
                                restore_error_handler();
                                if ($this->_link) {
@@ -53,7 +53,7 @@ if (isset($_GET["pgsql"])) {
                        }
                        
                        function close() {
-                               $this->_link = @pg_connect($this->_string);
+                               $this->_link = @pg_connect("$this->_string dbname='template1'");
                        }
                        
                        function query($query, $unbuffered = false) {
index 094eda1436feaf27facc43363d7863eea7fb6b7d..ac845ee912f546c538ddd718141623dd90012d6e 100644 (file)
@@ -2,6 +2,8 @@ Adminer 3.0.1-dev:
 Send the form by Ctrl+Enter in all textareas
 Disable creating SQLite databases with extension other than db, sdb, sqlite
 Catalan translation
+MS SQL 2005 compatibility
+PostgreSQL: connect if the eponymous database does not exist
 
 Adminer 3.0.0 (released 2010-10-15):
 Drivers for MS SQL, SQLite, PostgreSQL, Oracle