cvs: php4 /pear DB.php /pear/DB fbsql.php ibase.php ifx.php msql.php mssql.php mysql.php oci8.php odbc.php pgsql.php sybase.php
| From: | Markus Fischer | Date: | Sun, 14 Oct 2001 01:23:07 +0000 |
| Subject: | cvs: php4 /pear DB.php /pear/DB fbsql.php ibase.php ifx.php msql.php mssql.php mysql.php oci8.php odbc.php pgsql.php sybase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1004@lists.php.net to get a copy of this message | ||
mfischer Sat Oct 13 21:23:07 2001 EDT
Modified files:
/php4/pear DB.php
/php4/pear/DB fbsql.php ibase.php ifx.php msql.php mssql.php
mysql.php oci8.php odbc.php pgsql.php sybase.php
Log:
Made error returning on missing extensions consistent across all backends
Index: php4/pear/DB.php diff -u php4/pear/DB.php:1.74 php4/pear/DB.php:1.75 --- php4/pear/DB.php:1.74 Wed Oct 3 20:29:37 2001 +++ php4/pear/DB.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: DB.php,v 1.74 2001/10/04 00:29:37 jon Exp $ +// $Id: DB.php,v 1.75 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface. // @@ -57,6 +57,7 @@ define("DB_ERROR_VALUE_COUNT_ON_ROW", -22); define("DB_ERROR_INVALID_DSN", -23); define("DB_ERROR_CONNECT_FAILED", -24); +define("DB_ERROR_EXTENSION_NOT_FOUND",-25); /* * Warnings are not detected as errors by DB::isError(), and are not @@ -375,7 +376,8 @@ DB_OK => 'no error', DB_WARNING => 'unknown warning', DB_WARNING_READ_ONLY => 'read only', - DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied' + DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied', + DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found' ); } @@ -512,16 +514,10 @@ function assertExtension($name) { if (!extension_loaded($name)) { - $dlext = (substr(PHP_OS, 0, 3) == 'WIN') ? '.dll' : '.so'; + $dlext = OS_WINDOWS ? '.dll' : '.so'; @dl($name . $dlext); } - if (!extension_loaded($name)) { - trigger_error("The extension '$name' couldn't be loaded. ". - 'Probably you don\'t have support in your PHP '. - 'to this Database backend', E_USER_ERROR); - return false; - } - return true; + return extension_loaded($name); } } Index: php4/pear/DB/fbsql.php diff -u php4/pear/DB/fbsql.php:1.6 php4/pear/DB/fbsql.php:1.7 --- php4/pear/DB/fbsql.php:1.6 Wed Sep 12 10:05:34 2001 +++ php4/pear/DB/fbsql.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.6 2001/09/12 14:05:34 cox Exp $ +// $Id: fbsql.php,v 1.7 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's FrontBase // extension. @@ -96,12 +96,14 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('fbsql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; $user = $dsninfo['username']; $pw = $dsninfo['password']; - DB::assertExtension('fbsql'); $connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect'; ini_set('track_errors', true); Index: php4/pear/DB/ibase.php diff -u php4/pear/DB/ibase.php:1.22 php4/pear/DB/ibase.php:1.23 --- php4/pear/DB/ibase.php:1.22 Thu Sep 27 07:06:49 2001 +++ php4/pear/DB/ibase.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.22 2001/09/27 11:06:49 yavo Exp $ +// $Id: ibase.php,v 1.23 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Interbase // extension. @@ -45,13 +45,18 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('interbase')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? ($dsninfo['hostspec'] . ':/' . $dsninfo['database']) : $dsninfo['database']; + $connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect'; + if ($dbhost && $user && $pw) { $conn = $connect_function($dbhost, $user, $pw); } elseif ($dbhost && $user) { Index: php4/pear/DB/ifx.php diff -u php4/pear/DB/ifx.php:1.11 php4/pear/DB/ifx.php:1.12 --- php4/pear/DB/ifx.php:1.11 Wed Sep 12 10:05:35 2001 +++ php4/pear/DB/ifx.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: ifx.php,v 1.11 2001/09/12 14:05:35 cox Exp $ +// $Id: ifx.php,v 1.12 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Informix // extension. @@ -72,6 +72,9 @@ */ function connect(&$dsninfo, $persistent = false) { + if (!DB::assertExtension('informix')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? '@' . $dsninfo['hostspec'] : ''; $dbname = $dsninfo['database'] ? $dsninfo['database'] . $dbhost : ''; @@ -79,6 +82,7 @@ $pw = $dsninfo['password'] ? $dsninfo['password'] : ''; $connect_function = $persistent ? 'ifx_pconnect' : 'ifx_connect'; + $this->connection = @$connect_function($dbname, $user, $pw); if (!is_resource($this->connection)) { return $this->ifxraiseError(DB_ERROR_CONNECT_FAILED); Index: php4/pear/DB/msql.php diff -u php4/pear/DB/msql.php:1.19 php4/pear/DB/msql.php:1.20 --- php4/pear/DB/msql.php:1.19 Tue Aug 7 07:55:55 2001 +++ php4/pear/DB/msql.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: msql.php,v 1.19 2001/08/07 11:55:55 cox Exp $ +// $Id: msql.php,v 1.20 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Mini-SQL // extension. @@ -45,11 +45,16 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('msql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; + $connect_function = $persistent ? 'msql_pconnect' : 'msql_connect'; + if ($dbhost && $user && $pw) { $conn = $connect_function($dbhost, $user, $pw); } elseif ($dbhost && $user) { @@ -164,4 +169,4 @@ } } -?> \ No newline at end of file +?> Index: php4/pear/DB/mssql.php diff -u php4/pear/DB/mssql.php:1.27 php4/pear/DB/mssql.php:1.28 --- php4/pear/DB/mssql.php:1.27 Tue Sep 4 09:44:47 2001 +++ php4/pear/DB/mssql.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.27 2001/09/04 13:44:47 cox Exp $ +// $Id: mssql.php,v 1.28 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Microsoft SQL Server // extension. @@ -51,11 +51,16 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('mssql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; + $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect'; + if ($dbhost && $user && $pw) { $conn = @$connect_function($dbhost, $user, $pw); } elseif ($dbhost && $user) { @@ -445,4 +450,4 @@ } } -?> \ No newline at end of file +?> Index: php4/pear/DB/mysql.php diff -u php4/pear/DB/mysql.php:1.75 php4/pear/DB/mysql.php:1.76 --- php4/pear/DB/mysql.php:1.75 Wed Sep 12 10:05:35 2001 +++ php4/pear/DB/mysql.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.75 2001/09/12 14:05:35 cox Exp $ +// $Id: mysql.php,v 1.76 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's MySQL // extension. @@ -102,12 +102,14 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('mysql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; $user = $dsninfo['username']; $pw = $dsninfo['password']; - DB::assertExtension('mysql'); $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect'; @ini_set('track_errors', true); @@ -717,4 +719,4 @@ // binmode } -?> \ No newline at end of file +?> Index: php4/pear/DB/oci8.php diff -u php4/pear/DB/oci8.php:1.29 php4/pear/DB/oci8.php:1.30 --- php4/pear/DB/oci8.php:1.29 Thu Sep 27 07:06:49 2001 +++ php4/pear/DB/oci8.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: oci8.php,v 1.29 2001/09/27 11:06:49 yavo Exp $ +// $Id: oci8.php,v 1.30 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Oracle 8 // call-interface extension. @@ -84,13 +84,16 @@ */ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension("oci8")) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $hostspec = $dsninfo['hostspec']; - DB::assertExtension("oci8"); $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon'; + if ($hostspec) { $conn = @$connect_function($user,$pw,$hostspec); } elseif ($user || $pw) { Index: php4/pear/DB/odbc.php diff -u php4/pear/DB/odbc.php:1.41 php4/pear/DB/odbc.php:1.42 --- php4/pear/DB/odbc.php:1.41 Thu Oct 11 18:11:34 2001 +++ php4/pear/DB/odbc.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: odbc.php,v 1.41 2001/10/11 22:11:34 ssb Exp $ +// $Id: odbc.php,v 1.42 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's ODBC // extension. @@ -96,6 +96,9 @@ */ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('odbc')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; if (!empty($dsninfo['dbsyntax'])) { $this->dbsyntax = $dsninfo['dbsyntax']; @@ -115,7 +118,6 @@ $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; $user = $dsninfo['username']; $pw = $dsninfo['password']; - DB::assertExtension('odbc'); if ($this->provides('pconnect')) { $connect_function = $persistent ? 'odbc_pconnect' : 'odbc_connect'; } else { Index: php4/pear/DB/pgsql.php diff -u php4/pear/DB/pgsql.php:1.49 php4/pear/DB/pgsql.php:1.50 --- php4/pear/DB/pgsql.php:1.49 Sat Sep 29 04:33:10 2001 +++ php4/pear/DB/pgsql.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.49 2001/09/29 08:33:10 hirokawa Exp $ +// $Id: pgsql.php,v 1.50 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's PostgreSQL // extension. @@ -79,6 +79,9 @@ */ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('pgsql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $host = $dsninfo['hostspec']; $protocol = (isset($dsninfo['protocol'])) ? $dsninfo['protocol'] : ''; @@ -727,4 +730,4 @@ // tab-width: 4 // c-basic-offset: 4 // End: -?> \ No newline at end of file +?> Index: php4/pear/DB/sybase.php diff -u php4/pear/DB/sybase.php:1.21 php4/pear/DB/sybase.php:1.22 --- php4/pear/DB/sybase.php:1.21 Tue Oct 9 18:32:16 2001 +++ php4/pear/DB/sybase.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: sybase.php,v 1.21 2001/10/09 22:32:16 cox Exp $ +// $Id: sybase.php,v 1.22 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Sybase // extension. @@ -53,6 +53,9 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('sybase')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password'];
Index: php4/pear/DB.php diff -u php4/pear/DB.php:1.74 php4/pear/DB.php:1.75 --- php4/pear/DB.php:1.74 Wed Oct 3 20:29:37 2001 +++ php4/pear/DB.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: DB.php,v 1.74 2001/10/04 00:29:37 jon Exp $ +// $Id: DB.php,v 1.75 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface. // @@ -57,6 +57,7 @@ define("DB_ERROR_VALUE_COUNT_ON_ROW", -22); define("DB_ERROR_INVALID_DSN", -23); define("DB_ERROR_CONNECT_FAILED", -24); +define("DB_ERROR_EXTENSION_NOT_FOUND",-25); /* * Warnings are not detected as errors by DB::isError(), and are not @@ -375,7 +376,8 @@ DB_OK => 'no error', DB_WARNING => 'unknown warning', DB_WARNING_READ_ONLY => 'read only', - DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied' + DB_ERROR_NEED_MORE_DATA => 'insufficient data supplied', + DB_ERROR_EXTENSION_NOT_FOUND=> 'extension not found' ); } @@ -512,16 +514,10 @@ function assertExtension($name) { if (!extension_loaded($name)) { - $dlext = (substr(PHP_OS, 0, 3) == 'WIN') ? '.dll' : '.so'; + $dlext = OS_WINDOWS ? '.dll' : '.so'; @dl($name . $dlext); } - if (!extension_loaded($name)) { - trigger_error("The extension '$name' couldn't be loaded. ". - 'Probably you don\'t have support in your PHP '. - 'to this Database backend', E_USER_ERROR); - return false; - } - return true; + return extension_loaded($name); } } Index: php4/pear/DB/fbsql.php diff -u php4/pear/DB/fbsql.php:1.6 php4/pear/DB/fbsql.php:1.7 --- php4/pear/DB/fbsql.php:1.6 Wed Sep 12 10:05:34 2001 +++ php4/pear/DB/fbsql.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: fbsql.php,v 1.6 2001/09/12 14:05:34 cox Exp $ +// $Id: fbsql.php,v 1.7 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's FrontBase // extension. @@ -96,12 +96,14 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('fbsql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; $user = $dsninfo['username']; $pw = $dsninfo['password']; - DB::assertExtension('fbsql'); $connect_function = $persistent ? 'fbsql_pconnect' : 'fbsql_connect'; ini_set('track_errors', true); Index: php4/pear/DB/ibase.php diff -u php4/pear/DB/ibase.php:1.22 php4/pear/DB/ibase.php:1.23 --- php4/pear/DB/ibase.php:1.22 Thu Sep 27 07:06:49 2001 +++ php4/pear/DB/ibase.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.22 2001/09/27 11:06:49 yavo Exp $ +// $Id: ibase.php,v 1.23 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Interbase // extension. @@ -45,13 +45,18 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('interbase')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? ($dsninfo['hostspec'] . ':/' . $dsninfo['database']) : $dsninfo['database']; + $connect_function = $persistent ? 'ibase_pconnect' : 'ibase_connect'; + if ($dbhost && $user && $pw) { $conn = $connect_function($dbhost, $user, $pw); } elseif ($dbhost && $user) { Index: php4/pear/DB/ifx.php diff -u php4/pear/DB/ifx.php:1.11 php4/pear/DB/ifx.php:1.12 --- php4/pear/DB/ifx.php:1.11 Wed Sep 12 10:05:35 2001 +++ php4/pear/DB/ifx.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: ifx.php,v 1.11 2001/09/12 14:05:35 cox Exp $ +// $Id: ifx.php,v 1.12 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Informix // extension. @@ -72,6 +72,9 @@ */ function connect(&$dsninfo, $persistent = false) { + if (!DB::assertExtension('informix')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? '@' . $dsninfo['hostspec'] : ''; $dbname = $dsninfo['database'] ? $dsninfo['database'] . $dbhost : ''; @@ -79,6 +82,7 @@ $pw = $dsninfo['password'] ? $dsninfo['password'] : ''; $connect_function = $persistent ? 'ifx_pconnect' : 'ifx_connect'; + $this->connection = @$connect_function($dbname, $user, $pw); if (!is_resource($this->connection)) { return $this->ifxraiseError(DB_ERROR_CONNECT_FAILED); Index: php4/pear/DB/msql.php diff -u php4/pear/DB/msql.php:1.19 php4/pear/DB/msql.php:1.20 --- php4/pear/DB/msql.php:1.19 Tue Aug 7 07:55:55 2001 +++ php4/pear/DB/msql.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: msql.php,v 1.19 2001/08/07 11:55:55 cox Exp $ +// $Id: msql.php,v 1.20 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Mini-SQL // extension. @@ -45,11 +45,16 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('msql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; + $connect_function = $persistent ? 'msql_pconnect' : 'msql_connect'; + if ($dbhost && $user && $pw) { $conn = $connect_function($dbhost, $user, $pw); } elseif ($dbhost && $user) { @@ -164,4 +169,4 @@ } } -?> \ No newline at end of file +?> Index: php4/pear/DB/mssql.php diff -u php4/pear/DB/mssql.php:1.27 php4/pear/DB/mssql.php:1.28 --- php4/pear/DB/mssql.php:1.27 Tue Sep 4 09:44:47 2001 +++ php4/pear/DB/mssql.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.27 2001/09/04 13:44:47 cox Exp $ +// $Id: mssql.php,v 1.28 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Microsoft SQL Server // extension. @@ -51,11 +51,16 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('mssql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; + $connect_function = $persistent ? 'mssql_pconnect' : 'mssql_connect'; + if ($dbhost && $user && $pw) { $conn = @$connect_function($dbhost, $user, $pw); } elseif ($dbhost && $user) { @@ -445,4 +450,4 @@ } } -?> \ No newline at end of file +?> Index: php4/pear/DB/mysql.php diff -u php4/pear/DB/mysql.php:1.75 php4/pear/DB/mysql.php:1.76 --- php4/pear/DB/mysql.php:1.75 Wed Sep 12 10:05:35 2001 +++ php4/pear/DB/mysql.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.75 2001/09/12 14:05:35 cox Exp $ +// $Id: mysql.php,v 1.76 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's MySQL // extension. @@ -102,12 +102,14 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('mysql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; $user = $dsninfo['username']; $pw = $dsninfo['password']; - DB::assertExtension('mysql'); $connect_function = $persistent ? 'mysql_pconnect' : 'mysql_connect'; @ini_set('track_errors', true); @@ -717,4 +719,4 @@ // binmode } -?> \ No newline at end of file +?> Index: php4/pear/DB/oci8.php diff -u php4/pear/DB/oci8.php:1.29 php4/pear/DB/oci8.php:1.30 --- php4/pear/DB/oci8.php:1.29 Thu Sep 27 07:06:49 2001 +++ php4/pear/DB/oci8.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: oci8.php,v 1.29 2001/09/27 11:06:49 yavo Exp $ +// $Id: oci8.php,v 1.30 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Oracle 8 // call-interface extension. @@ -84,13 +84,16 @@ */ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension("oci8")) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password']; $hostspec = $dsninfo['hostspec']; - DB::assertExtension("oci8"); $connect_function = $persistent ? 'OCIPLogon' : 'OCILogon'; + if ($hostspec) { $conn = @$connect_function($user,$pw,$hostspec); } elseif ($user || $pw) { Index: php4/pear/DB/odbc.php diff -u php4/pear/DB/odbc.php:1.41 php4/pear/DB/odbc.php:1.42 --- php4/pear/DB/odbc.php:1.41 Thu Oct 11 18:11:34 2001 +++ php4/pear/DB/odbc.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: odbc.php,v 1.41 2001/10/11 22:11:34 ssb Exp $ +// $Id: odbc.php,v 1.42 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's ODBC // extension. @@ -96,6 +96,9 @@ */ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('odbc')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; if (!empty($dsninfo['dbsyntax'])) { $this->dbsyntax = $dsninfo['dbsyntax']; @@ -115,7 +118,6 @@ $dbhost = $dsninfo['hostspec'] ? $dsninfo['hostspec'] : 'localhost'; $user = $dsninfo['username']; $pw = $dsninfo['password']; - DB::assertExtension('odbc'); if ($this->provides('pconnect')) { $connect_function = $persistent ? 'odbc_pconnect' : 'odbc_connect'; } else { Index: php4/pear/DB/pgsql.php diff -u php4/pear/DB/pgsql.php:1.49 php4/pear/DB/pgsql.php:1.50 --- php4/pear/DB/pgsql.php:1.49 Sat Sep 29 04:33:10 2001 +++ php4/pear/DB/pgsql.php Sat Oct 13 21:23:07 2001 @@ -17,7 +17,7 @@ // | Stig Bakken <ssb@fast.no> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.49 2001/09/29 08:33:10 hirokawa Exp $ +// $Id: pgsql.php,v 1.50 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's PostgreSQL // extension. @@ -79,6 +79,9 @@ */ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('pgsql')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $host = $dsninfo['hostspec']; $protocol = (isset($dsninfo['protocol'])) ? $dsninfo['protocol'] : ''; @@ -727,4 +730,4 @@ // tab-width: 4 // c-basic-offset: 4 // End: -?> \ No newline at end of file +?> Index: php4/pear/DB/sybase.php diff -u php4/pear/DB/sybase.php:1.21 php4/pear/DB/sybase.php:1.22 --- php4/pear/DB/sybase.php:1.21 Tue Oct 9 18:32:16 2001 +++ php4/pear/DB/sybase.php Sat Oct 13 21:23:07 2001 @@ -16,7 +16,7 @@ // | Authors: Sterling Hughes <sterling@php.net> | // +----------------------------------------------------------------------+ // -// $Id: sybase.php,v 1.21 2001/10/09 22:32:16 cox Exp $ +// $Id: sybase.php,v 1.22 2001/10/14 01:23:07 mfischer Exp $ // // Database independent query interface definition for PHP's Sybase // extension. @@ -53,6 +53,9 @@ function connect($dsninfo, $persistent = false) { + if (!DB::assertExtension('sybase')) + return $this->raiseError(DB_ERROR_EXTENSION_NOT_FOUND); + $this->dsn = $dsninfo; $user = $dsninfo['username']; $pw = $dsninfo['password'];