cvs: pear /MDB common.php

From: Date: Tue, 09 Jul 2002 14:53:59 +0000
Subject: cvs: pear /MDB common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4985@lists.php.net to get a copy of this message
busterb Tue Jul 9 10:53:59 2002 EDT Modified files: /pear/MDB common.php Log: more PHPDoc reformatting, some minor doc corrections, added require_once 'PEAR.php', removed EOL whitespace

Index: pear/MDB/common.php diff -u pear/MDB/common.php:1.26 pear/MDB/common.php:1.27 --- pear/MDB/common.php:1.26 Thu Jul 4 15:08:49 2002 +++ pear/MDB/common.php Tue Jul 9 10:53:59 2002 @@ -42,11 +42,13 @@ // | Author: Lukas Smith <smith@dybnet.de> | // +----------------------------------------------------------------------+ // -// $Id: common.php,v 1.26 2002/07/04 19:08:49 lsmith Exp $ +// $Id: common.php,v 1.27 2002/07/09 14:53:59 busterb Exp $ // // Base class for DB implementations. // +require_once 'PEAR.php'; + define('MDB_TYPE_TEXT', 0); define('MDB_TYPE_BOOLEAN', 1); define('MDB_TYPE_INTEGER', 2); @@ -63,15 +65,15 @@ // }}} // {{{ shutdownTransactions() /** -* this function closes all open transactions -* registerTransactionShutdown() registers this method to be executed at shutdown -* -* @access private -*/ + * this function closes all open transactions registerTransactionShutdown() + * registers this method to be executed at shutdown + * + * @access private + */ function shutdownTransactions() { global $databases; - + foreach($databases as $database) { if ($database->in_transaction && !MDB::is_Error($database->rollback())){ $database->autoCommit(TRUE); @@ -81,14 +83,13 @@ // }}} // {{{ defaultDebugOutput() - /** * default debug output handler * * @param integer $database key in the $databases array that references to the - * proper db object + * proper db object * @param string $message message htat should be appended to the debug - * variable + * variable * * @return string the corresponding error message, of FALSE * if the error code was unknown @@ -107,7 +108,6 @@ * MDB_common is a base class for DB implementations, and must be * inherited by all such. */ - class MDB_common extends PEAR { /* PUBLIC DATA */ @@ -134,7 +134,7 @@ var $autofree = FALSE; /* PRIVATE DATA */ - + var $lobs = array(); var $clobs = array(); var $blobs = array(); @@ -186,7 +186,6 @@ // }}} // {{{ errorCode() - /** * Map native error codes to DB's portable ones. Requires that * the DB implementation's constructor fills in the $errorcode_map @@ -211,12 +210,11 @@ // }}} // {{{ errorMessage() - /** * Map a DB error code to a textual message. This is actually * just a wrapper for DB::errorMessage(). * - * @param integer $dbcode the DB error code + * @param integer $dbcode the DB error code * * @return string the corresponding error message, of FALSE * if the error code was unknown @@ -230,19 +228,18 @@ // }}} // {{{ raiseError() - /** * This method is used to communicate an error and invoke error * callbacks etc. Basically a wrapper for PEAR::raiseError * without the message string. * - * @param mixed $code integer error code, or a PEAR error object (all + * @param mixed $code integer error code, or a PEAR error object (all * other parameters are ignored if this parameter is an object * - * @param int $mode error mode, see PEAR_Error docs + * @param int $mode error mode, see PEAR_Error docs * * @param mixed $options If error mode is PEAR_ERROR_TRIGGER, this is the - * error level (E_USER_NOTICE etc). If error mode is + * error level (E_USER_NOTICE etc). If error mode is * PEAR_ERROR_CALLBACK, this is the callback function, either as a * function name, or as an array of an object and method name. For * other error modes this parameter is ignored. @@ -281,13 +278,13 @@ // }}} // {{{ setOption() /** - * set the option for the db class - * - * @param string $option option name - * @param mixed $value value for the option - * - * @return mixed a result handle or DB_OK on success, a DB error on failure - */ + * set the option for the db class + * + * @param string $option option name + * @param mixed $value value for the option + * + * @return mixed a result handle or DB_OK on success, a DB error on failure + */ function setOption($option, $value) { if (isset($this->$option)) { @@ -300,12 +297,12 @@ // }}} // {{{ getOption() /** - * returns the value of an option - * - * @param string $option option name - * - * @return mixed the option value - */ + * returns the value of an option + * + * @param string $option option name + * + * @return mixed the option value + */ function getOption($option) { if (isset($this->$option)) { @@ -316,10 +313,9 @@ // }}} // {{{ captureDebugOutput() - /** * set a debug handler (deprecated) - * + * * @param string $capture name of the function that should be used in * debug() * @@ -331,13 +327,12 @@ $this->pass_debug_handle = $capture; $this->debug = ($capture ? "defaultDebugOutput" : ""); } - + // }}} // {{{ debug() - /** * set a debug message (deprecated) - * + * * @param string $message Message with information for the user. * * @access public @@ -355,7 +350,6 @@ // }}} // {{{ debugOutput() - /** * output debug info (deprecated) * @@ -367,13 +361,12 @@ { return ($this->debug_output); } - + // }}} // {{{ setError() - /** * set an error (deprecated) - * + * * @param string $scope Scope of the error message * (usually the method tht caused the error) * @param string $message Message with information for the user. @@ -399,10 +392,9 @@ // }}} // {{{ setErrorHandler() (deprecated) - /** * Specify a function that is called when an error occurs. - * + * * @param string $function Name of the function that will be called on * error. If an empty string is specified, no handler function is * called on error. The error handler function receives two arguments. @@ -412,16 +404,16 @@ * The second argument is a reference to an associative array that * provides details about the error that occured. These details provide * more information than it is returned by the MetabaseError function. - * + * * These are the currently supported error detail entries: * * Scope * String that indicates the scope of the driver object class * within which the error occured. - * + * * Message * Error message as is returned by the MetabaseError function. - * + * * @access public * * @return string name of last function @@ -432,16 +424,15 @@ $this->error_handler = $function; return ($last_function); } - + // }}} // {{{ error() (deprecated) - /** * Retrieve the error message text associated with the last operation that * failed. Some functions may fail but they do not return the reason that * makes them to fail. This function is meant to retrieve a textual * description of the failure cause. - * + * * @access public * * @return string the error message text associated with the last failure. @@ -453,13 +444,12 @@ // }}} // {{{ quote() - /** * Quotes a string so it can be safely used in a query. It will quote * the text so it can safely be used within a query. * * @param string $text the input string to quote - * + * * @access private * */ @@ -473,10 +463,9 @@ // }}} // {{{ loadExtension() - /** * loads an extension - * + * * @param string $scope information about what method is being loaded, * that is used for error messages * @param string $extension name of the extension that should be loaded @@ -484,7 +473,7 @@ * @param string $included_constant name of the constant that should be * defined when the extension has been loaded * @param string $include name of the script that includes the extension - * + * * @access private * */ @@ -511,11 +500,11 @@ if ($directory) { closedir($directory); } - return $this->raiseError(DB_ERROR_LOADEXTENSION, "", "", + return $this->raiseError(DB_ERROR_LOADEXTENSION, "", "", $scope.': it was not specified an existing '. $extension.' file ('.$include.')'); } else { - return $this->raiseError(DB_ERROR_LOADEXTENSION, "", "", + return $this->raiseError(DB_ERROR_LOADEXTENSION, "", "", $scope.': it was not specified a valid '. $extension.' include path'); } @@ -527,13 +516,12 @@ // }}} // {{{ loadManager() - /** * loads the Manager extension - * + * * @param string $scope information about what method is being loaded, * that is used for error messages - * + * * @access private * */ @@ -566,16 +554,15 @@ // }}} // {{{ registerTransactionShutdown() - /** * register the shutdown function to automatically commit open transactions - * + * * @param string $auto_commit * * @access private * * @return DB_OK - */ + */ function registerTransactionShutdown($auto_commit) { global $registered_transactions_shutdown; @@ -591,68 +578,64 @@ // }}} // {{{ autoCommit() - /** * Define whether database changes done on the database be automatically * committed. This function may also implicitly start or end a transaction. - * + * * @param boolean $auto_commit flag that indicates whether the database * changes should be committed right after executing every query * statement. If this argument is 0 a transaction implicitly started. * Otherwise, if a transaction is in progress it is ended by committing * any database changes that were pending. - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function autoCommit($auto_commit) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Auto-commit transactions: transactions are not supported'); } // }}} // {{{ commit() - /** * Commit the database changes done during a transaction that is in * progress. This function may only be called when auto-committing is * disabled, otherwise it will fail. Therefore, a new transaction is * implicitly started after committing the pending changes. - * + * * @access public - * + * * @return mixed DB_OK on success, a DB error on failure - */ + */ function commit() { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Commit transaction: commiting transactions are not supported'); } // }}} // {{{ rollback() - /** * Cancel any database changes done during a transaction that is in * progress. This function may only be called when auto-committing is * disabled, otherwise it will fail. Therefore, a new transaction is * implicitly started after canceling the pending changes. - * + * * @access public - * + * * @return mixed DB_OK on success, a DB error on failure - */ + */ function rollback() { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Rollback transaction: rolling back transactions are not supported'); } // }}} // {{{ disconnect() - /** * Log out and disconnect from the database. * renamed for PEAR @@ -676,10 +659,9 @@ // }}} // {{{ close() - /** * all the RDBMS specific things needed close a DB connection - * + * * @access private * */ @@ -691,12 +673,11 @@ // }}} // {{{ setDatabase() - /** * Select a different database - * + * * @param string $name name of the database that should be selected - * + * * @access public * * @return string name of the database previously connected to @@ -710,16 +691,15 @@ // }}} // {{{ createDatabase() - /** * create a new database - * + * * @param string $name name of the database that should be created - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function createDatabase($name) { $result = $this->loadManager("Create database"); @@ -731,16 +711,15 @@ // }}} // {{{ dropDatabase() - /** * drop an existing database - * + * * @param string $name name of the database that should be dropped - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function dropDatabase($name) { $result = $this->loadManager("Drop database"); @@ -752,10 +731,9 @@ // }}} // {{{ createTable() - /** * create a new table - * + * * @param string $name Name of the database that should be created * @param array $fields Associative array that contains the definition of * each field of the new table. The indexes of the array entries are @@ -780,11 +758,11 @@ * "length"=>12 * ) * ); - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function createTable($name, &$fields) { $result = $this->loadManager("Create table"); @@ -796,16 +774,15 @@ // }}} // {{{ dropTable() - /** * drop an existing table - * + * * @param string $name name of the table that should be dropped - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function dropTable($name) { $result = $this->loadManager("Drop table"); @@ -817,16 +794,15 @@ // }}} // {{{ alterTable() - /** * alter an existing table - * + * * @param string $name name of the table that is intended to be changed. * * @param array $changes associative array that contains the details of - * each type of change that is intended to be performed. The types of - * changes that are currently supported are defined as follows: - * + * each type of change that is intended to be performed. The types of + * changes that are currently supported are defined as follows: + * * name * New name for the table. * @@ -903,16 +879,15 @@ * "Declaration" => "gender CHAR(1) DEFAULT 'M'" * ) * ) - * ) + * ) * * @param boolean $check indicates whether the function should just check - * if the DBMS driver can perform the requested table - * alterations if the value is true or actually - * perform them otherwise. + * if the DBMS driver can perform the requested table alterations if + * the value is true or actually perform them otherwise. * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function alterTable($name, &$changes, $check) { $result = $this->loadManager("Alter table"); @@ -924,17 +899,16 @@ // }}} // {{{ listDatabases() - /** * list all databases - * + * * @param array $dbs reference to an empty array into which the list is - * stored - * + * stored + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function listDatabases(&$dbs) { $result = $this->loadManager("List databases"); @@ -946,17 +920,16 @@ // }}} // {{{ listUsers() - /** * list all users - * + * * @param array $users reference to an empty array into which the list is * stored - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function listUsers(&$users) { $result = $this->loadManager("List users"); @@ -968,17 +941,16 @@ // }}} // {{{ listViews() - /** * list all viewes in the current database - * + * * @param array $views reference to an empty array into which the list is * stored - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function listViews(&$views) { $result = $this->loadManager("List views"); @@ -990,17 +962,16 @@ // }}} // {{{ listFunctions() - /** * list all functions in the current database - * + * * @param array $functions reference to an empty array into which the list * is stored - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function listFunctions(&$functions) { $result = $this->loadManager("List functions"); @@ -1012,17 +983,16 @@ // }}} // {{{ listTables() - /** * list all tables in the current database - * + * * @param array $tables reference to an empty array into which the list is - * stored - * + * stored + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function listTables(&$tables) { $result = $this->loadManager("List tables"); @@ -1034,18 +1004,17 @@ // }}} // {{{ listTableFields() - /** * list all fields in a tables in the current database - * + * * @param string $table name of table that should be used in method * @param array $fields reference to an empty array into which the list is - * stored - * + * stored + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function listTableFields($table, &$fields) { $result = $this->loadManager("List table fields"); @@ -1057,19 +1026,18 @@ // }}} // {{{ getTableFieldDefinition() - /** * get the stucture of a field into an array - * - * @param string $table name of table that should be used in method - * @param string $fields name of field that should be used in method + * + * @param string $table name of table that should be used in method + * @param string $fields name of field that should be used in method * @param array $definition reference to an empty array into which the - * structure of the field should be stored + * structure of the field should be stored * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function getTableFieldDefinition($table, $field, &$definition) { $result = $this->loadManager("Get table field definition"); @@ -1081,42 +1049,36 @@ // }}} // {{{ createIndex() - /** * get the stucture of a field into an array - * - * @param string $table name of the table on which the index is to be - * created - * @param string $name name of the index to be created + * + * @param string $table name of the table on which the index is to be + * created + * @param string $name name of the index to be created * @param array $definition associative array that defines properties of - * the index to be created. Currently, only one - * property named FIELDS is supported. This - * property is also an associative with the names - * of the index fields as array indexes. Each - * entry of this array is set to another type of - * associative array that specifies properties of - * the index that are specific to each field. - * - * Currently, only the sorting property is - * supported. It should be used to define the - * sorting direction of the index. It may be set - * to either ascending or descending. - * - * Not all DBMS support index sorting direction - * configuration. The DBMS drivers of those that - * do not support it ignore this property. Use - * the function support() to determine whether - * the DBMS driver can manage indexes. - * Example - * array( - * "FIELDS"=>array( - * "user_name"=>array( - * "sorting"=>"ascending" - * ), - * "last_login"=>array() - * ) - * ) - * + * the index to be created. Currently, only one property named FIELDS + * is supported. This property is also an associative with the names + * of the index fields as array indexes. Each entry of this array is + * set to another type of associative array that specifies properties + * of the index that are specific to each field. + * + * Currently, only the sorting property is supported. It should be + * used to define the sorting direction of the index. It may be set + * to either ascending or descending. Not all DBMS support index + * sorting direction configuration. The DBMS drivers of those that do + * not support it ignore this property. Use the function support() to + * determine whether the DBMS driver can manage indexes. + * + * Example + * array( + * "FIELDS"=>array( + * "user_name"=>array( + * "sorting"=>"ascending" + * ), + * "last_login"=>array() + * ) + * ) + * * @access public * * @return mixed DB_OK on success, a DB error on failure @@ -1132,17 +1094,16 @@ // }}} // {{{ dropIndex() - /** * drop existing index - * + * * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function dropIndex($table, $name) { $result = $this->loadManager("Drop index"); @@ -1154,17 +1115,16 @@ // }}} // {{{ createSequence() - /** * create sequence - * + * * @param string $name name of the sequence to be created * @param string $start start value of the sequence; default is 1 - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function createSequence($name, $start = 1) { $result = $this->loadManager("Create sequence"); @@ -1176,16 +1136,15 @@ // }}} // {{{ dropSequence() - /** * drop existing sequence - * + * * @param string $name name of the sequence to be dropped - * + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function dropSequence($name) { $result = $this->loadManager("Drop sequence"); @@ -1197,17 +1156,16 @@ // }}} // {{{ listSequences() - /** * list all tables in the current database - * + * * @param array $sequences reference to an empty array into which the list - * is stored - * + * is stored + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function listSequences(&$sequences) { $result = $this->loadManager("List sequences"); @@ -1227,7 +1185,7 @@ * @access public * * @param string $query the SQL query - * + * * @return mixed a result handle or DB_OK on success, a DB error on failure */ function query($query) @@ -1237,29 +1195,28 @@ // }}} // {{{ setSelectedRowRange() - /** * set the range of the next query - * - * @param string $first first row to select - * @param string $limit number of rows to select - * + * + * @param string $first first row to select + * @param string $limit number of rows to select + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function setSelectedRowRange($first, $limit) { if (!isset($this->supported["SelectRowRanges"])) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Set selected row range: selecting row ranges is not supported by this driver'); } if (gettype($first)!= "integer" || $first < 0) { - return $this->raiseError(DB_ERROR_SYNTAX, "", "", + return $this->raiseError(DB_ERROR_SYNTAX, "", "", 'Set selected row range: it was not specified a valid first selected range row'); } if (gettype($limit)!= "integer" || $limit < 1) { - return $this->raiseError(DB_ERROR_SYNTAX, "", "", + return $this->raiseError(DB_ERROR_SYNTAX, "", "", 'Set selected row range: it was not specified a valid selected range row limit'); } $this->first_selected_row = $first; @@ -1291,14 +1248,13 @@ // }}} // {{{ subSelect() - /** * simple subselect emulation * * @access public * * @param string $query the SQL query for the subselect - * + * * @return string the query */ function subSelect($query) @@ -1311,52 +1267,67 @@ // }}} // {{{ replace() - /** - * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT query, except - * that if there is already a row in the table with the same key field values, the - * REPLACE query just updates its values instead of inserting a new row. - * - * The REPLACE type of query does not make part of the SQL standards. Since pratically - * only MySQL implements it natively, this type of query is emulated through this - * method for other DBMS using standard types of queries inside a transaction to - * assure the atomicity of the operation. + * Execute a SQL REPLACE query. A REPLACE query is identical to a INSERT + * query, except that if there is already a row in the table with the same + * key field values, the REPLACE query just updates its values instead of + * inserting a new row. + * + * The REPLACE type of query does not make part of the SQL standards. Since + * pratically only MySQL implements it natively, this type of query is + * emulated through this method for other DBMS using standard types of + * queries inside a transaction to assure the atomicity of the operation. * * @access public * - * @param string $table name of the table on which the REPLACE query will be executed. - * @param array $fields associative array that describes the fields and the values - * that will be inserted or updated in the specified table. The - * indexes of the array are the names of all the fields of the - * table. The values of the array are also associative arrays that - * describe the values and other properties of the table fields. - * - * Here follows a list of field properties that need to be specified: - * - * Value - * Value to be assigned to the specified field. This value may be of specified in database independent type format as this function can perform the necessary datatype conversions. - * - * Default: this property is required unless the Null property is set to 1. - * - * Type - * Name of the type of the field. Currently, all types Metabase are supported except for clob and blob. - * - * Default: text - * - * Null - * Boolean property that indicates that the value for this field should be set to NULL. - * - * The default value for fields missing in INSERT queries may be specified the definition of a table. Often, the default value is already NULL, but since the REPLACE may be emulated using an UPDATE query, make sure that all fields of the table are listed in this function argument array. - * - * Default: 0 - * - * Key - * Boolean property that indicates that this field should be handled as a primary key or at least as part of the compound unique index of the table that will determine the row that will updated if it exists or inserted a new row otherwise. - * - * This function will fail if no key field is specified or if the value of a key field is set to NULL because fields that are part of unique index they may not be NULL. - * - * Default: 0 - * + * @param string $table name of the table on which the REPLACE query will + * be executed. + * @param array $fields associative array that describes the fields and the + * values that will be inserted or updated in the specified table. The + * indexes of the array are the names of all the fields of the table. + * The values of the array are also associative arrays that describe + * the values and other properties of the table fields. + * + * Here follows a list of field properties that need to be specified: + * + * Value + * Value to be assigned to the specified field. This value may be + * of specified in database independent type format as this + * function can perform the necessary datatype conversions. + * + * Default: this property is required unless the Null property is + * set to 1. + * + * Type + * Name of the type of the field. Currently, all types Metabase + * are supported except for clob and blob. + * + * Default: text + * + * Null + * Boolean property that indicates that the value for this field + * should be set to NULL. + * + * The default value for fields missing in INSERT queries may be + * specified the definition of a table. Often, the default value + * is already NULL, but since the REPLACE may be emulated using + * an UPDATE query, make sure that all fields of the table are + * listed in this function argument array. + * + * Default: 0 + * + * Key + * Boolean property that indicates that this field should be + * handled as a primary key or at least as part of the compound + * unique index of the table that will determine the row that will + * updated if it exists or inserted a new row otherwise. + * + * This function will fail if no key field is specified or if the + * value of a key field is set to NULL because fields that are + * part of unique index they may not be NULL. + * + * Default: 0 + * * @return mixed DB_OK on success, a DB error on failure */ function replace($table, &$fields) @@ -1382,7 +1353,7 @@ $value = "NULL"; } else { if (!isset($fields[$name]["Value"])) { - return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", + return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", 'no value for field "'.$name.'" specified'); } switch(isset($fields[$name]["Type"]) ? $fields[$name]["Type"] : "text") { @@ -1411,7 +1382,7 @@ $value = $this->getTimestampFieldValue($fields[$name]["Value"]); break; default: - return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", + return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", 'no supported type for field "'.$name.'" specified'); } } @@ -1419,7 +1390,7 @@ $values.= $value; if (isset($fields[$name]["Key"]) && $fields[$name]["Key"]) { if ($value == "NULL") { - return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", + return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", 'key values may not be NULL'); } $condition.= ($keys ? " AND " : " WHERE ").$name."=".$value; @@ -1427,7 +1398,7 @@ } } if ($keys == 0) { - return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", + return $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", 'not specified which fields are keys'); } if (!($in_transaction = $this->in_transaction) @@ -1446,7 +1417,7 @@ $affected_rows = $this->affected_rows*2; break; default: - $success = $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", + $success = $this->raiseError(DB_ERROR_CANNOT_REPLACE, "", "", 'replace keys are not unique'); break; } @@ -1470,22 +1441,22 @@ // }}} // {{{ prepareQuery() - /** - * Prepares a query for multiple execution with execute(). - * With some database backends, this is emulated. - * prepareQuery() requires a generic query as string like - * "INSERT INTO numbers VALUES(?,?,?)". The ? are wildcards. - * Types of wildcards: - * ? - a quoted scalar value, i.e. strings, integers - * - * @param string the query to prepare - * - * @return mixed resource handle for the prepared query on success, a DB error on failure - * - * @access public - * @see execute - */ + * Prepares a query for multiple execution with execute(). + * With some database backends, this is emulated. + * prepareQuery() requires a generic query as string like + * "INSERT INTO numbers VALUES(?,?,?)". The ? are wildcards. + * Types of wildcards: + * ? - a quoted scalar value, i.e. strings, integers + * + * @param string the query to prepare + * + * @return mixed resource handle for the prepared query on success, a DB + * error on failure + * + * @access public + * @see execute + */ function prepareQuery($query) { $positions = array(); @@ -1496,7 +1467,7 @@ && $quote<$question) { if (gettype($end_quote = strpos($query, "'", $quote+1))!= "integer") { - return $this->raiseError(DB_ERROR_SYNTAX, "", "", + return $this->raiseError(DB_ERROR_SYNTAX, "", "", 'Prepare query: query with an unterminated text string specified'); } switch($this->escape_quotes) { @@ -1538,23 +1509,23 @@ // }}} // {{{ validatePreparedQuery() - /** * validate that a handle is infact a prepared query - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * * @access private * */ function validatePreparedQuery($prepared_query) { if ($prepared_query < 1 || $prepared_query > count($this->prepared_queries)) { - return $this->raiseError(DB_ERROR_INVALID, "", "", + return $this->raiseError(DB_ERROR_INVALID, "", "", 'Validate prepared query: invalid prepared query'); } if (gettype($this->prepared_queries[$prepared_query-1])!= "array") { - return $this->raiseError(DB_ERROR_INVALID, "", "", + return $this->raiseError(DB_ERROR_INVALID, "", "", 'Validate prepared query: prepared query was already freed'); } return (DB_OK); @@ -1562,16 +1533,16 @@ // }}} // {{{ freePreparedQuery() - /** * Release resources allocated for the specified prepared query. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function freePreparedQuery($prepared_query) { $result = $this->validatePreparedQuery($prepared_query); @@ -1584,18 +1555,19 @@ // }}} // {{{ executePreparedQuery() - /** * Execute a prepared query statement. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() * @param string $query query to be executed - * @param array $types array that contains the types of the columns in the result set - * + * @param array $types array that contains the types of the columns in + * the result set + * * @access private * * @return mixed a result handle or DB_OK on success, a DB error on failure - */ + */ function executePreparedQuery($prepared_query, $query, $types = NULL) { return ($this->query($query, $types)); @@ -1603,18 +1575,19 @@ // }}} // {{{ executeQuery() - /** * Execute a prepared query statement. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * - * @param array $types array that contains the types of the columns in the result set - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * + * @param array $types array that contains the types of the columns in the + * result set + * * @access public * * @return mixed a result handle or DB_OK on success, a DB error on failure - */ + */ function executeQuery($prepared_query, $types = NULL) { $result = $this->validatePreparedQuery($prepared_query); @@ -1627,7 +1600,7 @@ $position++) { if (!isset($this->prepared_queries[$index]["Values"][$position])) { - return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Execute query: it was not defined query argument '.($position+1)); } $current_position = $this->prepared_queries[$index]["Positions"][$position]; @@ -1694,23 +1667,24 @@ // }}} // {{{ execute() /** - * Executes a prepared SQL query - * With execute() the generic query of prepare is - * assigned with the given data array. The values - * of the array inserted into the query in the same - * order like the array order - * - * @param resource $prepared_query query handle from prepare() - * @param array $types array that contains the types of the columns in the result set - * @param array $params numeric array containing the - * data to insert into the query - * @param array $param_types array that contains the types of the values defined in $params - * - * @return mixed a new result handle or a DB_Error when fail - * - * @access public - * @see prepare() - */ + * Executes a prepared SQL query + * With execute() the generic query of prepare is assigned with the given + * data array. The values of the array inserted into the query in the same + * order like the array order + * + * @param resource $prepared_query query handle from prepare() + * @param array $types array that contains the types of the columns in + * the result set + * @param array $params numeric array containing the data to insert into + * the query + * @param array $param_types array that contains the types of the values + * defined in $params + * + * @return mixed a new result handle or a DB_Error when fail + * + * @access public + * @see prepare() + */ function execute($prepared_query, $types = NULL, $params = FALSE, $param_types = NULL) { $this->querySetArray($prepared_query, $params, $param_types); @@ -1720,26 +1694,27 @@ // }}} // {{{ executeMultiple() - /** - * This function does several execute() calls on the same - * statement handle. $params must be an array indexed numerically - * from 0, one execute call is done for every "row" in the array. - * - * If an error occurs during execute(), executeMultiple() does not - * execute the unfinished rows, but rather returns that error. - * - * @param resource $stmt query handle from prepare() - * @param array $types array that contains the types of the columns in the result set - * @param array $params numeric array containing the - * data to insert into the query - * @param array $parAM_types array that contains the types of the values defined in $params - * - * @return mixed a result handle or DB_OK on success, a DB error on failure - * - * @access public - * @see prepare(), execute() - */ + * This function does several execute() calls on the same statement handle. + * $params must be an array indexed numerically from 0, one execute call is + * done for every "row" in the array. + * + * If an error occurs during execute(), executeMultiple() does not execute + * the unfinished rows, but rather returns that error. + * + * @param resource $stmt query handle from prepare() + * @param array $types array that contains the types of the columns in + * the result set + * @param array $params numeric array containing the + * data to insert into the query + * @param array $parAM_types array that contains the types of the values + * defined in $params + * + * @return mixed a result handle or DB_OK on success, a DB error on failure + * + * @access public + * @see prepare(), execute() + */ function executeMultiple($prepared_query, $types = NULL, &$params, $param_types = NULL) { for($i = 0, $j = count($params); $i < $j; $i++) { @@ -1753,18 +1728,18 @@ // }}} // {{{ autoPrepare() - /** - * Make automaticaly an insert or update query and call prepare() with it - * - * @param string $table name of the table - * @param array $table_fields ordered array containing the fields names - * @param int $mode type of query to make (DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE) - * @param string $where in case of update queries, this string will be put after the sql WHERE statement - * @return resource handle for the query - * @see buildManipSQL - * @access public - */ + * Make automaticaly an insert or update query and call prepare() with it + * + * @param string $table name of the table + * @param array $table_fields ordered array containing the fields names + * @param int $mode type of query to make (DB_AUTOQUERY_INSERT or + * DB_AUTOQUERY_UPDATE) + * @param string $where in case of update queries, this string will be put * after the sql WHERE statement + * @return resource handle for the query + * @see buildManipSQL + * @access public + */ function autoPrepare($table, $table_fields, $mode = DB_AUTOQUERY_INSERT, $where = FALSE) { $query = $this->buildManipSQL($table, $table_fields, $mode, $where); @@ -1773,19 +1748,22 @@ // {{{ // }}} autoExecute() - /** - * Make automaticaly an insert or update query and call prepare() and execute() with it - * - * @param string $table name of the table - * @param array $fields_values assoc ($key=>$value) where $key is a field name and $value its value - * @param int $mode type of query to make (DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE) - * @param string $where in case of update queries, this string will be put after the sql WHERE statement - * @return mixed a new DB_Result or a DB_Error when fail - * @see buildManipSQL - * @see autoPrepare - * @access public - */ + * Make automaticaly an insert or update query and call prepare() and + * execute() with it + * + * @param string $table name of the table + * @param array $fields_values assoc ($key=>$value) where $key is a field + * name and $value its value + * @param int $mode type of query to make (DB_AUTOQUERY_INSERT or + * DB_AUTOQUERY_UPDATE) + * @param string $where in case of update queries, this string will be put + * after the sql WHERE statement + * @return mixed a new DB_Result or a DB_Error when fail + * @see buildManipSQL + * @see autoPrepare + * @access public + */ function autoExecute($table, $fields_values, $mode = DB_AUTOQUERY_INSERT, $where = FALSE) { $sth = $this->autoPrepare($table, array_keys($fields_values), $mode, $where); @@ -1794,21 +1772,26 @@ // {{{ // }}} buildManipSQL() - /** - * Make automaticaly an sql query for prepare() - * - * Example : buildManipSQL('table_sql', array('field1', 'field2', 'field3'), DB_AUTOQUERY_INSERT) - * will return the string : INSERT INTO table_sql (field1,field2,field3) VALUES (?,?,?) - * NB : This belongs more to a SQL Builder class, but this is a simple facility - * - * @param string $table name of the table - * @param array $table_fields ordered array containing the fields names - * @param int $mode type of query to make (DB_AUTOQUERY_INSERT or DB_AUTOQUERY_UPDATE) - * @param string $where in case of update queries, this string will be put after the sql WHERE statement - * @return string sql query for prepare() - * @access public - */ + * Make automaticaly an sql query for prepare() + * + * Example: + * buildManipSQL('table_sql', array('field1', 'field2', 'field3'), + * DB_AUTOQUERY_INSERT) + * will return the string : INSERT INTO table_sql (field1,field2,field3) + * VALUES (?,?,?) + * NB : This belongs more to a SQL Builder class, but this is a simple + * facility + * + * @param string $table name of the table + * @param array $table_fields ordered array containing the fields names + * @param int $mode type of query to make (DB_AUTOQUERY_INSERT or + * DB_AUTOQUERY_UPDATE) + * @param string $where in case of update queries, this string will be put + * after the sql WHERE statement + * @return string sql query for prepare() + * @access public + */ function buildManipSQL($table, $table_fields, $mode, $where = FALSE) { if (count($table_fields)==0) { @@ -1854,26 +1837,28 @@ // }}} // {{{ querySet() - /** * Set the value of a parameter of a prepared query. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter the order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $type designation of the type of the parameter to be set. - * The designation of the currently supported types is as follows: - text, boolean, integer, decimal, float, date, time, timestamp, clob, blob - * @param mixed $value value that is meant to be assigned to specified parameter. The type of - * the value depends on the $type argument. - * @param boolean $is_null flag that indicates whether whether the parameter is a NULL - * @param string $field name of the field that is meant to be assigned with this parameter value - * when it is of type clob or blob - * + * + * @param int $prepared_query argument is a handle that was returned + * by the function prepareQuery() + * @param int $parameter the order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $type designation of the type of the parameter to be set. + * The designation of the currently supported types is as follows: + * text, boolean, integer, decimal, float, date, time, timestamp, + * clob, blob + * @param mixed $value value that is meant to be assigned to specified + * parameter. The type of the value depends on the $type argument. + * @param boolean $is_null flag that indicates whether whether the + * parameter is a NULL + * @param string $field name of the field that is meant to be assigned + * with this parameter value when it is of type clob or blob + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySet($prepared_query, $parameter, $type, $value, $is_null = 0, $field = "") { $result = $this->validatePreparedQuery($prepared_query); @@ -1884,7 +1869,7 @@ if ($parameter<1 || $parameter>count($this->prepared_queries[$index]["Positions"])) { - return $this->raiseError(DB_ERROR_SYNTAX, "", "", + return $this->raiseError(DB_ERROR_SYNTAX, "", "", 'Query set: it was not specified a valid argument number'); } $this->prepared_queries[$index]["Values"][$parameter-1] = $value; @@ -1896,26 +1881,25 @@ // }}} // {{{ querySetArray() - /** * Set the values of multiple a parameter of a prepared query in bulk. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param array $params array thats specifies all necessary infromation for querySet() - * the array elements must use keys corresponding to the number of the - * position of the parameter. - * single dimensional array: - * querySet with type text for all values of the array - * multi dimensional array : - - * 0: value - * 1: optional data - * @param array $types array thats specifies the types of the fields - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param array $params array thats specifies all necessary infromation + * for querySet() the array elements must use keys corresponding to + * the number of the position of the parameter. + * single dimensional array: + * querySet with type text for all values of the array + * multi dimensional array : + * 0: value + * 1: optional data + * @param array $types array thats specifies the types of the fields + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetArray($prepared_query, $params, $types = NULL) { if (is_array($types)) { @@ -1957,7 +1941,7 @@ $success = $this->querySet($prepared_query, $i+1, "decimal", $this->getDecimalFieldValue($params[$i][0])); break; default: - $success = $this->querySet($prepared_query, $i+1, "text", $this->getTextFieldValue($params[$i][0])); + $success = $this->querySet($prepared_query, $i+1, "text", $this->getTextFieldValue($params[$i][0])); break; } if (MDB::isError($success)) { @@ -1979,21 +1963,21 @@ // }}} // {{{ querySetNull() - /** * Set the value of a parameter of a prepared query to NULL. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $type designation of the type of the parameter to be set. The designation of - * the currently supported types is list in the usage of the function - * querySet() - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $type designation of the type of the parameter to be set. + * The designation of the currently supported types is list in the + * usage of the function querySet() + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetNull($prepared_query, $parameter, $type) { return ($this->querySet($prepared_query, $parameter, $type, "NULL", 1, "")); @@ -2001,19 +1985,20 @@ // }}} // {{{ querySetText() - /** * Set a parameter of a prepared query with a text value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $value text value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $value text value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetText($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "text", $this->getTextFieldValue($value))); @@ -2021,23 +2006,23 @@ // }}} // {{{ querySetClob() - /** * Set a parameter of a prepared query with a character large object value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param int $value handle of large object created with createLOB() function from which - * it will be read the data value that is meant to be assigned to - * specified parameter. - * @param string $field name of the field of a INSERT or UPDATE query to which it will be - assigned the value to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param int $value handle of large object created with createLOB() + * function from which it will be read the data value that is meant + * to be assigned to specified parameter. + * @param string $field name of the field of a INSERT or UPDATE query to + * which it will be assigned the value to specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetCLob($prepared_query, $parameter, $value, $field) { return ($this->querySet($prepared_query, $parameter, "clob", $value, 0, $field)); @@ -2045,23 +2030,23 @@ // }}} // {{{ querySetClob() - /** * Set a parameter of a prepared query with a binary large object value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param int $value handle of large object created with createLOB() function from which - * it will be read the data value that is meant to be assigned to - * specified parameter. - * @param string $field name of the field of a INSERT or UPDATE query to which it will be - assigned the value to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param int $value handle of large object created with createLOB() + * function from which it will be read the data value that is meant + * to be assigned to specified parameter. + * @param string $field name of the field of a INSERT or UPDATE query to + * which it will be assigned the value to specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetBLob($prepared_query, $parameter, $value, $field) { return ($this->querySet($prepared_query, $parameter, "blob", $value, 0, $field)); @@ -2069,19 +2054,20 @@ // }}} // {{{ querySetInteger() - /** * Set a parameter of a prepared query with a text value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param int $value an integer value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param int $value an integer value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetInteger($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "integer", $this->getIntegerFieldValue($value))); @@ -2089,19 +2075,20 @@ // }}} // {{{ querySetBoolean() - /** * Set a parameter of a prepared query with a boolean value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param boolean $value boolean value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param boolean $value boolean value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetBoolean($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "boolean", $this->getBooleanFieldValue($value))); @@ -2109,19 +2096,20 @@ // }}} // {{{ querySetDate() - /** * Set a parameter of a prepared query with a date value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $value date value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $value date value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetDate($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "date", $this->getDateFieldValue($value))); @@ -2129,19 +2117,20 @@ // }}} // {{{ querySetTimestamp() - /** * Set a parameter of a prepared query with a time stamp value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $value time stamp value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $value time stamp value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetTimestamp($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "timestamp", $this->getTimestampFieldValue($value))); @@ -2149,19 +2138,20 @@ // }}} // {{{ querySetTime() - /** * Set a parameter of a prepared query with a time value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $value time value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $value time value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetTime($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "time", $this->getTimeFieldValue($value))); @@ -2172,16 +2162,18 @@ /** * Set a parameter of a prepared query with a float value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $value float value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $value float value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetFloat($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "float", $this->getFloatFieldValue($value))); @@ -2189,19 +2181,20 @@ // }}} // {{{ querySetDecimal() - /** * Set a parameter of a prepared query with a decimal value. - * - * @param int $prepared_query argument is a handle that was returned by the function prepareQuery() - * @param int $parameter order number of the parameter in the query statement. The order - * number of the first parameter is 1. - * @param string $value decimal value that is meant to be assigned to specified parameter. - * + * + * @param int $prepared_query argument is a handle that was returned by + * the function prepareQuery() + * @param int $parameter order number of the parameter in the query + * statement. The order number of the first parameter is 1. + * @param string $value decimal value that is meant to be assigned to + * specified parameter. + * * @access public * @see querySet() * @return mixed DB_OK on success, a DB error on failure - */ + */ function querySetDecimal($prepared_query, $parameter, $value) { return ($this->querySet($prepared_query, $parameter, "decimal", $this->getDecimalFieldValue($value))); @@ -2209,30 +2202,32 @@ // }}} // {{{ setResultTypes() - /** - * Define the list of types to be associated with the columns of a given result set. - * - * This function may be called before invoking fetchInto(), fetchOne(), fetchRow(), - * fetchCol() and fetchAll() so that the necessary data type conversions are performed - * on the data to be retrieved by them. If this function is not called, the type of all - * result set columns is assumed to be text, thus leading to not perform any conversions. - * - * @param resource $result result identifier - * @param string $types reference to an array variable that lists the data types to be - * expected in the result set columns. If this array contains less - * types than the number of columns that are returned in the result - * set, the remaining columns are assumed to be of the type text. - * Currently, the types clob and blob are not fully supported. - * + * Define the list of types to be associated with the columns of a given + * result set. + * + * This function may be called before invoking fetchInto(), fetchOne(), + * fetchRow(), fetchCol() and fetchAll() so that the necessary data type + * conversions are performed on the data to be retrieved by them. If this + * function is not called, the type of all result set columns is assumed + * to be text, thus leading to not perform any conversions. + * + * @param resource $result result identifier + * @param string $types reference to an array variable that lists the + * data types to be expected in the result set columns. If this array + * contains less types than the number of columns that are returned + * in the result set, the remaining columns are assumed to be of the + * type text. Currently, the types clob and blob are not fully + * supported. + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function setResultTypes($result, &$types) { if (isset($this->result_types[$result])) { - return $this->raiseError(DB_ERROR_INVALID, "", "", + return $this->raiseError(DB_ERROR_INVALID, "", "", 'Set result types: attempted to redefine the types of the columns of a result set'); } $columns = $this->numCols($result); @@ -2240,7 +2235,7 @@ return $columns; } if ($columns<count($types)) { - return $this->raiseError(DB_ERROR_SYNTAX, "", "", + return $this->raiseError(DB_ERROR_SYNTAX, "", "", 'Set result types: it were specified more result types ('.count($types).') than result columns ('.$columns.')'); } $valid_types = array( @@ -2257,7 +2252,7 @@ ); for($column = 0; $column<count($types); $column++) { if (!isset($valid_types[$types[$column]])) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Set result types: '.$types[$column].' is not a supported column type'); } $this->result_types[$result][$column] = $valid_types[$types[$column]]; @@ -2290,40 +2285,41 @@ /** * Retrieve the names of columns returned by the DBMS in a query result. - * - * @param resource $result result identifier - * @param array $columns reference to an associative array variable that will hold the - * names of columns. The indexes of the array are the column names - * mapped to lower case and the values are the respective numbers - * of the columns starting from 0. Some DBMS may not return any - * columns when the result set does not contain any rows. - * + * + * @param resource $result result identifier + * @param array $columns reference to an associative array variable + * that will hold the names of columns. The indexes of the array are + * the column names mapped to lower case and the values are the + * respective numbers of the columns starting from 0. Some DBMS may + * not return any columns when the result set does not contain any + * rows. + * * @access public * * @return mixed DB_OK on success, a DB error on failure - */ + */ function getColumnNames($result, &$columns) { $columns = array(); - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Get column names: obtaining result column names is not implemented'); } // }}} // {{{ numCols() - /** * Count the number of columns returned by the DBMS in a query result. - * - * @param resource $result result identifier - * + * + * @param resource $result result identifier + * * @access public * - * @return mixed integer value with the number of columns, a DB error on failure - */ + * @return mixed integer value with the number of columns, a DB error + * on failure + */ function numCols($result) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Number of columns: obtaining the number of result columns is not implemented'); } @@ -2331,8 +2327,8 @@ // {{{ endOfResult() /** * check if the end of the result set has been reached - * - * @param resource $result result identifier + * + * @param resource $result result identifier * * @return mixed TRUE or FALSE on sucess, a DB error on failure * @@ -2340,35 +2336,31 @@ */ function endOfResult($result) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'End of result: end of result method not implemented'); } // }}} // {{{ setFetchMode() - /** * Sets which fetch mode should be used by default on queries * on this connection. * - * @param integer $fetchmode DB_FETCHMODE_ORDERED or - * DB_FETCHMODE_ASSOC, possibly bit-wise OR'ed with - * DB_FETCHMODE_FLIPPED. - * - * @param string $object_class The class of the object - * to be returned by the fetch methods when - * the DB_FETCHMODE_OBJECT mode is selected. - * If no class is specified by default a cast - * to object from the assoc array row will be done. - * There is also the posibility to use and extend the - * 'DB_Row' class. + * @param integer $fetchmode DB_FETCHMODE_ORDERED or DB_FETCHMODE_ASSOC, + * possibly bit-wise OR'ed with DB_FETCHMODE_FLIPPED. + * + * @param string $object_class The class of the object to be returned by + * the fetch methods when the DB_FETCHMODE_OBJECT mode is selected. + * If no class is specified by default a cast to object from the + * assoc array row will be done. There is also the posibility to use + * and extend the 'DB_Row' class. * * @see DB_FETCHMODE_ORDERED * @see DB_FETCHMODE_ASSOC * @see DB_FETCHMODE_FLIPPED * @see DB_FETCHMODE_OBJECT * @see DB_Row::DB_Row() - * + * * @access public */ function setFetchMode($fetchmode, $object_class = NULL) @@ -2390,35 +2382,35 @@ // }}} // {{{ fetch() /** - * fetch value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed string on success, a DB error on failure - * - * @access public - */ + * fetch value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed string on success, a DB error on failure + * + * @access public + */ function fetch($result, $row, $field) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Fetch: fetch result method not implemented'); } // }}} // {{{ fetchLoabResult() /** - * fetch a lob value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed string on success, a DB error on failure - * - * @access public - */ + * fetch a lob value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed string on success, a DB error on failure + * + * @access public + */ function fetchLobResult($result, $row, $field) { $lob = count($this->lobs) + 1; @@ -2435,7 +2427,7 @@ "ResultLOB" => $lob ); if (!createLob($character_lob, $clob)) { - return $this->raiseError(DB_ERROR, "", "", + return $this->raiseError(DB_ERROR, "", "", 'Fetch LOB result: '. $character_lob["Error"]); } return ($clob); @@ -2444,18 +2436,18 @@ // }}} // {{{ retrieveLob() /** - * fetch a float value from a result set - * - * @param int $lob handle to a lob created by the createLob() function - * - * @return mixed DB_Ok on success, a DB error on failure - * - * @access public - */ + * fetch a float value from a result set + * + * @param int $lob handle to a lob created by the createLob() function + * + * @return mixed DB_Ok on success, a DB error on failure + * + * @access public + */ function retrieveLob($lob) { if (!isset($this->lobs[$lob])) { - return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Fetch LOB result: it was not specified a valid lob'); } if (!isset($this->lobs[$lob]["Value"])) { @@ -2467,15 +2459,15 @@ // }}} // {{{ endOfResultLob() /** - * Determine whether it was reached the end of the large object and therefore there is - * no more data to be read for the its input stream. - * - * @param int $lob handle to a lob created by the createLob() function - * - * @return mixed TRUE or FALSE on success, a DB error on failure - * - * @access public - */ + * Determine whether it was reached the end of the large object and + * therefore there is no more data to be read for the its input stream. + * + * @param int $lob handle to a lob created by the createLob() function + * + * @return mixed TRUE or FALSE on success, a DB error on failure + * + * @access public + */ function endOfResultLob($lob) { $result = $this->retrieveLob($lob); @@ -2488,16 +2480,18 @@ // }}} // {{{ readResultLob() /** - * Read data from large object input stream. - * - * @param int $lob handle to a lob created by the createLob() function - * @param blob $data reference to a variable that will hold data to be read from the large object input stream - * @param int $length integer value that indicates the largest ammount of data to be read from the large object input stream. - * - * @return mixed length on success, a DB error on failure - * - * @access public - */ + * Read data from large object input stream. + * + * @param int $lob handle to a lob created by the createLob() function + * @param blob $data reference to a variable that will hold data to be + * read from the large object input stream + * @param int $length integer value that indicates the largest ammount of + * data to be read from the large object input stream. + * + * @return mixed length on success, a DB error on failure + * + * @access public + */ function readResultLob($lob, &$data, $length) { $result = $this->retrieveLob($lob); @@ -2513,12 +2507,13 @@ // }}} // {{{ destroyResultLob() /** - * Free any resources allocated during the lifetime of the large object handler object. - * - * @param int $lob handle to a lob created by the createLob() function - * - * @access public - */ + * Free any resources allocated during the lifetime of the large object + * handler object. + * + * @param int $lob handle to a lob created by the createLob() function + * + * @access public + */ function destroyResultLob($lob) { if (isset($this->lobs[$lob])) { @@ -2529,54 +2524,56 @@ // }}} // {{{ fetchClobResult() /** - * fetch a clob value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure, a DB error on failure - * - * @access public - */ + * fetch a clob value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure, + * a DB error on failure + * + * @access public + */ function fetchClobResult($result, $row, $field) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'fetch clob result method is not implemented'); } // }}} // {{{ fetchBlobResult() /** - * fetch a blob value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure - * - * @access public - */ + * fetch a blob value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure + * + * @access public + */ function fetchBlobResult($result, $row, $field) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'fetch blob result method is not implemented'); } // }}} // {{{ resultIsNull() /** - * Determine whether the value of a query result located in given row and field is a NULL. - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed TRUE or FALSE on success, a DB error on failure - * - * @access public - */ + * Determine whether the value of a query result located in given row and + * field is a NULL. + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed TRUE or FALSE on success, a DB error on failure + * + * @access public + */ function resultIsNull($result, $row, $field) { $res = $this->fetch($result, $row, $field); @@ -2589,15 +2586,15 @@ // }}} // {{{ baseConvertResult() /** - * general type conversion method - * - * @param mixed $value refernce to a value to be converted - * @param int $type constant that specifies which type to convert to - * - * @return object a DB error on failure - * - * @access private - */ + * general type conversion method + * + * @param mixed $value refernce to a value to be converted + * @param int $type constant that specifies which type to convert to + * + * @return object a DB error on failure + * + * @access private + */ function baseConvertResult(&$value, $type) { switch($type) { @@ -2621,11 +2618,11 @@ case MDB_TYPE_CLOB: case MDB_TYPE_BLOB: $value = ""; - return $this->raiseError(DB_ERROR_INVALID, "", "", + return $this->raiseError(DB_ERROR_INVALID, "", "", 'BaseConvertResult: attempt to convert result value to an unsupported type '.$type); default: $value = ""; - return $this->raiseError(DB_ERROR_INVALID, "", "", + return $this->raiseError(DB_ERROR_INVALID, "", "", 'BaseConvertResult: attempt to convert result value to an unknown type '.$type); } } @@ -2633,15 +2630,15 @@ // }}} // {{{ convertResult() /** - * convert a value to a RDBMS indepdenant MDB type - * - * @param mixed $value refernce to a value to be converted - * @param int $type constant that specifies which type to convert to - * - * @return object a DB error on failure - * - * @access public - */ + * convert a value to a RDBMS indepdenant MDB type + * + * @param mixed $value refernce to a value to be converted + * @param int $type constant that specifies which type to convert to + * + * @return object a DB error on failure + * + * @access public + */ function convertResult(&$value, $type) { return ($this->baseConvertResult($value, $type)); @@ -2650,15 +2647,15 @@ // }}} // {{{ convertResultRow() /** - * convert a result row - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * - * @return mixed DB_Ok on success, a DB error on failure - * - * @access public - */ + * convert a result row + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * + * @return mixed DB_Ok on success, a DB error on failure + * + * @access public + */ function convertResultRow($result, &$row) { if (isset($this->result_types[$result])) @@ -2679,7 +2676,7 @@ break; default: if (!$this->convertResult($row[$column], $type)) { - return $this->raiseError(DB_ERROR_INVALID, "", "", + return $this->raiseError(DB_ERROR_INVALID, "", "", 'convertResultRow: attempt to convert result value to an unknown type '.$type); } break; @@ -2692,16 +2689,16 @@ // }}} // {{{ fetchDateResult() /** - * fetch a date value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure - * - * @access public - */ + * fetch a date value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure + * + * @access public + */ function fetchDateResult($result, $row, $field) { $value = $this->fetch($result,$row,$field); @@ -2712,16 +2709,16 @@ // }}} // {{{ fetchTimestampResult() /** - * fetch a timestamp value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure - * - * @access public - */ + * fetch a timestamp value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure + * + * @access public + */ function fetchTimestampResult($result, $row, $field) { $value = $this->fetch($result,$row,$field); @@ -2732,16 +2729,16 @@ // }}} // {{{ fetchTimeResult() /** - * fetch a time value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure - * - * @access public - */ + * fetch a time value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure + * + * @access public + */ function fetchTimeResult($result, $row, $field) { $value = $this->fetch($result, $row, $field); @@ -2752,16 +2749,16 @@ // }}} // {{{ fetchBooleanResult() /** - * fetch a boolean value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure - * - * @access public - */ + * fetch a boolean value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure + * + * @access public + */ function fetchBooleanResult($result, $row, $field) { $value = $this->fetch($result, $row, $field); @@ -2772,16 +2769,16 @@ // }}} // {{{ fetchFloatResult() /** - * fetch a float value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure - * - * @access public - */ + * fetch a float value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure + * + * @access public + */ function fetchFloatResult($result, $row, $field) { $value = $this->fetch($result, $row, $field); @@ -2792,36 +2789,36 @@ // }}} // {{{ fetchDecimalResult() /** - * fetch a decimal value from a result set - * - * @param resource $result result identifier - * @param int $row number of the row where the data can be found - * @param int $field field number where the data can be found - * - * @return mixed content of the specified data cell, a DB error on failure - * - * @access public - */ + * fetch a decimal value from a result set + * + * @param resource $result result identifier + * @param int $row number of the row where the data can be found + * @param int $field field number where the data can be found + * + * @return mixed content of the specified data cell, a DB error on failure + * + * @access public + */ function fetchDecimalResult($result, $row, $field) { $value = $this->fetch($result, $row, $field); $this->convertResult($value, MDB_TYPE_DECIMAL); return ($value); - } + } // }}} // {{{ numRows() /** - * returns the number of rows in a result object - * renamed for PEAR - * used to be: NumberOfColumns - * - * @param object DB_Result the result object to check - * - * @return mixed DB_Error or the number of rows - * - * @access public - */ + * returns the number of rows in a result object + * renamed for PEAR + * used to be: NumberOfColumns + * + * @param object DB_Result the result object to check + * + * @return mixed DB_Error or the number of rows + * + * @access public + */ function numRows($result) { return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", "Num Rows: number of rows method not implemented"); @@ -2829,7 +2826,6 @@ // }}} // {{{ freeResult() - /** * Free the internal resources associated with $result. * @@ -2847,12 +2843,12 @@ // }}} // {{{ errorNative() /** - * returns an errormessage, provides by the database - * - * @return mixed DB_Error or message - * - * @access public - */ + * returns an errormessage, provides by the database + * + * @return mixed DB_Error or message + * + * @access public + */ function errorNative() { return $this->raiseError(DB_ERROR_NOT_CAPABLE); @@ -2860,33 +2856,30 @@ // }}} // {{{ getIntegerDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an integer type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: - * - * unsigned + * Obtain DBMS specific SQL code portion needed to declare an integer type + * field to be used in statements like CREATE TABLE. * - * Boolean flag that indicates whether the field should - * be declared as unsigned integer if possible. + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * default + * unsigned + * Boolean flag that indicates whether the field should be + * declared as unsigned integer if possible. * - * Integer value to be used as default for this field. + * default + * Integer value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getIntegerDeclaration($name, &$field) { @@ -2899,35 +2892,31 @@ // }}} // {{{ getTextDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an text type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: - * - * length + * Obtain DBMS specific SQL code portion needed to declare an text type + * field to be used in statements like CREATE TABLE. * - * Integer value that determines the maximum length of - * the text field. If this argument is missing the field - * should be declared to have the longest length allowed - * by the DBMS. + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * default + * length + * Integer value that determines the maximum length of the text + * field. If this argument is missing the field should be + * declared to have the longest length allowed by the DBMS. * - * Text value to be used as default for this field. + * default + * Text value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getTextDeclaration($name, &$field) { @@ -2936,31 +2925,28 @@ // }}} // {{{ getCLOBDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an character large object type - * field to be used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: + * Obtain DBMS specific SQL code portion needed to declare an character + * large object type field to be used in statements like CREATE TABLE. * - * length + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * Integer value that determines the maximum length of - * the large object field. If this argument is missing - * the field should be declared to have the longest length - * allowed by the DBMS. + * length + * Integer value that determines the maximum length of the large + * object field. If this argument is missing the field should be + * declared to have the longest length allowed by the DBMS. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getCLOBDeclaration($name, &$field) { @@ -2969,31 +2955,28 @@ // }}} // {{{ getBLOBDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an binary large object type - * field to be used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: - * - * length - * - * Integer value that determines the maximum length of - * the large object field. If this argument is missing - * the field should be declared to have the longest length - * allowed by the DBMS. - * - * notnull - * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * + * Obtain DBMS specific SQL code portion needed to declare an binary large + * object type field to be used in statements like CREATE TABLE. + * + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: + * + * length + * Integer value that determines the maximum length of the large + * object field. If this argument is missing the field should be + * declared to have the longest length allowed by the DBMS. + * + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. + * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getBLOBDeclaration($name, &$field) { @@ -3002,28 +2985,26 @@ // }}} // {{{ getBooleanDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an boolean type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: + * Obtain DBMS specific SQL code portion needed to declare a boolean type + * field to be used in statements like CREATE TABLE. * - * default + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * Boolean value to be used as default for this field. + * default + * Boolean value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getBooleanDeclaration($name, &$field) { @@ -3032,28 +3013,26 @@ // }}} // {{{ getDateDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an date type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: + * Obtain DBMS specific SQL code portion needed to declare a date type + * field to be used in statements like CREATE TABLE. * - * default + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * Date value to be used as default for this field. + * default + * Date value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getDateDeclaration($name, &$field) { @@ -3062,28 +3041,26 @@ // }}} // {{{ getTimestampDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an timestamp type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: + * Obtain DBMS specific SQL code portion needed to declare a timestamp + * field to be used in statements like CREATE TABLE. * - * default + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * Time stamp value to be used as default for this field. + * default + * Timestamp value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getTimestampDeclaration($name, &$field) { @@ -3092,28 +3069,26 @@ // }}} // {{{ getTimeDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an time type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: + * Obtain DBMS specific SQL code portion needed to declare a time + * field to be used in statements like CREATE TABLE. * - * default + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * Time value to be used as default for this field. + * default + * Time value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getTimeDeclaration($name, &$field) { @@ -3122,28 +3097,26 @@ // }}} // {{{ getFloatDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an float type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: + * Obtain DBMS specific SQL code portion needed to declare a float type + * field to be used in statements like CREATE TABLE. * - * default + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * Integer value to be used as default for this field. + * default + * Float value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getFloatDeclaration($name, &$field) { @@ -3152,28 +3125,26 @@ // }}} // {{{ getDecimalDeclaration() - /** - * Obtain DBMS specific SQL code portion needed to declare an decimal type field to be - * used in statements like CREATE TABLE. - * - * @param string $name name the field to be declared. - * @param string $field associative array with the name of the properties of the - * field being declared as array indexes. Currently, the - * types of supported field properties are as follows: + * Obtain DBMS specific SQL code portion needed to declare a decimal type + * field to be used in statements like CREATE TABLE. * - * default + * @param string $name name the field to be declared. + * @param string $field associative array with the name of the properties + * of the field being declared as array indexes. Currently, the types + * of supported field properties are as follows: * - * Integer value to be used as default for this field. + * default + * Decimal value to be used as default for this field. * - * notnull + * notnull + * Boolean flag that indicates whether this field is constrained + * to not be set to NULL. * - * Boolean flag that indicates whether this field is - * constrained to not be set to NULL. - * * @access public * - * @return string DBMS specific SQL code portion that should be used to declare the specified field. + * @return string DBMS specific SQL code portion that should be used to + * declare the specified field. */ function getDecimalDeclaration($name, &$field) { @@ -3182,15 +3153,16 @@ // }}} // {{{ getIntegerFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getIntegerFieldValue($value) { @@ -3199,15 +3171,16 @@ // }}} // {{{ getTextFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that already contains any DBMS specific escaped character sequences. + * @return string text string that already contains any DBMS specific + * escaped character sequences. */ function getTextFieldValue($value) { @@ -3217,33 +3190,33 @@ // }}} // {{{ getCLOBFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. - */ + * @return string text string that represents the given argument value in + * a DBMS specific format. + */ function getCLOBFieldValue($prepared_query, $parameter, $clob, &$value) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Get CLOB field value: prepared queries with values of type "clob" are not yet supported'); } // }}} // {{{ freeCLOBValue() - /** - * free a chracter large object - * - * @param resource $prepared_query query handle from prepare() - * @param string $blob - * @param string $value - * @param string $success - * + * free a character large object + * + * @param resource $prepared_query query handle from prepare() + * @param string $blob + * @param string $value + * @param string $success + * * @access private */ function freeCLOBValue($prepared_query, $clob, &$value, $success) @@ -3252,33 +3225,33 @@ // }}} // {{{ getBLOBFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getBLOBFieldValue($prepared_query, $parameter, $blob, &$value) { - return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", + return $this->raiseError(DB_ERROR_UNSUPPORTED, "", "", 'Get BLOB field value: prepared queries with values of type "blob" are not yet supported'); } // }}} // {{{ freeBLOBValue() - /** * free a binary large object - * - * @param resource $prepared_query query handle from prepare() - * @param string $blob - * @param string $value - * @param string $success - * + * + * @param resource $prepared_query query handle from prepare() + * @param string $blob + * @param string $value + * @param string $success + * * @access private */ function freeBLOBValue($prepared_query, $blob, &$value, $success) @@ -3287,15 +3260,16 @@ // }}} // {{{ getBooleanFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getBooleanFieldValue($value) { @@ -3304,15 +3278,16 @@ // }}} // {{{ getDateFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getDateFieldValue($value) { @@ -3321,15 +3296,16 @@ // }}} // {{{ getTimestampFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getTimestampFieldValue($value) { @@ -3338,15 +3314,16 @@ // }}} // {{{ getTimeFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getTimeFieldValue($value) { @@ -3355,15 +3332,16 @@ // }}} // {{{ getFloatFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getFloatFieldValue($value) { @@ -3372,15 +3350,16 @@ // }}} // {{{ getDecimalFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getDecimalFieldValue($value) { @@ -3389,16 +3368,17 @@ // }}} // {{{ getFieldValue() - /** - * Convert a text value into a DBMS specific format that is suitable to compose query statements. - * - * @param string $type type to which the value should be converted to - * @param string $value text string value that is intended to be converted. - * + * Convert a text value into a DBMS specific format that is suitable to + * compose query statements. + * + * @param string $type type to which the value should be converted to + * @param string $value text string value that is intended to be converted. + * * @access public * - * @return string text string that represents the given argument value in a DBMS specific format. + * @return string text string that represents the given argument value in + * a DBMS specific format. */ function getFieldValue($type, $value) { @@ -3425,7 +3405,6 @@ // }}} // {{{ support() - /** * Tell whether a DB implementation or its backend extension * supports a given feature. @@ -3442,54 +3421,54 @@ // }}} // {{{ nextId() /** - * returns the next free id of a sequence - * renamed for PEAR - * used to be: getSequenceNextValue - * - * @param string $name name of the sequence - * @param boolean $ondemand when true the seqence is - * automatic created, if it - * not exists - * - * @return mixed DB_Error or id - */ + * returns the next free id of a sequence + * renamed for PEAR + * used to be: getSequenceNextValue + * + * @param string $name name of the sequence + * @param boolean $ondemand when true the seqence is + * automatic created, if it + * not exists + * + * @return mixed DB_Error or id + */ function nextId($name, $ondemand = FALSE) { - return $this->raiseError(DB_ERROR_NOT_CAPABLE, "", "", + return $this->raiseError(DB_ERROR_NOT_CAPABLE, "", "", 'Next Sequence: getting next sequence value not supported'); } // }}} // {{{ currId() /** - * returns the current id of a sequence - * renamed for PEAR - * used to be: getSequenceCurrentValue - * - * @param string $name name of the sequence - * - * @return mixed DB_Error or id - */ + * returns the current id of a sequence + * renamed for PEAR + * used to be: getSequenceCurrentValue + * + * @param string $name name of the sequence + * + * @return mixed DB_Error or id + */ function currId($name) { - return $this->raiseError(DB_ERROR_NOT_CAPABLE, "", "", + return $this->raiseError(DB_ERROR_NOT_CAPABLE, "", "", 'Current Sequence: getting current sequence value not supported'); } // }}} // {{{ baseFetchInto() - /** * get the stucture of a field into an array - * - * @param resource $result result identifier - * @param array $array reference to an array where data from the row is stored - * @param int $rownum the row number to fetch - * + * + * @param resource $result result identifier + * @param array $array reference to an array where data from the row + * is stored + * @param int $rownum the row number to fetch + * * @access private * * @return mixed DB_OK on success, a DB error on failure - */ + */ function baseFetchInto($result, &$array, $rownum) { if($rownum == NULL) { @@ -3537,14 +3516,15 @@ * renamed for PEAR * used to be fetchResultArray * - * @param resource $result result identifier - * @param array $array reference to an array where data from the row is stored - * @param int $fetchmode how the array data should be indexed - * @param int $rownum the row number to fetch + * @param resource $result result identifier + * @param array $array reference to an array where data from the row + * is stored + * @param int $fetchmode how the array data should be indexed + * @param int $rownum the row number to fetch * @access public * * @return int DB_OK on success, a DB error on failure - * + * * @access public */ function fetchInto($result, &$array, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = NULL) @@ -3554,28 +3534,28 @@ // }}} // {{{ fetchOne() - /** * Fetch and return a field of data (it uses fetchInto for that) * renamed for PEAR * used to be fetchResultField - * - * @param resource $result result identifier - * @param mixed $value reference to a variable where data from the field is stored - * @param int $fetchmode how the array data should be indexed + * + * @param resource $result result identifier + * @param mixed $value reference to a variable where data from the + * field is stored + * @param int $fetchmode how the array data should be indexed * * @return mixed DB_OK on success, a DB error on failure - * + * * @access public */ function fetchOne($result, &$value, $fetchmode = DB_FETCHMODE_DEFAULT) { if (MDB::isError($result)) { - return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Fetch field: it was not specified a valid result set'); } if (MDB::isError($this->endOfResult($result))) { - $res = $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + $res = $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Fetch field: result set is empty'); } else { $res = $this->fetchInto($result, $value, $fetchmode, NULL); @@ -3589,30 +3569,30 @@ // }}} // {{{ fetchRow() - /** * Fetch and return a row of data (it uses fetchInto for that) * renamed for PEAR * used to be fetchResultRow - * - * @param resource $result result identifier - * @param array $row reference to an array where data from the row is stored - * @param int $fetchmode how the array data should be indexed - * @param int $rownum the row number to fetch + * + * @param resource $result result identifier + * @param array $row reference to an array where data from the row + * is stored + * @param int $fetchmode how the array data should be indexed + * @param int $rownum the row number to fetch * * @return mixed DB_OK on success, a DB error on failure - * + * * @access public */ function fetchRow($result, &$row, $fetchmode = DB_FETCHMODE_DEFAULT, $rownum = NULL) { if (MDB::isError($result)) { - return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Fetch row: it was not specified a valid result set'); } if (MDB::isError($this->endOfResult($result))) { $this->freeResult($result); - return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Fetch row: result set is empty'); } $row = array(); @@ -3625,25 +3605,25 @@ // }}} // {{{ fetchCol() - /** * Fetch and return a column of data (it uses fetchInto for that) * renamed for PEAR * used to be fetchResultColumn - * - * @param resource $result result identifier - * @param array $column reference to an array where data from the row is stored - * @param int $fetchmode how the array data should be indexed - * @param int $colnum the row number to fetch + * + * @param resource $result result identifier + * @param array $column reference to an array where data from the row + * is stored + * @param int $fetchmode how the array data should be indexed + * @param int $colnum the row number to fetch * * @return mixed DB_OK on success, a DB error on failure - * + * * @access public */ function fetchCol($result, &$column, $fetchmode = DB_FETCHMODE_DEFAULT, $colnum = '0') { if (MDB::isError($result)) { - return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Fetch column: it was not specified a valid result set'); } $temp = $column = array(); @@ -3661,35 +3641,34 @@ // }}} // {{{ fetchAll() - /** * Fetch and return a column of data (it uses fetchInto for that) * renamed for PEAR * used to be fetchResultAll - * - * @param resource $result result identifier - * @param array $column reference to an array where data from the row is stored - * @param int $fetchmode how the array data should be indexed - * @param boolean $rekey if set to true the $all will have the first column as its first dimension - * @param boolean $force_array used only when the query returns exactly two columns. - * If true, the values of the returned array - * will be one-element arrays instead of scalars. - * @param boolean $group if true, the values of the returned array - * is wrapped in another array. If the same - * key value (in the first column) repeats - * itself, the values will be appended to - * this array instead of overwriting the - * existing values. + * + * @param resource $result result identifier + * @param array $column reference to an array where data from the row + * is stored + * @param int $fetchmode how the array data should be indexed + * @param boolean $rekey if set to true, the $all will have the first + * column as its first dimension + * @param boolean $force_array used only when the query returns exactly + * two columns. If true, the values of the returned array will be + * one-element arrays instead of scalars. + * @param boolean $group if true, the values of the returned array is + * wrapped in another array. If the same key value (in the first + * column) repeats itself, the values will be appended to this array + * instead of overwriting the existing values. * * @return mixed DB_OK on success, a DB error on failure * @see getAssoc() - * + * * @access public */ function fetchAll($result, &$all, $fetchmode = DB_FETCHMODE_DEFAULT, $rekey = FALSE, $force_array = FALSE, $group = FALSE) { if (MDB::isError($result)) { - return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", + return $this->raiseError(DB_ERROR_NEED_MORE_DATA, "", "", 'Fetch All: it was not specified a valid result set'); } if($rekey) { @@ -3733,20 +3712,21 @@ // }}} // {{{ queryOne() - /** - * Execute the specified query, fetch the value from the first column of the first - * row of the result set into a given variable and then frees the result set. - * - * @param string $query the SELECT query statement to be executed. - * @param mixed $field reference to a variable into which the result set field is fetched. - * If it is NULL this variable is unset. - * @param string $type optional argument that specifies the expected datatype of the result - * set field, so that an eventual conversion may be performed. The - * default datatype is text, meaning that no conversion is performed + * Execute the specified query, fetch the value from the first column of + * the first row of the result set into a given variable and then frees + * the result set. + * + * @param string $query the SELECT query statement to be executed. + * @param mixed $field reference to a variable into which the result + * set field is fetched. If it is NULL this variable is unset. + * @param string $type optional argument that specifies the expected + * datatype of the result set field, so that an eventual conversion + * may be performed. The default datatype is text, meaning that no + * conversion is performed * * @return mixed DB_OK on success, a DB error on failure - * + * * @access public */ function queryOne($query, &$field, $type = NULL) @@ -3765,21 +3745,22 @@ // {{{ queryRow() /** - * Execute the specified query, fetch the value from the first column of the first - * row of the result set into a given variable and then frees the result set. - * - * @param string $query the SELECT query statement to be executed. - * @param array $row reference to an array variable into which the result set row values - * are fetched. The array positions are filled according to the position - * of the result set columns starting from 0. Columns with NULL values - * are not assigned. - * @param array $types optional array argument that specifies a list of expected datatypes - * of the result set columns, so that the eventual conversions may be - * performed. The default list of datatypes is empty, meaning that no - * conversion is performed. + * Execute the specified query, fetch the value from the first column of + * the first row of the result set into a given variable and then frees + * the result set. + * + * @param string $query the SELECT query statement to be executed. + * @param array $row reference to an array variable into which the + * result set row values are fetched. The array positions are filled + * according to the position of the result set columns starting from + * 0. Columns with NULL values are not assigned. + * @param array $types optional array argument that specifies a list of + * expected datatypes of the result set columns, so that the eventual + * conversions may be performed. The default list of datatypes is + * empty, meaning that no conversion is performed. * * @return mixed DB_OK on success, a DB error on failure - * + * * @access public */ function queryRow($query, &$row, $types = NULL) @@ -3793,22 +3774,24 @@ // }}} // {{{ queryCol() - /** - * Execute the specified query, fetch the value from the first column of the first - * row of the result set into a given variable and then frees the result set. - * - * @param string $query the SELECT query statement to be executed. - * @param array $column reference to an array variable into which the result set column is - * fetched. The rows on which the first column is NULL are ignored. - * Therefore, do not rely on the count of entries of the array variable - * to assume that it is the number of rows in the result set. - * @param string $type optional argument that specifies the expected datatype of the result - * set field, so that an eventual conversion may be performed. The - * default datatype is text, meaning that no conversion is performed + * Execute the specified query, fetch the value from the first column of + * the first row of the result set into a given variable and then frees + * the result set. + * + * @param string $query the SELECT query statement to be executed. + * @param array $column reference to an array variable into which the + * result set column is fetched. The rows on which the first column + * is NULL are ignored. Therefore, do not rely on the count of + * entries of the array variable to assume that it is the number of + * rows in the result set. + * @param string $type optional argument that specifies the expected + * datatype of the result set field, so that an eventual conversion + * may be performed. The default datatype is text, meaning that no + * conversion is performed * * @return mixed DB_OK on success, a DB error on failure - * + * * @access public */ function queryCol($query, &$column, $type = NULL) @@ -3825,23 +3808,24 @@ // }}} // {{{ queryAll() - /** - * Execute the specified query, fetch the value from the first column of the first - * row of the result set into a given variable and then frees the result set. - * - * @param string $query the SELECT query statement to be executed. - * @param array $all reference to a two dimension array variable into which the result - * set rows and column values are fetched. The array positions are - * filled according to the position of the result set columns and rows - * starting from 0. Columns with NULL values are not assigned. - * @param array $types optional array argument that specifies a list of expected datatypes - * of the result set columns, so that the eventual conversions may be - * performed. The default list of datatypes is empty, meaning that no - * conversion is performed. + * Execute the specified query, fetch the value from the first column of + * the first row of the result set into a given variable and then frees + * the result set. + * + * @param string $query the SELECT query statement to be executed. + * @param array $all reference to a two dimension array variable into + * which the result set rows and column values are fetched. The array + * positions are filled according to the position of the result set + * columns and rows starting from 0. Columns with NULL values are not + * assigned. + * @param array $types optional array argument that specifies a list of + * expected datatypes of the result set columns, so that the eventual + * conversions may be performed. The default list of datatypes is + * empty, meaning that no conversion is performed. * * @return mixed DB_OK on success, a DB error on failure - * + * * @access public */ function queryAll($query, &$all, $types = NULL) @@ -3854,20 +3838,18 @@ // }}} // {{{ getOne() - /** * Fetch the first column of the first row of data returned from * a query. Takes care of doing the query and freeing the results * when finished. * * @param string $query the SQL query - * - * @param string $type string that contains the type of the column in the result set - * + * @param string $type string that contains the type of the column in the + * result set * @param array $params if supplied, prepare/execute will be used - * with this array as execute parameters - * - * @param array $param_types array that contains the types of the values defined in $params + * with this array as execute parameters + * @param array $param_types array that contains the types of the values + * defined in $params * * @return mixed DB_Error or the returned value of the query * @@ -3893,7 +3875,7 @@ if (MDB::isError($result)) { return $result; } - + $err = $this->fetchOne($result, $value, DB_FETCHMODE_ORDERED); if (MDB::isError($err)) { return $err; @@ -3910,22 +3892,19 @@ // }}} // {{{ getRow() - /** * Fetch the first row of data returned from a query. Takes care * of doing the query and freeing the results when finished. * * @param string $query the SQL query - * - * @param array $types array that contains the types of the columns in the result set - * + * @param array $types array that contains the types of the columns in + * the result set * @param array $params array if supplied, prepare/execute will be used - * with this array as execute parameters - * - * @param array $param_types array that contains the types of the values defined in $params - * + * with this array as execute parameters + * @param array $param_types array that contains the types of the values + * defined in $params * @param integer $fetchmode the fetch mode to use - * + * * @access public * @return array the first row of results as an array indexed from * 0, or a DB error code. @@ -3947,7 +3926,7 @@ if (MDB::isError($result)) { return $result; } - + $err = $this->fetchRow($result, $row, $fetchmode); if (MDB::isError($err)) { return $err; @@ -3964,24 +3943,21 @@ // }}} // {{{ getCol() - /** * Fetch a single column from a result set and return it as an * indexed array. * * @param string $query the SQL query - * - * @param string $type string that contains the type of the column in the result set - * - * @param array $params array if supplied, prepare/execute will be used - * with this array as execute parameters - * - * @param array $param_types array that contains the types of the values defined in $params * + * @param string $type string that contains the type of the column in the + * result set + * @param array $params array if supplied, prepare/execute will be used + * with this array as execute parameters + * @param array $param_types array that contains the types of the values + * defined in $params * @param integer $fetchmode the fetch mode to use - * * @param mixed $colnum which column to return (integer [column number, - * starting at 0] or string [column name]) + * starting at 0] or string [column name]) * * @access public * @@ -4009,7 +3985,7 @@ if (MDB::isError($result)) { return $result; } - + $err = $this->fetchCol($result, $col, $fetchmode, $colnum); if (MDB::isError($err)) { return $err; @@ -4025,7 +4001,6 @@ // }}} // {{{ getAssoc() - /** * Fetch the entire result set of a query and return it as an * associative array using the first column as the key. @@ -4080,24 +4055,24 @@ * values for results regardless of the database's internal type. * * @param string $query the SQL query - * - * @param array $types array that contains the types of the columns in the result set + * + * @param array $types array that contains the types of the columns in + * the result set * * @param array $params array if supplied, prepare/execute will be used - * with this array as execute parameters + * with this array as execute parameters + * + * @param array $param_types array that contains the types of the values + * defined in $params * - * @param array $param_types array that contains the types of the values defined in $params - * * @param boolean $force_array used only when the query returns * exactly two columns. If true, the values of the returned array * will be one-element arrays instead of scalars. - * + * * @param boolean $group if true, the values of the returned array - * is wrapped in another array. If the same - * key value (in the first column) repeats - * itself, the values will be appended to - * this array instead of overwriting the - * existing values. + * is wrapped in another array. If the same key value (in the first + * column) repeats itself, the values will be appended to this array + * instead of overwriting the existing values. * * @access public * @@ -4122,7 +4097,7 @@ if (MDB::isError($result)) { return $result; } - + $err = $this->fetchAll($result, $all, $fetchmode, TRUE, $force_array, $group); if (MDB::isError($err)) { return $err; @@ -4138,15 +4113,16 @@ // }}} // {{{ getAll() - /** * Fetch all the rows returned from a query. * * @param string $query the SQL query - * @param array $types array that contains the types of the columns in the result set - * @param array $params array if supplied, prepare/execute will be used - * with this array as execute parameters - * @param array $param_types array that contains the types of the values defined in $params + * @param array $types array that contains the types of the columns in + * the result set + * @param array $params array if supplied, prepare/execute will be used + * with this array as execute parameters + * @param array $param_types array that contains the types of the values + * defined in $params * @param integer $fetchmode the fetch mode to use * * @access public @@ -4170,7 +4146,7 @@ if (MDB::isError($result)) { return $result; } - + $err = $this->fetchAll($result, $all, $fetchmode); if (MDB::isError($err)) { return $err; @@ -4187,15 +4163,15 @@ // }}} // {{{ tableInfo() /** - * returns meta data about the result set - * - * @param resource $result result identifier - * @param mixed $mode depends on implementation - * - * @return array an nested array, or a DB error - * - * @access public - */ + * returns meta data about the result set + * + * @param resource $result result identifier + * @param mixed $mode depends on implementation + * + * @return array an nested array, or a DB error + * + * @access public + */ function tableInfo($result, $mode = NULL) { return $this->raiseError(DB_ERROR_NOT_CAPABLE);
« previous php.pear.cvs (#4985) next »