getting rowset from a stored procedure, with/without mysqli_realconnect
| 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 commits
[2004-11-01 10:52 UTC] georg@php.net
[2004-11-01 11:09 UTC] georg@php.net