Bug #65994 [Com]: PDO::prepare() with multi-queries doesn't work inside a transaction
Edit report at https://bugs.php.net/bug.php?id=65994&edit=1
ID: 65994
Comment by: enrico_kaelert at kabelmail dot de
Reported by: pedro at sancao dot com dot br
Summary: PDO::prepare() with multi-queries doesn't work
inside a transaction
Status: Open
Type: Bug
Package: PDO MySQL
Operating System: Linux/Windows
PHP Version: 5.4.21
Block user comment: N
Private report: N
New Comment:
Its weird but use
$stmt = null;
and THEN fire the commit()
it works.
Created a detailed report here: https://bugs.php.net/bug.php?id=66621
btw: the bug page search function is crap =(
Previous Comments:
------------------------------------------------------------------------
[2013-10-29 14:12:22] pedro at sancao dot com dot br
Description:
------------
Using PDO on MySQL 5.5.32 (Linux and Windows)
When executing a prepared multi-query statement after calling PDO::beginTransaction() the
PDO::commit() will return true but no commit will be done.
Also the affected tables will be locked until the database server is restarted.
Nor error is raised neither exception is thrown.
My tests was within a try/catch block.
Test script:
---------------
$pdo = new PDO('mysql:dbname=PLACE_DATABASE;host=localhost;charset=utf8',
'PLACE_USER', 'PLACE_PASSWORD', array(
PDO::ATTR_PERSISTENT => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ
));
try {
$pdo->beginTransaction();
$statement = $pdo->prepare('UPDATE ...; UPDATE ...; ');
$statement->execute();
$pdo->commit();
} catch (PDOException $e) {
exit($e->getMessage());
$pdo->rollBack();
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65994&edit=1
Thread (4 messages)