PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB » Bug #965

[MDB1] bug #946 fix -> fetchInto infinite loop if numRows() called before

Details

Submitted2004-03-07 23:38 UTC
Fromthierrybo at freesurf dot fr
Assignedlsmith
StatusClosed
PackageMDB
PHP Version4.3.2
OSwin32XP
Roadmaps(Not assigned)

Comments

[2004-03-07 23:38 UTC] thierrybo at freesurf dot fr

Description:
------------
Bug fix #946 fixed OutOfSequence in fetchInto but introduced an infinite loop in fetchInto now.

You fixed bug #946 by changing :

if (is_null($rownum)) {
$rownum = $this->highest_fetched_row[$result_value] + 1;
}

to

if (is_null($rownum)) {
$rownum = $this->current_row[$result_value] + 1;
}

so that fetchinto use $this->result instead of OCIFetchInto in case numrows() was called before. The problem now is that $this->current_row[$result_value] is not incremented between line 1568 and 1571, so $rownum is always -1 to each fetchInto() call, so fetchInto never returns NULL, so the loop never ends.

I tried to insert the following code line 1572 :

$this->current_row[$result_value]++;

and this seems to fix this specific problem. You said me that current_row is the pointer to the last fetched row. Does this mean the last "hard" fetched row (I mean 'with OCIFecthInto'), or is this the last MDB fetched row (either usinf buffer or not) ?

Thierry Bothorel

[2004-03-08 19:30 UTC] thierrybo at freesurf dot fr

Yes, except if you only call numRows() before fetchInto(). NumRows() does not call MDB::fetchInto() method. $currentRow is not set by NumRows() and not by fetchInto() if $results[result_value] exist.
The result set is not empty, and I did not used limit emulation, just query, numRows and fetchinto.

[2004-03-09 01:30 UTC] thierrybo at freesurf dot fr

Yeah, don't touch anything now! It works perfectly, either calling numRows before or after fetchInto .
Thanks