bug42548.phpt 2.0 KB

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