cvs: /php4/pear DB.php

From: Date: Wed, 08 Dec 1999 13:49:40 +0000
Subject: cvs: /php4/pear DB.php
Groups: php.version4 
Request: Send a blank email to php-version4+get-7668@lists.php.net to get a copy of this message
ssb Wed Dec 8 08:49:40 1999 EDT Modified files: /php4/pear DB.php Log: 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. Index: php4/pear/DB.php diff -u php4/pear/DB.php:1.7 php4/pear/DB.php:1.8 --- php4/pear/DB.php:1.7 Tue Dec 7 16:41:34 1999 +++ php4/pear/DB.php Wed Dec 8 08:49:09 1999 @@ -37,6 +37,9 @@ 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 @@ * @since 4.0b4 */ class DB { + // {{{ factory() + /** * Create a new DB object for the specified database type. * @param $type database type @@ -85,6 +90,9 @@ return $obj; } + // }}} + // {{{ connect() + function connect($dsn, $persistent = false) { global $USED_PACKAGES; @@ -105,6 +113,9 @@ return $obj; // XXX ADDREF } + // }}} + // {{{ apiVersion() + /** * Return the DB API version. * @return int the DB API version number @@ -113,6 +124,9 @@ return 100; } + // }}} + // {{{ isError() + /** * Tell whether a result code from a DB method is an error. * @param $code result code @@ -122,6 +136,9 @@ return is_int($code) && ($code < 0); } + // }}} + // {{{ errorMessage() + /** * Return a textual error message for an error code. * @param $code error code @@ -149,6 +166,9 @@ return $errorMessages[$code]; } + // }}} + // {{{ parseDSN() + /** * Parse a data source name and return an associative array with * the following keys: @@ -236,6 +256,8 @@ return $parsed; // XXX ADDREF } + + // }}} } // }}} @@ -250,6 +272,8 @@ var $dbh; var $result; + // {{{ DB_result() + /** * DB_result constructor. * @param $dbh DB object reference @@ -260,6 +284,9 @@ $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 @@ 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 @@ 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 @@ $this->dbh = $this->result = false; return true; } + + // }}} } // }}}

« previous php.version4 (#7668) next »