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

Bug #633 "ORA-01002 Fetch Out Of Sequence" error
Submitted: 2004-01-27 14:54 UTC
From: thierrybo Assigned: lsmith
Status: Closed Package: MDB
PHP Version: 4.3.2 OS: Win32 XP
Roadmaps: (Not assigned)    
Subscription  


 [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]; } }

Comments

 [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 16:02 UTC] lsmith
do you have the autofree option enabled?
 [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.
 [2004-02-03 19:14 UTC] lsmith
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.
 [2004-03-21 18:07 UTC] ogmueller
The same problem seems to be in the "limitQuery" function as well. If I try to fetch values with fetchInto after I called numRows, there is no result. If I comment the line numRows, everything works fine again. The problem only occurs with oracle. I d/l the latest CVS files of oci8 / Manager / Parser / Common.
 [2004-03-24 12:35 UTC] lsmith
I dont have the time to look into this now. I feared something like this, which you can see from my comments in MDB_oci8::fetchInto(). If you can have a look I would appreciate it. Otherwise you may have to wait a few more days before I can get to it.
 [2004-03-31 15:54 UTC] lsmith
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.