Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #3581 oci8::numRows() and _fillBuffer() issues
Submitted: 2005-02-24 15:46 UTC
From: sbeam at onsetcorps dot net Assigned: lsmith
Status: Closed Package: MDB2
PHP Version: 5.0.3 OS: linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-02-24 15:46 UTC] sbeam at onsetcorps dot net
Description: ------------ numRows() was only returning the value of $res->buffer_rownum - but if an offset exists, this number would be less the offset. Attached patch adds $res->limits[count] to the result to always get the total # of rows that the query returned. Also, _fillBuffer() was not counting rows at all if the buffer_rownum got above the limit. Changes to _fillBuffer() to increment buffer_rownum for every OCIFetchInto(), but only add the row to $buffer if it is between offset and limit. And the other change to set $row = false prevents fetchRow() from getting an extra "blank" row at the end of each limited result set. Reproduce code: --------------- @@ -934,14 +937,15 @@ return false; } - $row = true; + $row = false; while ((is_null($rownum) || $this->buffer_rownum < $rownum) - && (!isset($this->limits) || $this->buffer_rownum < $this->limits[' limit']) && ($row = @OCIFetchInto($this->result, $buffer, OCI_RETURN_NULLS)) ) { ++$this->buffer_rownum; + if (!isset($this->limits) || $this->buffer_rownum <= $this->limits[ 'limit']) { $this->buffer[$this->buffer_rownum] = $buffer; } + } if (!$row) { ++$this->buffer_rownum; @@ -1052,7 +1056,7 @@ 'seek: resultset has already been freed'); } $this->_fillBuffer(); - return $this->buffer_rownum; + return ($this->buffer_rownum) + $this->limits['count']; } // }}}

Comments

 [2005-02-24 21:38 UTC] smith at backendmedia dot com
Could you check out current CVS alot of things have changed there over the last 9 months.
 [2005-06-03 07:50 UTC] smith at backendmedia dot com
any chances to get this tested?
 [2005-10-10 15:16 UTC] sbeam at onsetcorps dot net
no, the production system was based on the MDB2 release with the below patch. Unfortunately I don't have access to a proper testing server with Oracle or time to set one up so I have not been able to test it with the CVS version.
 [2005-10-10 16:39 UTC] lsmith
So it goes, I will close the bug under these circumstances.