Bug #74584 [Com]: Error about active unbuffered queries triggered unexpectedly

From: Date: Wed, 24 Jul 2019 14:42:42 +0000
Subject: Bug #74584 [Com]: Error about active unbuffered queries triggered unexpectedly
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221931@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74584&edit=1 ID: 74584 Comment by: yardsoftware at gmail dot com Reported by: love at sickpeople dot se Summary: Error about active unbuffered queries triggered unexpectedly Status: Open Type: Bug Package: PDO MySQL PHP Version: 7.1.5 Block user comment: N Private report: N New Comment: Note : Using $PDO->exec() resolves this issue. Also make sure you do not have a semicolon when using this method. Previous Comments: ------------------------------------------------------------------------ [2017-05-12 19:11:41] love at sickpeople dot se Version of Mysqlnd is 5.0.12-dev. ------------------------------------------------------------------------ [2017-05-12 19:07:40] love at sickpeople dot se Description: ------------ An exception is thrown in the test case below. - Emulated prepares must be OFF - "LOCK TABLE" triggers the error, eg "set @foo='bar'" does NOT I see no reason why the error occurs in this case. Test script: --------------- // Please fill in $host = ''; $db = ''; $user = ''; $pass = ''; $options = []; $options[PDO::ATTR_EMULATE_PREPARES] = false; /* required */ $options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $PDO = new PDO ( "mysql:host=$host;dbname=$db;charset=utf8mb4", $user, $pass, $options ); $PDO->exec ('create temporary table foo (bar int)'); $PDO->query ('lock table foo write'); Expected result: ---------------- No exception thrown. Actual result: -------------- Exception thrown. SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOState ment::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 https://bugs.php.net/bug.php?id=74584&edit=1

« previous php.bugs (#221931) next »