cvs: php4 /pear/DB pgsql.php
| From: | Jon Parise | Date: | Tue, 03 Apr 2001 03:33:58 +0000 |
| Subject: | cvs: php4 /pear/DB pgsql.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-4957@lists.php.net to get a copy of this message | ||
jon Mon Apr 2 20:33:58 2001 EDT
Modified files:
/php4/pear/DB pgsql.php
Log:
Style and whitespace.
Index: php4/pear/DB/pgsql.php
diff -u php4/pear/DB/pgsql.php:1.35 php4/pear/DB/pgsql.php:1.36
--- php4/pear/DB/pgsql.php:1.35 Mon Apr 2 20:27:46 2001
+++ php4/pear/DB/pgsql.php Mon Apr 2 20:33:58 2001
@@ -82,20 +82,31 @@
$protocol = (isset($dsninfo['protocol'])) ? $dsninfo['protocol'] :
'';
$connstr = '';
if (($host !== false) && ($protocol != 'unix')){
- if (($pos=strpos(':', $host)) !== false) {
+ if (($pos = strpos(':', $host)) !== false) {
$dbhost = substr($host, 0, $pos);
- $port = substr($host, $pos+1);
+ $port = substr($host, $pos + 1);
} else {
$dbhost = $host;
$port = '5432';
}
- $connstr="host=".$dsninfo['hostspec']." port=".$port;
+ $connstr = 'host=' . $dsninfo['hostspec'] . ' port=' .
$port;
}
- $connstr .= $dsninfo['database'] ? "
dbname=".$dsninfo['database'] : NULL;
- $connstr .= $dsninfo['username'] ? "
user=".$dsninfo['username'] : NULL;
- $connstr .= $dsninfo['password'] ? "
password=".$dsninfo['password'] : NULL;
- $connstr .= (!empty($dsninfo['options'])) ? "
options=".$dsninfo['options'] : NULL;
- $connstr .= (!empty($dsninfo['tty'])) ? "
tty=".$dsninfo['tty'] : NULL;
+
+ if (isset($dsninfo['database'])) {
+ $connstr .= ' dbname=' . $dsninfo['database'];
+ }
+ if (isset($dsninfo['username'])) {
+ $connstr .= ' user=' . $dsninfo['username'];
+ }
+ if (isset($dsninfo['password'])) {
+ $connstr .= ' password=' . $dsninfo['password'];
+ }
+ if (!empty($dsninfo['options'])) {
+ $connstr .= ' options=' . $dsninfo['options'];
+ }
+ if (!empty($dsninfo['tty'])) {
+ $connstr .= ' tty=' . $dsninfo['tty'];
+ }
$connect_function = $persistent ? 'pg_pconnect' : 'pg_connect';