PEAR is archived and read-only

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

Home » Database » MDB » Bug #633

"ORA-01002 Fetch Out Of Sequence" error

Details

Submitted2004-01-27 14:54 UTC
Fromthierry dot bo at netcourrier dot com
Assignedlsmith
StatusClosed
PackageMDB
PHP Version4.3.2
OSWin32 XP
Roadmaps(Not assigned)

Comments

[2004-01-27 14:54 UTC] thierry dot bo at netcourrier dot com

Description:
------------
Hi,

With latest MDB1.* branch cvs files, I got this specific error with oci8 driver :

"php(1538): ocifetchinto(): OCIFetchInto: ORA-01002 Fetch Out Of Sequence in oci8.php line 1538".

Switching to mysql driver and mssql driver I got no error.

Reproduce code:
---------------
$sql = "SELECT room_name, capacity, id
FROM mrbs_room
WHERE area_id=$area
ORDER BY 1";
$types = array('text', 'integer', 'integer');
$res = $mdb->query($sql, $types);
$counte = $mdb->numRows($res);
if (0 == $counte)
{
echo "<h1>$vocab[no_rooms_for_area]</h1>";
$mdb->freeResult($res);
}
else
{
$room_column_width = (int)(95 / $counte);
>>>> while ($row = $mdb->fetchInto($res)) <<<<ERROR
{
echo "<th width=\"$room_column_width%\">" . htmlspecialchars($row[0])
. "($row[1])</th>";
$rooms[] = $row[2];
}
}

[2004-01-27 21:24 UTC] thierry dot bo at netcourrier dot com

Variables values :
this nil
$result_value 20
$rownum 2
$result nil
$buffer NULL

[2004-01-28 13:43 UTC] thierry dot bo at netcourrier dot com

After some investigations, I found this:

Although the error itself is not in the oci8 $mdb->numRows() function, the bug I reported only occurs if I call $mdb->numRows() before. I commented this function in some places in my code just before the fetchInto call and I did not get the error.

[2004-01-28 17:59 UTC] thierry dot bo at netcourrier dot com

I did not set this option, so I see default is FALSE.

I think I understand why there is an error, even if I don't undestand why. I tried this:

I filled 'mrbs_room' table with only ONE row in MySQL and Oracle. With Mysql, the >> while ($row = $mdb->fetchInto($res)) << loop is executed once, normal. But with Oracle, the loop is executed twice! Hence, there is no error during the first loop, the error occurs when the second fetchInto() is executed. Again, the table contains only ONE row.

[2004-01-29 01:09 UTC] thierry dot bo at netcourrier dot com

Follow-up.
If I remove the call to numRows() before, the 'while' loop is executed one times as expected.