ID:               36228
 User updated by:  antleclercq at online dot fr
 Reported By:      antleclercq at online dot fr
 Status:           Bogus
 Bug Type:         PDO related
 Operating System: Ubuntu Linux (breezy)
 PHP Version:      5.1.2
 Assigned To:      wez
 New Comment:

Thanks for your answer, but could you please post the way you would
execute those 2 queries ?
Thanks in advance,

Antoine


Previous Comments:
------------------------------------------------------------------------

[2006-04-30 01:01:04] [EMAIL PROTECTED]

If you're executing multi-statement queries, you must use
PDO::prepare(), PDOStatement::execute() and PDOStatement::nextRowset().

------------------------------------------------------------------------

[2006-03-01 12:57:02] antleclercq at online dot fr

Hi,

Any update ?

Thanks,

Antoine

------------------------------------------------------------------------

[2006-01-31 17:03:24] antleclercq at online dot fr

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

------------------------------------------------------------------------

[2006-01-31 15:55:42] [EMAIL PROTECTED]

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

Reply via email to