#41997 [Opn]: Stored procedure call that returns a single rowset blocks future queries

From: Date: Mon, 16 Jul 2007 18:06:49 +0000
Subject: #41997 [Opn]: Stored procedure call that returns a single rowset blocks future queries
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-115120@lists.php.net to get a copy of this message
 ID:               41997
 User updated by:  nitel_defect at yahoo dot com
 Reported By:      nitel_defect at yahoo dot com
 Status:           Open
 Bug Type:         PDO related
 Operating System: Windows XP SP2
 PHP Version:      5.2.3
 New Comment:

http://www.kpsol.ro/php_pdo_mysql.dll


Previous Comments:
------------------------------------------------------------------------

[2007-07-16 17:30:00] temposeb at free dot fr

I encounter exactly the same bug for many months.
Environment : Win2000 Pro SP4, Apache 2.2, PHP 5.2.4-dev (Build Date
	Jul 11 2007 20:03:23), MySQL 5.1.20-beta-community-nt-debug (same thing
with MySQL 5.0.x).
nitel_defect, where can we find the hacked DLL ?
http://source.hackthissite.org/svn/trunk/PDO/php_pdo_mysql.dll
is
actually DOWN. Thx.

------------------------------------------------------------------------

[2007-07-15 06:53:01] nitel_defect at yahoo dot com

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 this bug report at http://bugs.php.net/?id=41997&edit=1


Thread (21 messages)

« previous php.bugs (#115120) next »