cvs: pear /MDB manager_common.php
| From: | Lukas Smith | Date: | Tue, 27 Aug 2002 09:20:23 +0000 |
| Subject: | cvs: pear /MDB manager_common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-6005@lists.php.net to get a copy of this message | ||
lsmith Tue Aug 27 05:20:23 2002 EDT
Modified files:
/pear/MDB manager_common.php
Log:
fixed phpdoc comments
moved getSequenceDefinition() from manager_mysql.php to manager_common.php
Index: pear/MDB/manager_common.php diff -u pear/MDB/manager_common.php:1.19 pear/MDB/manager_common.php:1.20 --- pear/MDB/manager_common.php:1.19 Wed Aug 21 09:01:58 2002 +++ pear/MDB/manager_common.php Tue Aug 27 05:20:22 2002 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@dybnet.de> | // +----------------------------------------------------------------------+ // -// $Id: manager_common.php,v 1.19 2002/08/21 13:01:58 lsmith Exp $ +// $Id: manager_common.php,v 1.20 2002/08/27 09:20:22 lsmith Exp $ // if(!defined('MDB_MANAGER_COMMON_INCLUDED')) @@ -65,7 +65,7 @@ /** * get declaration of a field * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $field_name name of the field to be created * @param string $field associative array with the name of the properties * of the field being declared as array indexes. Currently, the types @@ -128,7 +128,7 @@ /** * get declaration of a number of field in bulk * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $fields a multidimensional associative array. The first dimension determines the field name, while the second dimension is keyed with the name of the properties @@ -172,7 +172,7 @@ /** * list all tables in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $sqn string that containts name of a potential sequence * @return mixed name of the sequence if $sqn is a name of a sequence, else FALSE * @access private @@ -193,7 +193,7 @@ /** * create a new database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $name name of the database that should be created * @return mixed DB_OK on success, a DB error on failure * @access public @@ -209,7 +209,7 @@ /** * drop an existing database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $name name of the database that should be dropped * @return mixed DB_OK on success, a DB error on failure * @access public @@ -225,7 +225,7 @@ /** * create a new table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @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 the names of the fields of the table an @@ -274,7 +274,7 @@ /** * drop an existing table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $name name of the table that should be dropped * @return mixed DB_OK on success, a DB error on failure * @access public @@ -290,7 +290,7 @@ /** * alter an existing table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @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 @@ -394,7 +394,7 @@ /** * list all databases * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -410,7 +410,7 @@ /** * list all users * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -426,7 +426,7 @@ /** * list all views in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -442,7 +442,7 @@ /** * list all functions in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -458,7 +458,7 @@ /** * list all tables in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -474,7 +474,7 @@ /** * list all fields in a tables in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @return mixed data array on success, a DB error on failure * @access public @@ -491,7 +491,7 @@ /** * get the stucture of a field into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @param string $fields name of field that should be used in method * @return mixed data array on success, a DB error on failure @@ -509,7 +509,7 @@ /** * get the stucture of a field into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @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. @@ -573,7 +573,7 @@ /** * drop existing index * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a DB error on failure @@ -590,7 +590,7 @@ /** * list all indexes in a table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @return mixed data array on success, a DB error on failure * @access public @@ -607,7 +607,7 @@ /** * get the stucture of an index into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @param string $index name of index that should be used in method * @return mixed data array on success, a DB error on failure @@ -625,7 +625,7 @@ /** * create sequence * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $seq_name name of the sequence to be created * @param string $start start value of the sequence; default is 1 * @return mixed DB_OK on success, a DB error on failure @@ -643,7 +643,7 @@ /** * drop existing sequence * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $seq_name name of the sequence to be dropped * @return mixed DB_OK on success, a DB error on failure * @access public @@ -660,7 +660,7 @@ /** * list all sequences in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -676,15 +676,40 @@ /** * get the stucture of a sequence into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class + * @param string $sequence name of sequence that should be used in method + * @return mixed data array on success, a DB error on failure + * @access public + */ + + // }}} + // {{{ getSequenceDefinition() + + /** + * get the stucture of a sequence into an array + * + * @param object $dbs database object that is extended by this class * @param string $sequence name of sequence that should be used in method * @return mixed data array on success, a DB error on failure * @access public */ function getSequenceDefinition(&$db, $sequence) { - return $db->raiseError(DB_ERROR_NOT_CAPABLE, '', '', - 'get squence definition: getting sequence definition is not supported'); + $start = $db->currId($sequence); + if (MDB::isError($start)) { + return ($start); + } + if ($db->support('CurrId')) { + $start++; + } else { + $db->warnings[] = 'database does not support getting current + sequence value,the sequence value was incremented'; + } + $definition = array(); + if($start != 1) { + $definition = array('start' => $start); + } + return($definition); } }
Index: pear/MDB/manager_common.php diff -u pear/MDB/manager_common.php:1.19 pear/MDB/manager_common.php:1.20 --- pear/MDB/manager_common.php:1.19 Wed Aug 21 09:01:58 2002 +++ pear/MDB/manager_common.php Tue Aug 27 05:20:22 2002 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@dybnet.de> | // +----------------------------------------------------------------------+ // -// $Id: manager_common.php,v 1.19 2002/08/21 13:01:58 lsmith Exp $ +// $Id: manager_common.php,v 1.20 2002/08/27 09:20:22 lsmith Exp $ // if(!defined('MDB_MANAGER_COMMON_INCLUDED')) @@ -65,7 +65,7 @@ /** * get declaration of a field * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $field_name name of the field to be created * @param string $field associative array with the name of the properties * of the field being declared as array indexes. Currently, the types @@ -128,7 +128,7 @@ /** * get declaration of a number of field in bulk * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $fields a multidimensional associative array. The first dimension determines the field name, while the second dimension is keyed with the name of the properties @@ -172,7 +172,7 @@ /** * list all tables in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $sqn string that containts name of a potential sequence * @return mixed name of the sequence if $sqn is a name of a sequence, else FALSE * @access private @@ -193,7 +193,7 @@ /** * create a new database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $name name of the database that should be created * @return mixed DB_OK on success, a DB error on failure * @access public @@ -209,7 +209,7 @@ /** * drop an existing database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $name name of the database that should be dropped * @return mixed DB_OK on success, a DB error on failure * @access public @@ -225,7 +225,7 @@ /** * create a new table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @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 the names of the fields of the table an @@ -274,7 +274,7 @@ /** * drop an existing table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $name name of the table that should be dropped * @return mixed DB_OK on success, a DB error on failure * @access public @@ -290,7 +290,7 @@ /** * alter an existing table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @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 @@ -394,7 +394,7 @@ /** * list all databases * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -410,7 +410,7 @@ /** * list all users * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -426,7 +426,7 @@ /** * list all views in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -442,7 +442,7 @@ /** * list all functions in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -458,7 +458,7 @@ /** * list all tables in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -474,7 +474,7 @@ /** * list all fields in a tables in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @return mixed data array on success, a DB error on failure * @access public @@ -491,7 +491,7 @@ /** * get the stucture of a field into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @param string $fields name of field that should be used in method * @return mixed data array on success, a DB error on failure @@ -509,7 +509,7 @@ /** * get the stucture of a field into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @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. @@ -573,7 +573,7 @@ /** * drop existing index * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @param string $name name of the index to be dropped * @return mixed DB_OK on success, a DB error on failure @@ -590,7 +590,7 @@ /** * list all indexes in a table * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @return mixed data array on success, a DB error on failure * @access public @@ -607,7 +607,7 @@ /** * get the stucture of an index into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $table name of table that should be used in method * @param string $index name of index that should be used in method * @return mixed data array on success, a DB error on failure @@ -625,7 +625,7 @@ /** * create sequence * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $seq_name name of the sequence to be created * @param string $start start value of the sequence; default is 1 * @return mixed DB_OK on success, a DB error on failure @@ -643,7 +643,7 @@ /** * drop existing sequence * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @param string $seq_name name of the sequence to be dropped * @return mixed DB_OK on success, a DB error on failure * @access public @@ -660,7 +660,7 @@ /** * list all sequences in the current database * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class * @return mixed data array on success, a DB error on failure * @access public */ @@ -676,15 +676,40 @@ /** * get the stucture of a sequence into an array * - * @param $dbs (reference) array where database names will be stored + * @param object $dbs database object that is extended by this class + * @param string $sequence name of sequence that should be used in method + * @return mixed data array on success, a DB error on failure + * @access public + */ + + // }}} + // {{{ getSequenceDefinition() + + /** + * get the stucture of a sequence into an array + * + * @param object $dbs database object that is extended by this class * @param string $sequence name of sequence that should be used in method * @return mixed data array on success, a DB error on failure * @access public */ function getSequenceDefinition(&$db, $sequence) { - return $db->raiseError(DB_ERROR_NOT_CAPABLE, '', '', - 'get squence definition: getting sequence definition is not supported'); + $start = $db->currId($sequence); + if (MDB::isError($start)) { + return ($start); + } + if ($db->support('CurrId')) { + $start++; + } else { + $db->warnings[] = 'database does not support getting current + sequence value,the sequence value was incremented'; + } + $definition = array(); + if($start != 1) { + $definition = array('start' => $start); + } + return($definition); } }