Bug #65994 [Opn->Nab]: PDO::prepare() with multi-queries doesn't work inside a transaction

From: Date: Tue, 25 Feb 2014 12:56:54 +0000
Subject: Bug #65994 [Opn->Nab]: PDO::prepare() with multi-queries doesn't work inside a transaction
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184413@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65994&edit=1 ID: 65994 Updated by: uw@php.net Reported by: pedro at sancao dot com dot br Summary: PDO::prepare() with multi-queries doesn't work inside a transaction -Status: Open +Status: Not a bug Type: Bug Package: PDO MySQL Operating System: Linux/Windows PHP Version: 5.4.21 Block user comment: N Private report: N New Comment: It makes no sense to even try multi query using a prepared statement API call. Multi query is not available with PS. If at all it could be made working using query()/exec() but that would mean a security hole and was for sure out of spec for PDO (given there was a proper PDO spec) Previous Comments: ------------------------------------------------------------------------ [2014-02-01 01:04:24] enrico_kaelert at kabelmail dot de 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 =( ------------------------------------------------------------------------ [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

« previous php.bugs (#184413) next »