Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Connect if the eponymous database does not exist (bug #3391619)

  • Loading branch information...
commit daf60b29f815b85c4fd61ed48c7e5573aca91621 1 parent a88dccb
@vrana authored
Showing with 5 additions and 2 deletions.
  1. +2 −2 adminer/drivers/pgsql.inc.php
  2. +3 −0  changes.txt
View
4 adminer/drivers/pgsql.inc.php
@@ -21,7 +21,7 @@ function connect($server, $username, $password) {
$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 @@ function connect($server, $username, $password) {
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;
}
View
3  changes.txt
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.