]> granicus.if.org Git - php/commitdiff
Stores limit_from and limit_count as DB_result proporties instead
authorTomas V.V.Cox <cox@php.net>
Sat, 19 Jan 2002 07:46:23 +0000 (07:46 +0000)
committerTomas V.V.Cox <cox@php.net>
Sat, 19 Jan 2002 07:46:23 +0000 (07:46 +0000)
of DB_common. Fixs bug when doing queries inside limitQuery results.

pear/DB.php

index b2c76899fbbe6e923ec1f0cf33fcebe6ac5bf0b6..71d0a5ca9bb036337d61240e0bda38ab9f733e43 100644 (file)
@@ -627,6 +627,17 @@ class DB_result
     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 @@ class DB_result
             $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 @@ class DB_result
             $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;
             }