diff options
author | Stig Bakken <ssb@php.net> | 1999-12-08 13:49:09 +0000 |
---|---|---|
committer | Stig Bakken <ssb@php.net> | 1999-12-08 13:49:09 +0000 |
commit | 208696f48915e57ba64361cc14de0b5f21ff3a8f (patch) | |
tree | 79adcdfe71da562837fd15d32b05859ded9ff7e1 | |
parent | 19023f3a051833694d18a034f38294660da7e62e (diff) | |
download | php-git-208696f48915e57ba64361cc14de0b5f21ff3a8f.tar.gz |
Added some more error defines (CANNOT_CREATE/DELETE/DROP).
Folded up the methods in DB.php.
Started adding documentation for DB_result methods.
Added doOne() doRow() and doAssoc() methods in DB_common.
Added numCols() to DB_mysql.
-rw-r--r-- | pear/DB.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pear/DB.php b/pear/DB.php index 25eb312fe6..814f389b8f 100644 --- a/pear/DB.php +++ b/pear/DB.php @@ -37,6 +37,9 @@ define("DB_ERROR_INVALID_NUMBER", -11); define("DB_ERROR_INVALID_DATE", -12); define("DB_ERROR_DIVZERO", -13); define("DB_ERROR_NODBSELECTED", -14); +define("DB_ERROR_CANNOT_CREATE", -15); +define("DB_ERROR_CANNOT_DELETE", -16); +define("DB_ERROR_CANNOT_DROP", -17); // }}} // {{{ Prepare/execute parameter types @@ -64,6 +67,8 @@ define("DB_BINMODE_CONVERT", 3); * @since 4.0b4 */ class DB { + // {{{ factory() + /** * Create a new DB object for the specified database type. * @param $type database type @@ -85,6 +90,9 @@ class DB { return $obj; } + // }}} + // {{{ connect() + function connect($dsn, $persistent = false) { global $USED_PACKAGES; @@ -105,6 +113,9 @@ class DB { return $obj; // XXX ADDREF } + // }}} + // {{{ apiVersion() + /** * Return the DB API version. * @return int the DB API version number @@ -113,6 +124,9 @@ class DB { return 100; } + // }}} + // {{{ isError() + /** * Tell whether a result code from a DB method is an error. * @param $code result code @@ -122,6 +136,9 @@ class DB { return is_int($code) && ($code < 0); } + // }}} + // {{{ errorMessage() + /** * Return a textual error message for an error code. * @param $code error code @@ -149,6 +166,9 @@ class DB { return $errorMessages[$code]; } + // }}} + // {{{ parseDSN() + /** * Parse a data source name and return an associative array with * the following keys: @@ -236,6 +256,8 @@ class DB { return $parsed; // XXX ADDREF } + + // }}} } // }}} @@ -250,6 +272,8 @@ class DB_result { var $dbh; var $result; + // {{{ DB_result() + /** * DB_result constructor. * @param $dbh DB object reference @@ -260,6 +284,9 @@ class DB_result { $this->result = $result; } + // }}} + // {{{ fetchRow() + /** * Fetch and return a row of data. * @return array a row of data, or false on error @@ -268,8 +295,12 @@ class DB_result { return $this->dbh->fetchRow($this->result); } + // }}} + // {{{ fetchInto() + /** * Fetch a row of data into an existing array. + * * @param $arr reference to data array * @return int error code */ @@ -277,6 +308,21 @@ class DB_result { return $this->dbh->fetchInto($this->result, &$arr); } + // }}} + // {{{ numCols() + + /** + * Get the the number of columns in a result set. + * + * @return int the number of columns, or a DB error code + */ + function numCols() { + return $this->dbh->numCols($this->result); + } + + // }}} + // {{{ free() + /** * Frees the resource for this result and reset ourselves. * @return int error code @@ -289,6 +335,8 @@ class DB_result { $this->dbh = $this->result = false; return true; } + + // }}} } // }}} |