|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-05-12 19:07 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 08:00:01 2025 UTC |
Simpler : just doing the $PDO->query ('lock table foo write'); creates the same bug for me (if you have a table). (no need to $PDO->exec ('create temporary table foo (bar int)');) Isnt it the same as https://bugs.php.net/bug.php?id=70066 ?