#36658 [NEW]: mysqli_multi_query randomly fails
| From: | jacob at aub dot dk | Date: | Wed, 08 Mar 2006 20:30:34 +0000 |
| Subject: | #36658 [NEW]: mysqli_multi_query randomly fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-94065@lists.php.net to get a copy of this message | ||
From: jacob at aub dot dk
Operating system: FreeBSD
PHP version: 5.1.2
PHP Bug Type: MySQLi related
Bug description: mysqli_multi_query randomly fails
Description:
------------
I'm seeing indeterministic behaviour from mysqli_multi_query(). In #35333
it is stated that one must process the result sets from mysql before
executing another query. The following seem to somewhat disprove that, as
it works sometimes. If processing of resultsets is a requirement then I
believe the documentation should be updated to reflect this as it is not
consistent behaviour in regard to regular query() calls, as I can perform
multiple query() calls without processing anything.
Reproduce code:
---------------
<?php
require_once('dbsettings.php');
$mysqli = new mysqli($hostname, $username, $password, $database);
$mysqli->multi_query("CREATE TABLE IF NOT EXISTS bar(id int); INSERT INTO
bar(id) VALUES(1); ");
$result = $mysqli->query("SELECT COUNT(*) FROM bar");
if($result === FALSE) {
print "ERROR: ".$mysqli->error."\n";
} else {
$row = $result->fetch_assoc();
print $row['COUNT(*)']."\n";
}
?>
Expected result:
----------------
% php multiquerybug.php
3
% php multiquerybug.php
4
% php multiquerybug.php
5
Actual result:
--------------
% php multiquerybug.php
3
% php multiquerybug.php
ERROR: MySQL server has gone away
% php multiquerybug.php
5
--
Edit bug report at http://bugs.php.net/?id=36658&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36658&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36658&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36658&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36658&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36658&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36658&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36658&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36658&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36658&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36658&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36658&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36658&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36658&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36658&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36658&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36658&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36658&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36658&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36658&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36658&r=mysqlcfg