diff options
author | Stig Bakken <ssb@php.net> | 2000-07-26 09:57:06 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 2000-07-26 09:57:06 +0000 |
commit | c63410f6bed7b2bf0536722ccfbe9b90cbb6ed82 (patch) | |
tree | 0b83c0f503837a8a9146ceaccdb6f8ff4588d8c8 /pear | |
parent | 718b7308c3db66d428f69511d4d36ce3e08f7564 (diff) | |
download | php-git-c63410f6bed7b2bf0536722ccfbe9b90cbb6ed82.tar.gz |
Multiple DB::connect or DB::factory calls using the same backend
should work now.
Diffstat (limited to 'pear')
-rw-r--r-- | pear/DB.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/pear/DB.php b/pear/DB.php index 5a70356fd1..97e0f7077a 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -163,11 +163,12 @@ class DB { * error */ function &factory($type) { - if (!@include_once("DB/${type}.php")) { - return DB_ERROR_NOT_FOUND; - } + @include_once("DB/${type}.php"); $classname = 'DB_' . $type; - $obj = new $classname; + $obj = @new $classname; + if (!$obj) { + return new DB_Error(DB_ERROR_NOT_FOUND); + } return $obj; } @@ -192,11 +193,12 @@ class DB { $dsninfo = DB::parseDSN($dsn); $type = $dsninfo['phptype']; - if (!@include_once("DB/${type}.php")) { - return DB_ERROR_NOT_FOUND; - } + @include_once("DB/${type}.php"); $classname = 'DB_' . $type; - $obj = new $classname; + $obj = @new $classname; + if (!$obj) { + return new DB_Error(DB_ERROR_NOT_FOUND); + } $err = $obj->connect(&$dsninfo, $persistent); if (DB::isError($err)) { return $err; |