2007-12-25 18:55:40 +00:00
|
|
|
--TEST--
|
|
|
|
Bug #42548 PROCEDURE xxx can't return a result set in the given context (works in 5.2.3!!)
|
|
|
|
--SKIPIF--
|
2007-12-28 14:50:48 +00:00
|
|
|
<?php
|
|
|
|
require_once('skipif.inc');
|
|
|
|
require_once('skipifconnectfailure.inc');
|
|
|
|
require_once('connect.inc');
|
|
|
|
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
|
|
|
die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
|
|
|
|
}
|
|
|
|
if (mysqli_get_server_version($link) <= 50000) {
|
|
|
|
die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
|
|
|
|
}
|
|
|
|
?>
|
2007-12-25 18:55:40 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2007-12-28 14:50:48 +00:00
|
|
|
require_once('connect.inc');
|
|
|
|
|
2007-12-25 18:55:40 +00:00
|
|
|
$mysqli = mysqli_init();
|
2007-12-28 14:50:48 +00:00
|
|
|
$mysqli->real_connect($host, $user, $passwd, $db, $port, $socket);
|
2007-12-25 18:55:40 +00:00
|
|
|
if (mysqli_connect_errno()) {
|
2007-12-28 14:50:48 +00:00
|
|
|
printf("Connect failed: %s\n", mysqli_connect_error());
|
|
|
|
exit();
|
2007-12-25 18:55:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error);
|
|
|
|
$mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or die($mysqli->error);
|
|
|
|
|
|
|
|
if ($mysqli->multi_query("CALL p1();"))
|
2007-12-28 14:50:48 +00:00
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ($objResult = $mysqli->store_result()) {
|
|
|
|
while ($row = $objResult->fetch_assoc()) {
|
|
|
|
print_r($row);
|
|
|
|
}
|
|
|
|
$objResult->close();
|
|
|
|
if ($mysqli->more_results()) {
|
|
|
|
print "----- next result -----------\n";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
print "no results found\n";
|
|
|
|
}
|
|
|
|
} while ($mysqli->more_results() && $mysqli->next_result());
|
2007-12-25 18:55:40 +00:00
|
|
|
} else {
|
2007-12-28 14:50:48 +00:00
|
|
|
print $mysqli->error;
|
2007-12-25 18:55:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$mysqli->query("DROP PROCEDURE p1") or die($mysqli->error);
|
|
|
|
$mysqli->close();
|
2007-12-28 14:50:48 +00:00
|
|
|
print "done!";
|
2007-12-25 18:55:40 +00:00
|
|
|
?>
|
2007-12-28 14:50:48 +00:00
|
|
|
--EXPECT--
|
2007-12-25 18:55:40 +00:00
|
|
|
Array
|
|
|
|
(
|
|
|
|
[23] => 23
|
|
|
|
)
|
|
|
|
----- next result -----------
|
|
|
|
Array
|
|
|
|
(
|
|
|
|
[42] => 42
|
|
|
|
)
|
|
|
|
----- next result -----------
|
|
|
|
no results found
|
2007-12-28 14:50:48 +00:00
|
|
|
done!
|