bug42548.phpt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. $mysqli = mysqli_init();
  19. $mysqli->real_connect($host, $user, $passwd, $db, $port, $socket);
  20. if (mysqli_connect_errno()) {
  21. printf("Connect failed: %s\n", mysqli_connect_error());
  22. exit();
  23. }
  24. $mysqli->query("DROP PROCEDURE IF EXISTS p1") or die($mysqli->error);
  25. $mysqli->query("CREATE PROCEDURE p1() BEGIN SELECT 23; SELECT 42; END") or die($mysqli->error);
  26. if ($mysqli->multi_query("CALL p1();"))
  27. {
  28. do
  29. {
  30. if ($objResult = $mysqli->store_result()) {
  31. while ($row = $objResult->fetch_assoc()) {
  32. print_r($row);
  33. }
  34. $objResult->close();
  35. if ($mysqli->more_results()) {
  36. print "----- next result -----------\n";
  37. }
  38. } else {
  39. print "no results found\n";
  40. }
  41. } while ($mysqli->more_results() && $mysqli->next_result());
  42. } else {
  43. print $mysqli->error;
  44. }
  45. $mysqli->query("DROP PROCEDURE p1") or die($mysqli->error);
  46. $mysqli->close();
  47. print "done!";
  48. ?>
  49. --CLEAN--
  50. <?php
  51. require_once("connect.inc");
  52. if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
  53. printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
  54. mysqli_query($link, "DROP PROCEDURE IF EXISTS p1");
  55. mysqli_close($link);
  56. ?>
  57. --EXPECT--
  58. Array
  59. (
  60. [23] => 23
  61. )
  62. ----- next result -----------
  63. Array
  64. (
  65. [42] => 42
  66. )
  67. ----- next result -----------
  68. no results found
  69. done!