#36228 [Fbk->Opn]: Loosing connection to db while executing 2 Multi-Statements requests with PDO

From: Date: Tue, 31 Jan 2006 16:03:25 +0000
Subject: #36228 [Fbk->Opn]: Loosing connection to db while executing 2 Multi-Statements requests with PDO
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-92714@lists.php.net to get a copy of this message
ID: 36228 User updated by: antleclercq at online dot fr Reported By: antleclercq at online dot fr -Status: Feedback +Status: Open Bug Type: MySQL related Operating System: Ubuntu Linux (breezy) PHP Version: 5.1.2 New Comment: Hello Tony, It looks like it returns only the number of affected rows for the first statement... The affected rows for the next statements don't seem to be counted. Also : if you have an error in your first statement, you get an error, but if the error is in one of the next statements, these are not reported. Hmmm... I don't know really what I would expect to get as return value from a multi-query... Certainly a sum of all the affected rows or better... an array with that info on each statement. Antoine Previous Comments: ------------------------------------------------------------------------ [2006-01-31 15:55:42] tony2001@php.net Just curious: what do you expect to get as the result of these multi-statement? PDO::exec returns number of rows expected. Since you're effectively executing two queries - what do you expect to get? What if one of the queries succeeds and another one fails? ------------------------------------------------------------------------ [2006-01-31 15:12:57] antleclercq at online dot fr Description: ------------ Hello, Executing 2 multi-statement queries gives you the following error : 2013 - Lost connection to MySQL server during query I reproduced this error using 5.1.0RC3 and 5.1.2. My MySQL version is 4.1.12, and I have the right MySQL / PDO connector. Thanks, Antoine Reproduce code: --------------- <?php $dbh = new PDO("mysql:dbname=karibou;host=localhost", "user", "password"); try { $qry = "DELETE FROM addressbook_address WHERE profile_id=2 ; \n"; $qry .= "DELETE FROM addressbook_phone WHERE profile_id=2 ; \n"; //No error $dbh->exec($qry); //The folowing line displays : Array ( [0] => 00000 ) print_r($dbh->errorInfo()); //This second exec statement produces the error : "Lost connection to MySQL server during query" $dbh->exec($qry); //The following line displays : Array ( [0] => HY000 [1] => 2013 [2] => Lost connection to MySQL server during query ) print_r($dbh->errorInfo()); } catch (PDOException $e) { print $e->getMessage(); die(); } ?> Expected result: ---------------- None of the exec should return an error. Actual result: -------------- The second exec returns a 2013 error (Lost connection...). Array ( [0] => HY000 [1] => 2013 [2] => Lost connection to MySQL server during query ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36228&edit=1

« previous php.bugs (#92714) next »