cvs: php4 /pear DB.php /pear/DB common.php

From: Date: Sat, 19 Jan 2002 07:46:24 +0000
Subject: cvs: php4 /pear DB.php /pear/DB common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2004@lists.php.net to get a copy of this message
cox Sat Jan 19 02:46:24 2002 EDT Modified files: /php4/pear DB.php /php4/pear/DB common.php Log: Stores limit_from and limit_count as DB_result proporties instead of DB_common. Fixs bug when doing queries inside limitQuery results. Index: php4/pear/DB.php diff -u php4/pear/DB.php:1.82 php4/pear/DB.php:1.83 --- php4/pear/DB.php:1.82 Sun Jan 13 13:24:56 2002 +++ php4/pear/DB.php Sat Jan 19 02:46:23 2002 @@ -17,7 +17,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: DB.php,v 1.82 2002/01/13 18:24:56 cox Exp $ +// $Id: DB.php,v 1.83 2002/01/19 07:46:23 cox Exp $ // // Database independent query interface. // @@ -627,6 +627,17 @@ var $dbh; var $result; var $row_counter = null; + /** + * for limit queries, the row to start fetching + * @var integer + */ + var $limit_from = null; + + /** + * for limit queries, the number of rows to fetch + * @var integer + */ + var $limit_count = null; /** * DB_result constructor. @@ -658,19 +669,19 @@ $fetchmode = DB_FETCHMODE_ASSOC; $object_class = $this->dbh->fetchmode_object_class; } - if ($this->dbh->limit_from !== null) { + if ($this->limit_from !== null) { if ($this->row_counter === null) { - $this->row_counter = $this->dbh->limit_from; + $this->row_counter = $this->limit_from; // For Interbase if ($this->dbh->features['limit'] == false) { $i = 0; - while ($i++ < $this->dbh->limit_from) { + while ($i++ < $this->limit_from) { $this->dbh->fetchInto($this->result, $arr, $fetchmode); } } } if ($this->row_counter >= ( - $this->dbh->limit_from + $this->dbh->limit_count)) + $this->limit_from + $this->limit_count)) { return null; } @@ -717,19 +728,19 @@ $fetchmode = DB_FETCHMODE_ASSOC; $object_class = $this->dbh->fetchmode_object_class; } - if ($this->dbh->limit_from !== null) { + if ($this->limit_from !== null) { if ($this->row_counter === null) { - $this->row_counter = $this->dbh->limit_from; + $this->row_counter = $this->limit_from; // For Interbase if ($this->dbh->features['limit'] == false) { $i = 0; - while ($i++ < $this->dbh->limit_from) { + while ($i++ < $this->limit_from) { $this->dbh->fetchInto($this->result, $arr, $fetchmode); } } } if ($this->row_counter >= ( - $this->dbh->limit_from + $this->dbh->limit_count)) + $this->limit_from + $this->limit_count)) { return null; } Index: php4/pear/DB/common.php diff -u php4/pear/DB/common.php:1.77 php4/pear/DB/common.php:1.78 --- php4/pear/DB/common.php:1.77 Sat Jan 19 02:22:48 2002 +++ php4/pear/DB/common.php Sat Jan 19 02:46:24 2002 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: common.php,v 1.77 2002/01/19 07:22:48 cox Exp $ +// $Id: common.php,v 1.78 2002/01/19 07:46:24 cox Exp $ // // Base class for DB implementations. // @@ -33,8 +33,8 @@ /** * assoc of capabilities for this DB implementation * $features['limit'] => 'emulate' => emulate with fetch row by number - * 'alter' => alter the query - * false => no support for limit queries + * 'alter' => alter the query + * false => skip rows * @var array */ var $features; @@ -87,18 +87,6 @@ var $fetchmode_object_class = 'stdClass'; /** - * for limit queries, the row to start fetching - * @var integer - */ - var $limit_from = null; - - /** - * for limit queries, the number of rows to fetch - * @var integer - */ - var $limit_count = null; - - /** * $options["persistent"] -> boolean persistent connection true|false? * $options["optimize"] -> string 'performance' or 'portability' * $options["debug"] -> integer numeric debug level @@ -664,9 +652,10 @@ if (DB::isError($result) || $result === DB_OK) { return $result; } else { - $this->limit_from = $from; - $this->limit_count = $count; - return new DB_result($this, $result); + $res_obj =& new DB_result($this, $result); + $res_obj->limit_from = $from; + $res_obj->limit_count = $count; + return $res_obj; } }

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