Annotation of embedaddon/php/ext/mysqli/tests/bug42548.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #42548 PROCEDURE xxx can't return a result set in the given context (works in 5.2.3!!)
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: require_once('connect.inc');
! 8: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
! 9: die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
! 10: }
! 11: if (mysqli_get_server_version($link) <= 50000) {
! 12: die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
! 13: }
! 14: ?>
! 15: --FILE--
! 16: <?php
! 17: require_once('connect.inc');
! 18:
! 19: $mysqli = mysqli_init();
! 20: $mysqli->real_connect($host, $user, $passwd, $db, $port, $socket);
! 21: if (mysqli_connect_errno()) {
! 22: printf("Connect failed: %s\n", mysqli_connect_error());
! 23: exit();
! 24: }
! 25:
! 26: $mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error);
! 27: $mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or die($mysqli->error);
! 28:
! 29: if ($mysqli->multi_query("CALL p1();"))
! 30: {
! 31: do
! 32: {
! 33: if ($objResult = $mysqli->store_result()) {
! 34: while ($row = $objResult->fetch_assoc()) {
! 35: print_r($row);
! 36: }
! 37: $objResult->close();
! 38: if ($mysqli->more_results()) {
! 39: print "----- next result -----------\n";
! 40: }
! 41: } else {
! 42: print "no results found\n";
! 43: }
! 44: } while ($mysqli->more_results() && $mysqli->next_result());
! 45: } else {
! 46: print $mysqli->error;
! 47: }
! 48:
! 49: $mysqli->query("DROP PROCEDURE p1") or die($mysqli->error);
! 50: $mysqli->close();
! 51: print "done!";
! 52: ?>
! 53: --CLEAN--
! 54: <?php
! 55: require_once("connect.inc");
! 56: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
! 57: printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
! 58:
! 59: mysqli_query($link, "DROP PROCEDURE IF EXISTS p1");
! 60:
! 61: mysqli_close($link);
! 62: ?>
! 63: --EXPECT--
! 64: Array
! 65: (
! 66: [23] => 23
! 67: )
! 68: ----- next result -----------
! 69: Array
! 70: (
! 71: [42] => 42
! 72: )
! 73: ----- next result -----------
! 74: no results found
! 75: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>