Fix port selection for local connections
authormr-russ <mr-russ>
Sun, 6 Feb 2005 04:18:58 +0000 (04:18 +0000)
committermr-russ <mr-russ>
Sun, 6 Feb 2005 04:18:58 +0000 (04:18 +0000)
HISTORY
classes/database/Connection.php
libraries/adodb/drivers/adodb-postgres64.inc.php

diff --git a/HISTORY b/HISTORY
index c2d0865ada0d0463f2c51fa301ab2d07f20b7c14..cf9dbe60bf76349203a0ccc5883522cffa2de7c4 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -14,6 +14,7 @@ Bugs
  non-UTF8 web servers (Markus Bertheau)
 * Fix export to work with release candidates and beta releases as well as finals
  (Russell Smith)
+* Fix port selection for local connections
 
 Version 3.5.1
 -------------
index 1bb16ff7402db2848bd46537346775263a0e7a3e..60f1a4700a39af7405752c6085b6aa2f4d7b1505 100755 (executable)
@@ -3,7 +3,7 @@
 /**
  * Class to represent a database connection
  *
- * $Id: Connection.php,v 1.7 2005/02/01 16:41:19 chriskl Exp $
+ * $Id: Connection.php,v 1.8 2005/02/06 04:18:58 mr-russ Exp $
  */
 
 include_once('./classes/database/ADODB_base.php');
@@ -25,7 +25,10 @@ class Connection {
 
                // Ignore host if null
                if ($host === null || $host == '')
-                       $pghost = '';
+                       if ($port !== null && $port != '')
+                               $pghost = ':'.$port;
+                       else
+                               $pghost = '';
                else
                        $pghost = "{$host}:{$port}";
 
index 749bd66980548988bca5986bf76fc4663bddc91d..d51cfdecb6992a6a5a8bb76227567ce2edb8c71d 100644 (file)
@@ -392,7 +392,7 @@ a different OID if a database must be reloaded. */
                        if ($str)  {
                                $host = split(":", $str);
                                if ($host[0]) $str = "host='" . addslashes($host[0]) . "'";
-                               else $str = 'localhost';
+                               else $str = 'host=localhost';
                                if (isset($host[1])) $str .= " port='" . addslashes($host[1]) . "'";
                        }
                                if ($user) $str .= " user='" . addslashes($user) . "'";