#50941 [NEW]: pdo throws "unbuffered queries" error when use a sp and ATTR_EMULATE_PREPARES

From: Date: Fri, 05 Feb 2010 19:15:02 +0000
Subject: #50941 [NEW]: pdo throws "unbuffered queries" error when use a sp and ATTR_EMULATE_PREPARES
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-147257@lists.php.net to get a copy of this message
From: ies_clan at hotmail dot com Operating system: Windows XP home PHP version: 5.3.1 PHP Bug Type: PDO related Bug description: pdo throws "unbuffered queries" error when use a sp and ATTR_EMULATE_PREPARES Description: ------------ if u call a stored procedure and then a normal sql statement, while u use ATTR_EMULATE_PREPARES = false, u got an error like: General error: 2014 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. to set PDO::MYSQL_ATTR_USE_BUFFERED_QUERY have no effect. uf u use closeCursor(); u got that error: Packets out of order Reproduce code: --------------- /* -- -- Table structure for table testtabelle -- DROP TABLE IF EXISTS testtabelle; CREATE TABLE testtabelle ( ID int(10) unsigned NOT NULL AUTO_INCREMENT, Name varchar(45) NOT NULL, PRIMARY KEY (ID) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; INSERT INTO testtabelle VALUES (1,'test'),(2,'test'),(3,'test'),(4,'test'),(5,'tesfsst'); DELIMITER $$ DROP PROCEDURE IF EXISTS myTestProd $$ CREATE PROCEDURE myTestProd () BEGIN SELECT * FROM testtabelle; END $$ DELIMITER ; */ $Database = new PDO('mysql:dbname='.DATABASE.';host='.DATABASE_SERVER, DATABASE_USER, DATABASE_PASSWORD, array( PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_PERSISTENT => false, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true ) ); $Query1 = $Database->prepare('CALL myTestProd()'); $Query1->execute(); print_r($Query1->fetchAll()); $Query1->closeCursor(); $Query2 = $Database->prepare('SELECT * FROM testtabelle'); $Query2->execute(); print_r($Query2->fetchAll()); $Query1->closeCursor(); Expected result: ---------------- Array ( [0] => Array ( [ID] => 1 [0] => 1 [Name] => test [1] => test ) [1] => Array ( [ID] => 2 [0] => 2 [Name] => test [1] => test ) [2] => Array ( [ID] => 3 [0] => 3 [Name] => test [1] => test ) [3] => Array ( [ID] => 4 [0] => 4 [Name] => test [1] => test ) [4] => Array ( [ID] => 5 [0] => 5 [Name] => tesfsst [1] => tesfsst ) ) Array ( [0] => Array ( [ID] => 1 [0] => 1 [Name] => test [1] => test ) [1] => Array ( [ID] => 2 [0] => 2 [Name] => test [1] => test ) [2] => Array ( [ID] => 3 [0] => 3 [Name] => test [1] => test ) [3] => Array ( [ID] => 4 [0] => 4 [Name] => test [1] => test ) [4] => Array ( [ID] => 5 [0] => 5 [Name] => tesfsst [1] => tesfsst ) ) Actual result: -------------- Array ( [0] => Array ( [ID] => 1 [0] => 1 [Name] => test [1] => test ) [1] => Array ( [ID] => 2 [0] => 2 [Name] => test [1] => test ) [2] => Array ( [ID] => 3 [0] => 3 [Name] => test [1] => test ) [3] => Array ( [ID] => 4 [0] => 4 [Name] => test [1] => test ) [4] => Array ( [ID] => 5 [0] => 5 [Name] => tesfsst [1] => tesfsst ) ) . Expected 1 received 11. Packet size=7 -- Edit bug report at http://bugs.php.net/?id=50941&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50941&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50941&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50941&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50941&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50941&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50941&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50941&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50941&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50941&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50941&r=support Expected behavior: http://bugs.php.net/fix.php?id=50941&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50941&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50941&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50941&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50941&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50941&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50941&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50941&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50941&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50941&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50941&r=mysqlcfg

« previous php.bugs (#147257) next »