#36228 [Opn->Fbk]: Loosing connection to db while executing 2 Multi-Statements requests with PDO
| From: | tony2001@php.net | Date: | Tue, 31 Jan 2006 14:55:42 +0000 |
| Subject: | #36228 [Opn->Fbk]: 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-92707@lists.php.net to get a copy of this message | ||
ID: 36228
Updated by: tony2001@php.net
Reported By: antleclercq at online dot fr
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: Ubuntu Linux (breezy)
PHP Version: 5.1.2
New Comment:
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?
Previous Comments:
------------------------------------------------------------------------
[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