cvs: php4 /pear DB.php
| From: | Stig Bakken | Date: | Thu, 19 Apr 2001 02:32:33 +0000 |
| Subject: | cvs: php4 /pear DB.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-43@lists.php.net to get a copy of this message | ||
ssb Wed Apr 18 19:32:33 2001 EDT
Modified files:
/php4/pear DB.php
Log:
* added Colin's connect/factory error reporting fix
Index: php4/pear/DB.php
diff -u php4/pear/DB.php:1.59 php4/pear/DB.php:1.60
--- php4/pear/DB.php:1.59 Wed Apr 18 16:03:18 2001
+++ php4/pear/DB.php Wed Apr 18 19:32:33 2001
@@ -17,7 +17,7 @@
// | Tomas V.V.Cox <cox@idecnet.com> |
// +----------------------------------------------------------------------+
//
-// $Id: DB.php,v 1.59 2001/04/18 23:03:18 ssb Exp $
+// $Id: DB.php,v 1.60 2001/04/19 02:32:33 ssb Exp $
//
// Database independent query interface.
//
@@ -185,13 +185,14 @@
@include_once("DB/${type}.php");
$classname = "DB_${type}";
- @$obj =& new $classname;
- if (!$obj) {
+ if (!class_exists($classname)) {
return PEAR::raiseError(DB_ERROR_NOT_FOUND,
null, null, null, null, 'DB_Error', true);
}
+ @$obj =& new $classname;
+
return $obj;
}
@@ -227,18 +228,17 @@
$options["debug"] >= 2) {
// expose php errors with sufficient debug level
include_once "DB/${type}.php";
- $classname = "DB_${type}";
- $obj =& new $classname;
} else {
@include_once "DB/${type}.php";
- $classname = "DB_${type}";
- @$obj =& new $classname;
}
- if (!$obj) {
+ $classname = "DB_${type}";
+ if (!class_exists($classname)) {
return PEAR::raiseError(DB_ERROR_NOT_FOUND,
null, null, null, null, 'DB_Error', true);
}
+
+ @$obj =& new $classname;
if (is_array($options)) {
foreach ($options as $option => $value) {