cvs: php4 /pear/DB pgsql.php

From: Date: Sun, 13 Jan 2002 18:35:10 +0000
Subject: cvs: php4 /pear/DB pgsql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1926@lists.php.net to get a copy of this message
cox Sun Jan 13 13:35:10 2002 EDT Modified files: /php4/pear/DB pgsql.php Log: better DSN handling Index: php4/pear/DB/pgsql.php diff -u php4/pear/DB/pgsql.php:1.61 php4/pear/DB/pgsql.php:1.62 --- php4/pear/DB/pgsql.php:1.61 Thu Dec 13 09:31:17 2001 +++ php4/pear/DB/pgsql.php Sun Jan 13 13:35:10 2002 @@ -17,7 +17,7 @@ // | Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.61 2001/12/13 14:31:17 hirokawa Exp $ +// $Id: pgsql.php,v 1.62 2002/01/13 18:35:10 cox Exp $ // // Database independent query interface definition for PHP's PostgreSQL // extension. @@ -84,18 +84,14 @@ return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); $this->dsn = $dsninfo; - $host = $dsninfo['hostspec']; - $protocol = (isset($dsninfo['protocol'])) ? $dsninfo['protocol'] : ''; + $protocol = (isset($dsninfo['protocol'])) ? $dsninfo['protocol'] : 'tcp'; $connstr = ''; - if (($host !== false) && ($protocol != 'unix')){ - if (($pos = strpos($host, ':')) !== false) { - $dbhost = substr($host, 0, $pos); - $port = substr($host, $pos + 1); - } else { - $dbhost = $host; - $port = '5432'; + + if ($protocol == 'tcp') { + $connstr = 'host=' . $dsninfo['hostspec']; + if ($dsninfo['port']) { + $connstr .= ' port=' . $dsninfo['port']; } - $connstr = 'host=' . $dbhost . ' port=' . $port; } if (isset($dsninfo['database'])) {

« previous php.pear.cvs (#1926) next »