cvs: php4 /pear/DB mysql.php

From: Date: Sun, 13 Jan 2002 18:47:17 +0000
Subject: cvs: php4 /pear/DB mysql.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-1927@lists.php.net to get a copy of this message
cox Sun Jan 13 13:47:17 2002 EDT Modified files: /php4/pear/DB mysql.php Log: Added support for socket and port options in connect() Index: php4/pear/DB/mysql.php diff -u php4/pear/DB/mysql.php:1.83 php4/pear/DB/mysql.php:1.84 --- php4/pear/DB/mysql.php:1.83 Mon Dec 31 13:49:54 2001 +++ php4/pear/DB/mysql.php Sun Jan 13 13:47:17 2002 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.83 2001/12/31 18:49:54 cox Exp $ +// $Id: mysql.php,v 1.84 2002/01/13 18:47:17 cox Exp $ // // Database independent query interface definition for PHP's MySQL // extension. @@ -104,7 +104,14 @@ return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); $this->dsn = $dsninfo; - $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; + if ($dsninfo['protocol'] == 'unix') { + $dbhost = ':' . $dsninfo['socket']; + } else { + $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; + if ($dsninfo['port']) { + $dbhost .= ':' . $dsninfo['port']; + } + } $user = $dsninfo['username']; $pw = $dsninfo['password'];

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