php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36658 mysqli_multi_query randomly fails
Submitted: 2006-03-08 21:30 UTC Modified: 2006-03-09 10:29 UTC
From: jacob at aub dot dk Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.1.2 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jacob at aub dot dk
New email:
PHP Version: OS:

 

 [2006-03-08 21:30 UTC] jacob at aub dot dk
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-09 10:29 UTC] georg@php.net
Can't reproduce (tested with MySQL 5.0.18 Server and client libs). 

As expected I'm always getting error "Packets out of order (Found: 2, expected 1)". This is correct behaviour, the server sends two errorcode packets.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 23:01:28 2024 UTC