Skip to content

Commit

Permalink
-Add getCode() method to PEAR_Error
Browse files Browse the repository at this point in the history
-Correct license versions + My Address for DB/* mods
-Correct ibase module
-Javadocize File_Find
-Add a optional constructor to DB that passes it on to DB::connect()
  • Loading branch information
Sterling Hughes committed Aug 24, 2000
1 parent 5875af9 commit 4850e34
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pear/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@
* @since PHP 4.0
*/
class DB {

function DB ($dsn = false, $persistent = false)
{
if ($dsn) {
return DB::connect ($dsn, $persistent);
}
}

// {{{ factory()

/**
Expand All @@ -162,15 +170,15 @@ class DB {
* @return object a newly created DB object, or a DB error code on
* error
*/
function &factory($type) {
function &factory($type) {
@include_once("DB/${type}.php");
$classname = 'DB_' . $type;
$obj = @new $classname;
if (!$obj) {
return new DB_Error(DB_ERROR_NOT_FOUND);
}
return $obj;
}
}

// }}}
// {{{ connect()
Expand Down
14 changes: 14 additions & 0 deletions pear/PEAR.php.in
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class PEAR_Error

var $mode = PEAR_ERROR_RETURN;
var $level = E_USER_NOTICE;
var $code = -1;

var $message = '';

Expand Down Expand Up @@ -205,6 +206,19 @@ class PEAR_Error
}


// }}}
// {{{ getCode()

/**
* Get error code from an error object
*
* @return int error code
*/
function getCode ()
{
return ($this->code);
}

// }}}
// {{{ getType()

Expand Down

0 comments on commit 4850e34

Please sign in to comment.