From fe2badf64eb32c290e681dd531a27c5467b0867b Mon Sep 17 00:00:00 2001 From: Stig Bakken Date: Tue, 16 Apr 2002 21:50:48 +0000 Subject: [PATCH] * added DB::isConnection * phpdoc fixes --- pear/DB.php | 66 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 25 deletions(-) diff --git a/pear/DB.php b/pear/DB.php index 75b12e7944..35bc6ecbd0 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -190,7 +190,7 @@ class DB * Create a new DB connection object for the specified database * type * - * @param string $type database type, for example "mysql" + * @param string database type, for example "mysql" * * @return mixed a newly created DB object, or a DB error code on * error @@ -218,11 +218,11 @@ class DB * Create a new DB connection object and connect to the specified * database * - * @param mixed $dsn "data source name", see the DB::parseDSN + * @param mixed "data source name", see the DB::parseDSN * method for a description of the dsn format. Can also be * specified as an array of the format returned by DB::parseDSN. * - * @param mixed $options An associative array of option names and + * @param mixed An associative array of option names and * their values. For backwards compatibility, this parameter may * also be a boolean that tells whether the connection should be * persistent. See DB_common::setOption for more information on @@ -294,7 +294,7 @@ class DB /** * Tell whether a result code from a DB method is an error * - * @param $value int result code + * @param int result code * * @return bool whether $value is an error * @@ -307,6 +307,22 @@ class DB is_subclass_of($value, 'db_error'))); } + /** + * Tell whether a value is a DB connection + * + * @param mixed value to test + * + * @return bool whether $value is a DB connection + * + * @access public + */ + function isConnection($value) + { + return (is_object($value) && + is_subclass_of($value, 'db_common') && + method_exists($value, 'simpleQuery')); + } + /** * Tell whether a query is a data manipulation query (insert, * update or delete) or a data definition query (create, drop, @@ -314,7 +330,7 @@ class DB * * @access public * - * @param string $query the query + * @param string the query * * @return boolean whether $query is a data manipulation query */ @@ -333,7 +349,7 @@ class DB * Warnings differ from errors in that they are generated by DB, * and are not fatal. * - * @param mixed $value result value + * @param mixed result value * * @return boolean whether $value is a warning * @@ -349,7 +365,7 @@ class DB /** * Return a textual error message for a DB error code * - * @param integer $value error code + * @param integer error code * * @return string error message, or false if the error code was * not recognized @@ -425,7 +441,7 @@ class DB * phptype(dbsyntax) * phptype * - * @param string $dsn Data Source Name to be parsed + * @param string Data Source Name to be parsed * * @return array an associative array * @@ -551,8 +567,8 @@ class DB * * @access public * - * @param string $name the base name of the extension (without the .so or - * .dll suffix) + * @param string the base name of the extension (without the .so or + * .dll suffix) * * @return boolean true if the extension was already or successfully * loaded, false if it could not be loaded @@ -579,10 +595,10 @@ class DB_Error extends PEAR_Error /** * DB_Error constructor. * - * @param mixed $code DB error code, or string with error message. - * @param integer $mode what "error mode" to operate in - * @param integer $level what error level to use for $mode & PEAR_ERROR_TRIGGER - * @param smixed $debuginfo additional debug info, such as the last query + * @param mixed DB error code, or string with error message. + * @param integer what "error mode" to operate in + * @param integer what error level to use for $mode & PEAR_ERROR_TRIGGER + * @param mixed additional debug info, such as the last query * * @access public * @@ -612,10 +628,10 @@ class DB_Warning extends PEAR_Error /** * DB_Warning constructor. * - * @param mixed $code DB error code, or string with error message. - * @param integer $mode what "error mode" to operate in - * @param integer $level what error level to use for $mode == PEAR_ERROR_TRIGGER - * @param mmixed $debuginfo additional debug info, such as the last query + * @param mixed DB error code, or string with error message. + * @param integer what "error mode" to operate in + * @param integer what error level to use for $mode == PEAR_ERROR_TRIGGER + * @param mmixed additional debug info, such as the last query * * @access public * @@ -661,8 +677,8 @@ class DB_result /** * DB_result constructor. - * @param resource $dbh DB object reference - * @param resource $result result resource id + * @param resource DB object reference + * @param resource result resource id */ function DB_result(&$dbh, $result) @@ -673,8 +689,8 @@ class DB_result /** * Fetch and return a row of data (it uses driver->fetchInto for that) - * @param int $fetchmode format of fetched row - * @param int $rownum the row number to fetch + * @param int format of fetched row + * @param int the row number to fetch * * @return array a row of data, NULL on no more rows or PEAR_Error on error * @@ -730,9 +746,9 @@ class DB_result /** * Fetch a row of data into an existing variable. * - * @param mixed $arr reference to data containing the row - * @param integer $fetchmode format of fetched row - * @param integer $rownum the row number to fetch + * @param mixed reference to data containing the row + * @param integer format of fetched row + * @param integer the row number to fetch * * @return mixed DB_OK on success, NULL on no more rows or * a DB_Error object on error -- 2.40.0