cvs: pear /DBA DBA_Simple.php DBA_Table.php

From: Date: Fri, 19 Jul 2002 03:30:54 +0000
Subject: cvs: pear /DBA DBA_Simple.php DBA_Table.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5188@lists.php.net to get a copy of this message
busterb Thu Jul 18 23:30:54 2002 EDT Modified files: /pear/DBA DBA_Simple.php DBA_Table.php Log: fixed a buglet that prevented getRows() from finding rows with key 0 Index: pear/DBA/DBA_Simple.php diff -u pear/DBA/DBA_Simple.php:1.27 pear/DBA/DBA_Simple.php:1.28 --- pear/DBA/DBA_Simple.php:1.27 Thu Jul 18 15:10:38 2002 +++ pear/DBA/DBA_Simple.php Thu Jul 18 23:30:54 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Simple.php,v 1.27 2002/07/18 19:10:38 busterb Exp $ +// $Id: DBA_Simple.php,v 1.28 2002/07/19 03:30:54 busterb Exp $ require_once 'PEAR.php'; @@ -353,14 +353,14 @@ if ($this->isReadable()) { if (!isset($this->_usedBlocks[$key])) { return $this->raiseError('DBA: cannot fetch key '.$key. - ', it does not exist'); + ', it does not exist'); } else { fseek($this->_datFP, $this->_usedBlocks[$key][DBA_SIMPLE_LOC]); return fread($this->_datFP,$this->_usedBlocks[$key][DBA_SIMPLE_VSIZE]); } } else { return $this->raiseError('DBA: cannot fetch '.$key.' on '. - $this->_dbName. ', DB not readable'); + $this->_dbName. ', DB not readable'); } } // }}} Index: pear/DBA/DBA_Table.php diff -u pear/DBA/DBA_Table.php:1.52 pear/DBA/DBA_Table.php:1.53 --- pear/DBA/DBA_Table.php:1.52 Thu Jul 18 15:10:38 2002 +++ pear/DBA/DBA_Table.php Thu Jul 18 23:30:54 2002 @@ -18,7 +18,7 @@ // | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA| // +----------------------------------------------------------------------+ // -// $Id: DBA_Table.php,v 1.52 2002/07/18 19:10:38 busterb Exp $ +// $Id: DBA_Table.php,v 1.53 2002/07/19 03:30:54 busterb Exp $ // require_once 'PEAR.php'; require_once 'DB/DBA/DBA.php'; @@ -215,7 +215,7 @@ $schema = $this->_packSchema($this->_schema); $this->_dba->replace(DBA_SCHEMA_KEY, $schema); } else { - echo "No schema ;P\n"; + echo "No schema, what's the point :P\n"; } } $this->_maxKey = null; @@ -234,7 +234,6 @@ */ function create($tableName, $schema, $driver) { - echo "$tableName, $schema, $driver\n"; // pack the schema $packedSchema = DBA_Table::_packSchema($schema + array('_rowid'=>array(DBA_TYPE => DBA_INTEGER, @@ -880,20 +879,18 @@ { $rows = array(); if ($this->_dba->isOpen()) { - $key = $this->_dba->firstkey(); - while ($key !== false) { - if ($key != DBA_SCHEMA_KEY) { - if (is_null($rowKeys)) { - $rows[$key] = $this->_unpackRow( - $this->_dba->fetch($key)); - } else { - if (in_array($key, $rowKeys)) { - $rows[$key] = $this->_unpackRow( - $this->_dba->fetch($key)); - } + if (is_null($rowKeys)) { + $key = $this->_dba->firstkey(); + while ($key !== false) { + if ($key !== DBA_SCHEMA_KEY) { + $rows[$key] = $this->_unpackRow($this->_dba->fetch($key)); } + $key = $this->_dba->nextkey($key); + } + } else { + foreach ($rowKeys as $key) { + $rows[$key] = $this->unpackRow($this->_dba->fetch($key)); } - $key = $this->_dba->nextkey($key); } } else { return $this->raiseError('table not open');

« previous php.pear.cvs (#5188) next »