diff options
| author | Stig Bakken <ssb@php.net> | 2001-04-16 21:24:38 +0000 |
|---|---|---|
| committer | Stig Bakken <ssb@php.net> | 2001-04-16 21:24:38 +0000 |
| commit | d3bb8325853af62a10bee5a4b626091a6529b265 (patch) | |
| tree | 3fb252fc3b78c8de0b22b98e6b3c094ec2c0c3ca | |
| parent | fb98b6b83874e5c94aaa962df7cf3283266531db (diff) | |
| download | php-git-d3bb8325853af62a10bee5a4b626091a6529b265.tar.gz | |
* actually commit the stuff I said I had committed :-)
| -rw-r--r-- | pear/DB.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/pear/DB.php b/pear/DB.php index 3384ec1c62..d9c410ec3f 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -207,10 +207,11 @@ class DB * DB_common::setOption for more information on connection * options. * - * @return object a newly created DB object, or a DB error code on - * error + * @return object a newly created DB connection object, or a DB + * error object on error * * @see DB::parseDSN + * @see DB::isError */ function &connect($dsn, $options = false) { @@ -221,9 +222,17 @@ class DB } $type = $dsninfo["phptype"]; - @include_once "DB/${type}.php"; - $classname = "DB_${type}"; - @$obj =& new $classname; + if (is_array($options) && isset($options["debug"]) && + $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) { return new DB_Error(DB_ERROR_NOT_FOUND); @@ -242,6 +251,7 @@ class DB $err = $obj->connect($dsninfo, $obj->getOption('persistent')); if (DB::isError($err)) { + $err->addUserInfo($dsn); return $err; } @@ -347,7 +357,7 @@ class DB } if (DB::isError($value)) { - $value = $value->code; + $value = $value->getCode(); } return $errorMessages[$value]; |
