cvs: pear /DBA DBA.php DBA_Builtin.php DBA_Compat.php DBA_Relational.php DBA_Simple.php DBA_Sql.php DBA_Table.php DBA_Toolbox.php Sql_lex.php
Sql_parse.php package.xml

From: Date: Wed, 17 Jul 2002 16:57:20 +0000
Subject: cvs: pear /DBA DBA.php DBA_Builtin.php DBA_Compat.php DBA_Relational.php DBA_Simple.php DBA_Sql.php DBA_Table.php DBA_Toolbox.php Sql_lex.php
Sql_parse.php package.xml
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5169@lists.php.net to get a copy of this message
busterb Wed Jul 17 12:57:20 2002 EDT Modified files: /pear/DBA DBA.php DBA_Builtin.php DBA_Compat.php DBA_Relational.php DBA_Simple.php DBA_Sql.php DBA_Table.php DBA_Toolbox.php Sql_lex.php Sql_parse.php package.xml Log: add code-folding marks, preemptively bump version so i won't forget next time before tagging

Index: pear/DBA/DBA.php diff -u pear/DBA/DBA.php:1.12 pear/DBA/DBA.php:1.13 --- pear/DBA/DBA.php:1.12 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA.php Wed Jul 17 12:57:20 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA.php,v 1.12 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA.php,v 1.13 2002/07/17 16:57:20 busterb Exp $ // /** @@ -28,7 +28,7 @@ * dbm engine for installations where dba support is not included in PHP. * * @author Brent Cook <busterb@mail.utexas.edu> - * @version 0.17 + * @version 0.18 * @access public * @package DBA */ Index: pear/DBA/DBA_Builtin.php diff -u pear/DBA/DBA_Builtin.php:1.14 pear/DBA/DBA_Builtin.php:1.15 --- pear/DBA/DBA_Builtin.php:1.14 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA_Builtin.php Wed Jul 17 12:57:20 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Builtin.php,v 1.14 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA_Builtin.php,v 1.15 2002/07/17 16:57:20 busterb Exp $ require_once 'PEAR.php'; @@ -32,12 +32,13 @@ * driver due to its lack of writes. DB2 apparently segfaults PHP? * * @author Brent Cook <busterb@mail.utexas.edu> - * @version 0.17 + * @version 0.18 * @access public * @package DBA */ class DBA_Builtin extends PEAR{ + // {{{ instance variables /** * Name of the database * @access private @@ -67,7 +68,9 @@ * @access private */ var $_hasReplace; + // }}} + // {{{ DBA_Builtin($driver = 'gdbm') /* Constructor * * @access public @@ -77,7 +80,9 @@ { $this->_driver = $driver; } + // }}} + // {{{ open($dbName='', $mode='r', $driver=NULL) /** * Opens a database. * @@ -140,7 +145,9 @@ ." with mode $mode"); } } + // }}} + // {{{ close() /** * Closes an open database. * @@ -157,7 +164,9 @@ return $this->raiseError('DBA: No database was open'); } } + // }}} + // {{{ reopen($mode) /** * Reopens an already open database in read-only or write mode. * If the database is already in the requested mode, then this function @@ -183,7 +192,9 @@ return $this->raiseError('DBA: No database was open'); } } + // }}} + // {{{ _DBA_Builtin() /** * PEAR emulated destructor calls close on PHP shutdown * @access private @@ -192,7 +203,9 @@ { $this->close(); } + // }}} + // {{{ isOpen() /** * Returns the current open status for the database * @@ -203,7 +216,9 @@ { return($this->_readable || $this->_writable); } + // }}} + // {{{ isReadable() /** * Returns the current read status for the database * @@ -214,7 +229,9 @@ { return $this->_readable; } + // }}} + // {{{ isWritable() /** * Returns the current write status for the database * @@ -225,7 +242,9 @@ { return $this->_writable; } + // }}} + // {{{ remove($key) /** * Removes the value at location $key * @@ -245,7 +264,9 @@ $key. ', DB not writable'); } } + // }}} + // {{{ fetch($key) /** * Returns the value that is stored at $key. * @@ -267,7 +288,9 @@ $this->_dbName. ', DB not readable'); } } + // }}} + // {{{ firstkey() /** * Returns the first key in the database * @@ -282,7 +305,9 @@ return false; } } + // }}} + // {{{ nextkey() /** * Returns the next key in the database, false if there is a problem * @@ -297,7 +322,9 @@ return false; } } + // }}} + // {{{ insert($key, $value) /** * Inserts a new value at $key. Will not overwrite if the key/value pair * already exist @@ -321,7 +348,9 @@ $this->_dbName. ', DB not writable'); } } + // }}} + // {{{ replace($key, $value) /** * Inserts a new value at key. If the key/value pair * already exist, overwrites the value @@ -350,7 +379,9 @@ $this->_dbName. ', DB not writable'); } } + // }}} + // {{{ create($dbName, $driver='gdbm') /** * Creates a new database file if one does not exist. If it already exists, * updates the last-updated timestamp on the database @@ -367,7 +398,9 @@ return $this->raiseError('DBA: Could not create database: '.$dbName); } } + // }}} + // {{{ db_exists($dbName) /** * Indicates whether a database with given name exists * @@ -379,7 +412,9 @@ { return file_exists($dbName); } + // }}} + // {{{ exists($key) /** * Check whether key exists * @@ -391,7 +426,9 @@ { return($this->isOpen() && dba_exists($key, $this->_dba)); } + // }}} + // {{{ sync() /** * Synchronizes an open database to disk * @access public @@ -400,7 +437,9 @@ { return dba_sync($this->_dba); } + // }}} + // {{{ optimize() /** * Optimizes an open database * @access public @@ -409,5 +448,6 @@ { return dba_optimize($this->_dba); } + // }}} } ?> Index: pear/DBA/DBA_Compat.php diff -u pear/DBA/DBA_Compat.php:1.11 pear/DBA/DBA_Compat.php:1.12 --- pear/DBA/DBA_Compat.php:1.11 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA_Compat.php Wed Jul 17 12:57:20 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Compat.php,v 1.11 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA_Compat.php,v 1.12 2002/07/17 16:57:20 busterb Exp $ /** * dba compatibility layer @@ -29,7 +29,7 @@ * work. * * @author Brent Cook <busterb@mail.utexas.edu> - * @version 0.17 + * @version 0.18 * @access public * @package DBA * @see PHP dba Documentation Index: pear/DBA/DBA_Relational.php diff -u pear/DBA/DBA_Relational.php:1.38 pear/DBA/DBA_Relational.php:1.39 --- pear/DBA/DBA_Relational.php:1.38 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA_Relational.php Wed Jul 17 12:57:20 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Relational.php,v 1.38 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA_Relational.php,v 1.39 2002/07/17 16:57:20 busterb Exp $ require_once 'PEAR.php'; require_once 'DB/DBA/DBA_Table.php'; @@ -32,10 +32,11 @@ * @author Brent Cook <busterb@mail.utexas.edu> * @package DBA * @access public - * @version 0.17 + * @version 0.18 */ class DBA_Relational extends PEAR { + // {{{ instance variables /** * Handles to table objects * @access private @@ -63,7 +64,9 @@ * @var string */ var $_driver; + // }}} + // {{{ DBA_Relational($home = '', $driver = 'simple') /** * Constructor * @@ -86,11 +89,15 @@ // initialize the manager table $this->_manager =& new DBA_Table($this->_driver); } + // }}} + // {{{ raiseError($message) function raiseError($message) { return PEAR::raiseError('DBA_Relational: '.$message); } + // }}} + // {{{ close() /** * Closes all open tables * @@ -106,7 +113,9 @@ } } } + // }}} + // {{{ _DBA_Relational() /** * PEAR emulated destructor calls close on PHP shutdown * @access private @@ -115,7 +124,9 @@ { $this->close(); } + // }}} + // {{{ _openTable($tableName, $mode = 'r') /** * Opens a table, keeps it in the list of tables. Can also reopen tables * to different file modes @@ -141,13 +152,16 @@ if (($mode == 'r') && !$this->_tables[$tableName]->isReadable()) { // obtain a shared lock on the table return $this->_tables[$tableName]->lockSh(); - } elseif (($mode == 'w') && !$this->_tables[$tableName]->isWritable()){ + } elseif (($mode == 'w') && + !$this->_tables[$tableName]->isWritable()){ // obtain an exclusive lock on the table return $this->_tables[$tableName]->lockEx(); } } } + // }}} + // {{{ tableExists($tableName) /** * Returns whether the specified table exists in the db home * @@ -158,7 +172,9 @@ { return $this->_manager->tableExists($this->_home.$tableName); } + // }}} + // {{{ createTable /** * Creates a new table * @@ -171,7 +187,9 @@ { return $this->_manager->create($this->_home.$tableName, $schema); } + // }}} + // {{{ getSchema /** * Returns an array with the stored schema for the table * @@ -187,7 +205,9 @@ return $this->_tables[$tableName]->getSchema(); } } + // }}} + // {{{ isOpen($tableName) /** * Returns the current read status for the database * @@ -201,7 +221,9 @@ return false; } } + // }}} + // {{{ insert($tableName, $data) /** * Inserts a new row in a table * @@ -218,7 +240,9 @@ return $this->_tables[$tableName]->insert($data); } } + // }}} + // {{{ replace($tableName, $key, $data) /** * Replaces an existing row in a table, inserts if the row does not exist * @@ -237,7 +261,9 @@ return $this->_tables[$tableName]->replace($key, $data); } } + // }}} + // {{{ remove($tableName, $key) /** * Remove an existing row in a table * @@ -255,7 +281,9 @@ return $this->_tables[$tableName]->remove($key); } } + // }}} + // {{{ fetch($tableName, $key) /** * Fetches an existing row from a table * @@ -273,7 +301,9 @@ return $this->_tables[$tableName]->fetch($key); } } + // }}} + // {{{ select($tableName, $query, $rows=null) /** * Performs a select on a table. This means that a subset of rows in a * table are filtered and returned based on the query. Accepts any valid @@ -296,8 +326,9 @@ return $this->_tables[$tableName]->select($query, $rows); } } + // }}} - + // {{{ sort($fields, $order='a', $rows) /** * Sorts rows by field in either ascending or descending order * SQL analog: 'select * from rows, order by fields' @@ -314,7 +345,9 @@ { return $this->_manager->sort($fields, $order, $rows); } + // }}} + // {{{ project($fields, $rows) /** * Projects rows by field. This means that a subset of the possible fields * are in the resulting rows. The SQL analog is 'select fields from table' @@ -329,7 +362,9 @@ { return $this->_manager->project($fields, $rows); } + // }}} + // {{{ unique($rows) /** * Returns the unique rows from a set of rows * @@ -342,7 +377,9 @@ { return $this->_manager->unique($rows); } + // }}} + // {{{ finalize($tableName, $rows=null) /** * Converts the results from any of the row operations to a 'finalized' * display-ready form. That means that timestamps, sets and enums are @@ -368,7 +405,9 @@ return $this->_tables[$tableName]->finalize($rows); } } + // }}} + // {{{ _validateTable(&$table, &$rows, &$fields, $altName) /** * Verifies that the fields submitted exist in $table * @access private @@ -394,7 +433,9 @@ $rows = null; return false; } + // }}} + // {{{ _parsePHPQuery($rawQuery, $fieldsA, $fieldsB, $tableA, $tableB) /** * Constructs a PHP query based on $rawQuery * @access private @@ -431,7 +472,9 @@ } return $phpQuery; } + // }}} + // {{{ join($tableA, $tableB, $rawQuery) /** * Joins rows between two tables based on a query. * @@ -474,4 +517,5 @@ return $results; } + // }}} } Index: pear/DBA/DBA_Simple.php diff -u pear/DBA/DBA_Simple.php:1.25 pear/DBA/DBA_Simple.php:1.26 --- pear/DBA/DBA_Simple.php:1.25 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA_Simple.php Wed Jul 17 12:57:20 2002 @@ -18,10 +18,11 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Simple.php,v 1.25 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA_Simple.php,v 1.26 2002/07/17 16:57:20 busterb Exp $ require_once 'PEAR.php'; +// {{{ constants /** * Location in the index file for a block location */ @@ -41,6 +42,7 @@ * Location in the index file for a block key */ define('DBA_SIMPLE_KEY',3); +// }}} /** * DBA_Simple provides a file-based implementation of a DBM-style database. @@ -69,12 +71,13 @@ * The sync function calls fflush on the data and index files. * * @author Brent Cook - * @version 0.17 + * @version 0.18 * @access public * @package DBA */ class DBA_Simple extends PEAR { + // {{{ instance variables /** * Name of the database * @access private @@ -104,7 +107,9 @@ * @access private */ var $_readable; + // }}} + // {{{ open($dbName='', $mode='r') /** * Opens a database. * @@ -192,7 +197,9 @@ $this->_readIdx(); } } + // }}} + // {{{ close() /** * Closes an open database. * @@ -215,7 +222,9 @@ return $this->raiseError('DBA: No database was open'); } } + // }}} + // {{{ reopen($mode) /** * Reopens an already open database in read-only or write mode. * If the database is already in the requested mode, then this function @@ -244,7 +253,9 @@ return $this->raiseError('DBA: No database was open'); } } + // }}} + // {{{ _DBA_Simple() /** * PEAR emulated destructor calls close on PHP shutdown * @access private @@ -253,7 +264,9 @@ { $this->close(); } + // }}} + // {{{ getName() /** * Returns the name of the opened database. Assumes database is open * @returns string the name of the opened database @@ -262,7 +275,9 @@ { return $this->_dbName; } + // }}} + // {{{ isOpen() /** * Returns the current open status for the database * @@ -273,7 +288,9 @@ { return($this->_readable || $this->_writable); } + // }}} + // {{{ isReadable() /** * Returns the current read status for the database * @@ -284,7 +301,9 @@ { return $this->_readable; } + // }}} + // {{{ isWritable() /** * Returns the current write status for the database * @@ -295,7 +314,9 @@ { return $this->_writable; } + // }}} + // {{{ remove($key) /** * Removes the value at location $key * @@ -317,7 +338,9 @@ $key. ', DB not writable'); } } + // }}} + // {{{ &fetch($key) /** * Returns the value that is stored at $key. * @@ -340,7 +363,9 @@ $this->_dbName. ', DB not readable'); } } + // }}} + // {{{ firstkey() /** * Returns the first key in the database * @@ -356,7 +381,9 @@ return false; } } + // }}} + // {{{ nextkey() /** * Returns the next key in the database, false if there is a problem * @@ -372,7 +399,9 @@ return false; } } + // }}} + // {{{ size() /** * Calculates the size of the database * @@ -387,7 +416,9 @@ return 0; } } + // }}} + // {{{ insert($key, $value) /** * Inserts a new value at $key. Will not overwrite if the key/value pair * already exist @@ -406,7 +437,9 @@ return $this->replace($key, $value); } } + // }}} + // {{{ replace($key, $value) /** * Inserts a new value at key. If the key/value pair * already exist, overwrites the value @@ -457,7 +490,9 @@ $this->_dbName. ', DB not writable'); } } + // }}} + // {{{ _writeNewBlock($key, $value, $vsize) /** * Allocates a new block of at least $vsize and writes $key=>$val * to the database @@ -503,13 +538,15 @@ $this->_writeIdxEntry($loc, $size, $vsize, $key); } } + // }}} + // {{{ _getFreeBlock($reqsize) /** * Returns a block location from the free list * * @access private * @param int $reqsize Requested size - * @returns mixed location of free block, false if there are no free blocks + * @returns mixed location of free block, false if there are no free blocks */ function _getFreeBlock($reqsize) { @@ -526,7 +563,9 @@ // no blocks available return false; } + // }}} + // {{{ _freeUsedBlock($key) /** * Places a used block on the free list, updates indicies accordingly * @@ -543,7 +582,9 @@ $this->_freeBlocks[$loc] = $size; $this->_writeIdxEntry($loc, $size); } + // }}} + // {{{ create($dbName) /** * Creates a new database file if one does not exist. If it already exists, * updates the last-updated timestamp on the database @@ -555,10 +596,12 @@ function create($dbName) { if (!(@touch($dbName.'.dat') && @touch($dbName.'.idx'))) { - return $this->raiseError('DBA: Could not create database: '.$dbName); + return $this->raiseError('DBA: Could not create database: '.$dbName); } } + // }}} + // {{{ db_exists($dbName) /** * Indicates whether a database with given name exists * @@ -570,7 +613,9 @@ { return(file_exists($dbName.'.dat') && file_exists($dbName.'.idx')); } + // }}} + // {{{ exists($key) /** * Check whether key exists * @@ -582,7 +627,9 @@ { return($this->isOpen() && isset($this->_usedBlocks[$key])); } + // }}} + // {{{ sync() /** * Synchronizes an open database to disk * @access public @@ -594,7 +641,9 @@ fflush($this->_idxFP); } } + // }}} + // {{{ optimize() /** * Optimizes an open database * @access public @@ -605,7 +654,9 @@ $this->_writeIdx(); } } + // }}} + // {{{ _readIdx() /** * Reads the entries in an index file * Assumes that $this->_idxFP is valid and readable @@ -642,14 +693,16 @@ $key = ''; // reset key for the next iteration } } + // }}} + // {{{ _writeIdx() /** * Rewrites the index file, removing free entries * Assumes that $this->_idxFP is valid and writable * * @access private */ - function _writeIdx () + function _writeIdx() { // move the file pointer to the beginning; ftruncate does not do this fseek($this->_idxFP, 0); @@ -674,7 +727,9 @@ } fflush($this->_idxFP); } + // }}} + // {{{ _writeIdxEntry($loc, $size, $vsize=NULL, $key=NULL) /** * Writes a used block entry to an index file * @@ -690,5 +745,6 @@ fputs($this->_idxFP, "$loc|$size|$vsize|$key\n"); } } + // }}} } ?> Index: pear/DBA/DBA_Sql.php diff -u pear/DBA/DBA_Sql.php:1.14 pear/DBA/DBA_Sql.php:1.15 --- pear/DBA/DBA_Sql.php:1.14 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA_Sql.php Wed Jul 17 12:57:20 2002 @@ -18,13 +18,13 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Sql.php,v 1.14 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA_Sql.php,v 1.15 2002/07/17 16:57:20 busterb Exp $ // /** * Functions for executing SQL queries on a DBM database * @author Brent Cook <busterb@mail.utexas.edu> - * @version 0.17 + * @version 0.18 * @access public * @package DBA */ Index: pear/DBA/DBA_Table.php diff -u pear/DBA/DBA_Table.php:1.49 pear/DBA/DBA_Table.php:1.50 --- pear/DBA/DBA_Table.php:1.49 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA_Table.php Wed Jul 17 12:57:20 2002 @@ -18,11 +18,12 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Table.php,v 1.49 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA_Table.php,v 1.50 2002/07/17 16:57:20 busterb Exp $ // require_once 'PEAR.php'; require_once 'DB/DBA/DBA.php'; +// {{{ constants /** * Reserved key used to store the schema record */ @@ -62,6 +63,7 @@ define('DBA_DEFAULT', 6); define('DBA_DEFAULTTYPE', 7); define('DBA_NOTNULL', 8); +// }}} /** * DBA Table @@ -77,10 +79,11 @@ * @author Brent Cook <busterb@mail.utexas.edu> * @package DBA * @access public - * @version 0.17 + * @version 0.18 */ class DBA_Table extends PEAR { + // {{{ instance variables /** * DBA object handle * @var object @@ -126,7 +129,9 @@ DBA_DEFAULT => 'time()', DBA_DEFAULTTYPE => DBA_FUNCTION) ); + // }}} + // {{{ DBA_Table($driver = 'simple') /** * Constructor * @@ -139,7 +144,9 @@ // initialize the internal dba object $this->_dba =& DBA::create($driver); } + // }}} + // {{{ _DBA_Table() /** * PEAR emulated destructor calls close on PHP shutdown * @access private @@ -148,12 +155,16 @@ { $this->close(); } + // }}} + // {{{ raiseError($message) function raiseError($message) { return PEAR::raiseError('DBA_Table: '.$message); } + // }}} + // {{{ open($tableName, $mode = 'r') /** * Opens a table * @@ -189,7 +200,9 @@ } return $this->_schema; } + // }}} + // {{{ close() /** * Closes a table * @@ -210,7 +223,9 @@ $this->_maxKey = null; return $this->_dba->close(); } + // }}} + // {{{ create($tableName, $schema) /** * Creates a new table. Note, this closes any open table. * @@ -241,7 +256,9 @@ return $r; } } + // }}} + // {{{ getSchema() /** * Returns the stored schema for the table * @@ -255,7 +272,9 @@ return $this->raiseError('table not open, no schema available'); } } + // }}} + // {{{ tableExists($tableName) /** * Check whether table exists * @@ -267,7 +286,9 @@ { return $this->_dba->db_exists($tableName); } + // }}} + // {{{ isOpen() /** * Returns the current open status for the database * @@ -278,7 +299,9 @@ { return $this->_dba->isOpen(); } + // }}} + // {{{ isReadable() /** * Returns the current read status for the database * @@ -288,7 +311,9 @@ { return $this->_dba->isReadable(); } + // }}} + // {{{ isWritable() /** * Returns the current write status for the database * @@ -298,7 +323,9 @@ { return $this->_dba->isWritable(); } + // }}} + // {{{ fieldExists($fieldName) /** * Returns whether a field exists in the current table's schema * @@ -308,7 +335,9 @@ { return($this->isOpen() && isset($this->_schema[$fieldName])); } + // }}} + // {{{ lockEx() /** * Aquire an exclusive lock on the table * @@ -318,7 +347,9 @@ { return $this->_dba->reopen('w'); } + // }}} + // {{{ lockSh() /** * Aquire a shared lock on the table * @@ -328,7 +359,9 @@ { return $this->_dba->reopen('r'); } + // }}} + // {{{ _packField($field, $value) /** * Returns a string for a raw field * @@ -415,7 +448,9 @@ } return $c_value; } + // }}} + // {{{ _unpackField($field, $value) /** * Converts a field from its packed representation to its original value * @@ -452,7 +487,9 @@ return $value; } } + // }}} + // {{{ _packSchema($schema) /** * Returns a string for a field structure * @@ -486,7 +523,9 @@ } return implode(DBA_FIELD_SEPARATOR, $fields); } + // }}} + // {{{ _unpackSchema($rawFieldString) /** * Unpacks a raw string as created by _packSchema into an array * structure for use as $this->_schema @@ -525,7 +564,9 @@ } return $fields; } + // }}} + // {{{ _packRow($data, &$key) /** * Packs a fields from a raw row into an internal representation suitable * for storing in the table. Think of this as a cross-language version of @@ -589,7 +630,9 @@ $key = implode(DBA_KEY_SEPARATOR, $key); return implode(DBA_FIELD_SEPARATOR, $buffer); } + // }}} + // {{{ _unpackRow($packedData) /** * Unpacks a string into an array containing the data from the original * packed row. Think of this as a cross-language version of deserialize. @@ -608,7 +651,9 @@ } return $buffer; } + // }}} + // {{{ insert($data) /** * Inserts a new row in a table * @@ -635,7 +680,9 @@ return $this->raiseError('table not writable'); } } + // }}} + // {{{ replace($rawQuery, $data, $rows=null) /** * Replaces rows that match $rawQuery with $ * @@ -662,7 +709,9 @@ } } } + // }}} + // {{{ replaceKey($key, $data) /** * Replaces an existing row in a table, inserts if the row does not exist * @@ -683,7 +732,9 @@ return $this->raiseError('table not open'); } } + // }}} + // {{{ remove($rawQuery, $rows=null) /** * Removes existing rows from table that match $rawQuery * @@ -705,7 +756,9 @@ } } } + // }}} + // {{{ removeKey($key) /** * Removes an existing row from a table, referenced by the row key * @@ -717,7 +770,9 @@ { return $this->_dba->remove($key); } + // }}} + // {{{ fetch($key) /** * Fetches an existing row from a table * @@ -734,7 +789,9 @@ return $result; } } + // }}} + // {{{ _finalizeField($field, $value) /** * Converts a field from its native value to a value, that is * sets are converted to strings, bools are converted to 'true' and 'false' @@ -763,7 +820,9 @@ return $value; } } + // }}} + // {{{ finalize($rows=null) /** * Converts the results from any of the row operations to a 'finalized' * display-ready form. That means that timestamps, sets and enums are @@ -794,7 +853,9 @@ } return $rows; } + // }}} + // {{{ getRows($rowKeys=null) /** * Returns the specified rows. A multiple-value version of getRow * @@ -827,7 +888,9 @@ } return $rows; } + // }}} + // {{{ getFieldNames() /** * Returns an array of the defined field names in the table * @@ -838,7 +901,9 @@ { return array_keys($this->_schema); } + // }}} + // {{{ _cookQuery($query) /** * Adds spaces around special symbols so that explode will separate them * properly from other tokens. Replace spaces within strings with pipe @@ -869,7 +934,9 @@ } return $cookedQuery; } + // }}} + // {{{ _parsePHPQuery($rawQuery, $fieldTokens) /** * Converts a query expression into PHP code for executing a select. * @@ -903,7 +970,9 @@ } return $phpQuery; } + // }}} + // {{{ &select($rawQuery, $rows=null) /** * Performs a select on a table. This means that a subset of rows in a * table are filtered and returned based on the query. Accepts any valid @@ -945,7 +1014,9 @@ return $this->raiseError('table not open'); } } + // }}} + // {{{ _sortCmpA($a, $b) /** * Comparison function for sorting ascending order * @@ -960,7 +1031,9 @@ } return 0; } + // }}} + // {{{ _sortCmpD($a, $b) /** * Comparison function for sorting descending order * @@ -975,7 +1048,9 @@ } return 0; } + // }}} + // {{{ _parseFieldString($fieldString, $possibleFields) /** * explodes a string of field names into an array * @@ -994,7 +1069,9 @@ } return $fields; } + // }}} + // {{{ sort($fields, $order, $rows) /** * Sorts rows by field in either ascending or descending order * SQL analog: 'select * from rows, order by fields' @@ -1036,7 +1113,9 @@ return $this->raiseError('no rows to sort specified'); } } + // }}} + // {{{ project($fields, $rows) /** * Projects rows by field. This means that a subset of the possible fields i * are in the resulting rows. The SQL analog is 'select fields from table' @@ -1070,7 +1149,9 @@ return $this->raiseError('no rows to sort specified'); } } + // }}} + // {{{ cmpRows($a, $b) /** * Compares two rows * @@ -1089,7 +1170,9 @@ } return $equal; } + // }}} + // {{{ unique($rows) /** * Returns the unique rows from a set of rows * @@ -1112,6 +1195,7 @@ return $this->raiseError('no rows to sort specified'); } } + // }}} function time() { return time(); Index: pear/DBA/DBA_Toolbox.php diff -u pear/DBA/DBA_Toolbox.php:1.5 pear/DBA/DBA_Toolbox.php:1.6 --- pear/DBA/DBA_Toolbox.php:1.5 Wed Jul 17 04:52:01 2002 +++ pear/DBA/DBA_Toolbox.php Wed Jul 17 12:57:20 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Toolbox.php,v 1.5 2002/07/17 08:52:01 busterb Exp $ +// $Id: DBA_Toolbox.php,v 1.6 2002/07/17 16:57:20 busterb Exp $ // require_once 'PEAR.php'; @@ -27,7 +27,7 @@ * table. * * @author Brent Cook <busterb@mail.utexas.edu> - * @version 0.17 + * @version 0.18 * @access public * @package DBA */ Index: pear/DBA/Sql_lex.php diff -u pear/DBA/Sql_lex.php:1.14 pear/DBA/Sql_lex.php:1.15 --- pear/DBA/Sql_lex.php:1.14 Wed Jul 17 04:52:01 2002 +++ pear/DBA/Sql_lex.php Wed Jul 17 12:57:20 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: Sql_lex.php,v 1.14 2002/07/17 08:52:01 busterb Exp $ +// $Id: Sql_lex.php,v 1.15 2002/07/17 16:57:20 busterb Exp $ // include 'DB/DBA/phptype.php'; @@ -38,7 +38,7 @@ * A lexigraphical analyser inspired by the msql lexer * * @author Brent Cook <busterb@mail.utexas.edu> - * @version 0.17 + * @version 0.18 * @access public * @package DBA */ Index: pear/DBA/Sql_parse.php diff -u pear/DBA/Sql_parse.php:1.14 pear/DBA/Sql_parse.php:1.15 --- pear/DBA/Sql_parse.php:1.14 Wed Jul 17 04:52:01 2002 +++ pear/DBA/Sql_parse.php Wed Jul 17 12:57:20 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: Sql_parse.php,v 1.14 2002/07/17 08:52:01 busterb Exp $ +// $Id: Sql_parse.php,v 1.15 2002/07/17 16:57:20 busterb Exp $ // require_once 'PEAR.php'; @@ -117,7 +117,7 @@ * A sql parser * * @author Brent Cook <busterb@mail.utexas.edu> - * @version 0.17 + * @version 0.18 * @access public * @package DBA */ @@ -211,6 +211,7 @@ ); // }}} +// {{{ function Sql_Parser($string = null) function Sql_Parser($string = null) { if (is_string($string)) { $this->lexer = new Lexer($string); @@ -218,7 +219,9 @@ $this->lexer->symtab =& $this->symtab; } } - +// }}} + +// {{{ getParams(&$values, &$types) function getParams(&$values, &$types) { $values = array(); $types = array(); @@ -238,6 +241,7 @@ } } } +// }}} // {{{ raiseError($message) function raiseError($message) { Index: pear/DBA/package.xml diff -u pear/DBA/package.xml:1.10 pear/DBA/package.xml:1.11 --- pear/DBA/package.xml:1.10 Wed Jul 17 04:52:02 2002 +++ pear/DBA/package.xml Wed Jul 17 12:57:20 2002 @@ -20,24 +20,11 @@ <release> <license>LGPL</license> - <version>0.17</version> - <date>2002-07-17</date> + <version>0.18</version> + <date>0000-00-00</date> <state>devel</state> <notes> <![CDATA[ - Test and enjoy. Sequence and more SQL support coming soon. - - * Fixed problem inserting onto a newly created table in - DBA_Relational - * Added support for functions as default values in DBA_Table - (currently only time() works) - * Added a SQL parser/lexer. It currently understands 'create - table', 'insert into' and much that goes with them. - * Added two system fields on rows; _rowid and _timestamp - * Primary keys can consist of more than one field - * Changed DBA_Sql; it now holds functions for interacting with - a DBA database using SQL. See test_sql_dba.php for examples. - * General fixes/cleanups/messups ]]> </notes> <filelist>
« previous php.pear.cvs (#5169) next »