From:             nitel_defect at yahoo dot com
Operating system: Windows XP SP2
PHP version:      5.2.3
PHP Bug Type:     PDO related
Bug description:  Stored procedure call that returns a single rowset blocks 
future queries

Description:
------------
The code below calls a stored procedure that fethches the whole tree in a
father-son system roles hierarchy.
In the end, the stored procedure selects everything from a temp table, so
that's our result set.
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY is on by default.
After running the call statement, all the result rows are returned
correctly but any future query (not only other calls, all queries) fail
with the message you see below.
For the time being I replicated the code I needed in PHP, but it's
frustrating not to be able to run SPs...
I tested the library found here:
http://source.hackthissite.org/svn/trunk/PDO/php_pdo_mysql.dll
and this bug was gone. But there is no source code for this modified
library and its size is much smaller so I don't quite trust it.
Uhm... help?

Reproduce code:
---------------
<?php
$db = new PDO('mysql:host=localhost;dbname=2m;port=3306', 'root', '',
array());
$st = $db->query("call getParentRoles('admin')");
do {
$rows = $st->fetchAll(PDO::FETCH_ASSOC);
} while ($st->nextRowset());
$st->closeCursor();
var_dump($db->errorInfo());
echo '<br />';
$st = $db->query("SELECT * FROM user");
var_dump($db->errorInfo());

Expected result:
----------------
array(1) { [0]=>  string(5) "00000" }
array(1) { [0]=>  string(5) "00000" }

Actual result:
--------------
array(1) { [0]=>  string(5) "00000" }
array(3) { [0]=> string(5) "HY000" [1]=> int(2014) [2]=> string(269)
"Cannot execute queries while other unbuffered queries are active. Consider
using PDOStatement::fetchAll(). Alternatively, if your code is only ever
going to run against mysql, you may enable query buffering by setting the
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute." } 

-- 
Edit bug report at http://bugs.php.net/?id=41997&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41997&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41997&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41997&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41997&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41997&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41997&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41997&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41997&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41997&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41997&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41997&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41997&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41997&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41997&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41997&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41997&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41997&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41997&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41997&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41997&r=mysqlcfg

Reply via email to