ID: 47504 Updated by: johan...@php.net Reported By: admin at ifyouwantblood dot de -Status: Open +Status: Bogus Bug Type: PDO related Operating System: Windows XP SP 3 PHP Version: 5.2.8 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php $pdo->query("INSERT INTO `test` (some) VALUES ('1111111111111111'), ('1111111111111'); -- I AM AN SQL COMMENT, REMOVING ME WILL SOLVE THIS PROBLEM"); Due to the ";" this is a multi-statement, executing two queries while the second is only a comment. The second "result" can be accessed using PDOStatement->nextRowset. Previous Comments: ------------------------------------------------------------------------ [2009-02-28 07:40:26] admin at ifyouwantblood dot de also appears in 5.2.9 ------------------------------------------------------------------------ [2009-02-25 21:07:16] admin at ifyouwantblood dot de Description: ------------ i get this error with following code: ------------- SQLSTATE[HY000]: 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. HY000 #0 D:\_projects\web\1.php(13): PDO->query('INSERT INTO `te...') #1 {main} -------------- removing !SQL COMMENTS! will solve this. this only appears on windows (XP), linux is fine. mysql version is 5.0.51a. latest XAMPP package was used to test this (without modifications). Reproduce code: --------------- <?php set_exception_handler('ehandler'); $pdo=new PDO('mysql:dbname=barcodescanner;host=127.0.0.1','root',''); $pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); $pdo->query(' CREATE TABLE IF NOT EXISTS `test` ( `some` VARCHAR( 100 ) NOT NULL ) ENGINE = INNODB '); $pdo->query('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE'); $pdo->query('START TRANSACTION'); $pdo->query("INSERT INTO `test` (some) VALUES ('1111111111111111'), ('1111111111111'); -- I AM AN SQL COMMENT, REMOVING ME WILL SOLVE THIS PROBLEM"); $pdo->query("INSERT INTO `test` (some) VALUES ('1111111111111111'), ('1111111111111')"); $pdo->query('COMMIT'); function ehandler($exception) { echo '<pre>'."\r\n"; echo $exception->getMessage().' '.$exception->getCode(); echo "\r\n\r\n"; echo $exception->getTraceAsString(); echo '</pre>'; } Expected result: ---------------- nothing Actual result: -------------- SQLSTATE[HY000]: 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. HY000 #0 D:\_projects\web\1.php(13): PDO->query('INSERT INTO `te...') #1 {main} ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47504&edit=1