Bug #61207 [NEW]: PDO::nextRowset() after a multi-statement query doesn't always work
| From: | acabal at ucla dot edu | Date: | Wed, 29 Feb 2012 05:45:49 +0000 |
| Subject: | Bug #61207 [NEW]: PDO::nextRowset() after a multi-statement query doesn't always work | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-167933@lists.php.net to get a copy of this message | ||
From:
Operating system: Ubuntu 11.10 64-bit
PHP version: 5.4.0RC8
Package: PDO related
Bug Type: Bug
Bug description:PDO::nextRowset() after a multi-statement query doesn't always work
Description:
------------
After executing a single multi-statement query in PDO in which the
statements are INSERT, followed by UPDATE, followed by SELECT, then trying
to loop over the results using PDO::nextRowset(), the function returns
FALSE (i.e. no more rowsets) after the UPDATE rowset, but before reaching
the SELECT rowset. Thus the SELECT rowset is lost.
I tried several permutations of multi-statement queries. INSERT, then
SELECT, then UPDATE works; SELECT then UPDATE works; UPDATE then SELECT
works; only INSERT, then UPDATE, then SELECT fails.
See the below code for those examples plus the bugged example.
I originally ran in to this problem on PHP 5.3.5, but it still appears in
PHP 5.4.0RC8.
Test script:
---------------
First create the following MySQL test db/table:
create database
testcharacter set utf8 collate utf8_general_ci;
create table test.testtable( id int );
Next check this example code to see the bug in action. There are four
examples in the code, the first three work, and the last one is the bug.
http://pastebin.com/EKePD6e2
The bug tracker suggested a link for code longer than 20 lines, though I
can provide the example script directly in this bug report if that would be
helpful.
Expected result:
----------------
Handle 1:
Rowset 1
Rowset 2
Results detected
Handle 2:
Rowset 1
Results detected
Handle 3:
Rowset 1
Rowset 2
Results detected
Handle 4:
Rowset 1
Rowset 2
Results detected
Actual result:
--------------
Handle 1:
Rowset 1
Rowset 2
Results detected
Handle 2:
Rowset 1
Results detected
Handle 3:
Rowset 1
Rowset 2
Results detected
Handle 4:
Rowset 1
--
Edit bug report at https://bugs.php.net/bug.php?id=61207&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61207&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61207&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61207&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61207&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61207&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61207&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61207&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61207&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61207&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61207&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61207&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61207&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61207&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61207&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61207&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61207&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61207&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61207&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61207&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61207&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61207&r=mysqlcfg