php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30645 getting rowset from a stored procedure, with/without mysqli_realconnect
Submitted: 2004-11-01 10:05 UTC Modified: 2004-11-01 11:09 UTC
From: michael at kofler dot cc Assigned:
Status: Closed Package: MySQLi related
PHP Version: 5CVS-2004-11-01 (dev) OS: linux (suse 9.1)
Private report: No CVE-ID: None
 [2004-11-01 10:05 UTC] michael at kofler dot cc
Description:
------------
I am using MySQL 5.0.1 (snapshot) and PHP 5.0.2 with mysqli interface (latest snapshot) under Linux (SUSE 9.1).

I use $mysqli->multi_query to call a SP. I want to get back the SELECT results of the SP.

With a normal connect ($mysqli = new mysqli($mysqlhost, $mysqluser, $mysqlpasswd, $mysqldb)), I don't get results.

However, if I instead use $mysqli = mysqli_init + $mysqli->real_connect() with the very same parameters, everything works fine (many thanks to Gleb Paharenko for this tip).


Reproduce code:
---------------
This is my SP:

CREATE PROCEDURE `test`()
BEGIN
   SELECT * FROM t1;
END

And this it the PHP code

   $ok = $mysqli->multi_query("CALL test()");
   if($ok) {
     echo "<p>OK</p>\n";
     do {
       echo "<p>result</p>\n";
       $result = $mysqli->store_result();
       if($result) {
         show_table($result);  // shows result details
         $result->close();
       }
     } while($mysqli->next_result());
   }




Expected result:
----------------
With $mysqli->real_connect, the code above works fine.

Actual result:
--------------
With a normal connect ($mysqli = new mysqli(...)), $ok is always false.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-01 10:52 UTC] georg@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

 
 [2004-11-01 11:09 UTC] georg@php.net
Btw. there is no need to use mysqli_multi_query here - use 
mysqli_real_query instead. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC