From: Ulf Wendel Date: Fri, 12 Aug 2011 11:23:36 +0000 (+0000) Subject: Andrey, please have a look. Not sure if the test is correct, e.g. MySQL 5.5.3+ really... X-Git-Tag: php-5.4.0beta1~437 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4bb63cb7a07638a4da018c60e97482b35476c5f3;p=php Andrey, please have a look. Not sure if the test is correct, e.g. MySQL 5.5.3+ really needed? --- diff --git a/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt new file mode 100644 index 0000000000..1f92ca1f88 --- /dev/null +++ b/ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt @@ -0,0 +1,125 @@ +--TEST-- +mysqli_stmt_execute() - SP, next result +--SKIPIF-- + +--FILE-- +query("SELECT 1")) + printf("[013] [%d] %s\n", $link->errno, $link->error); + + } else { + printf("[004] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } + + if (!mysqli_query($link, 'DROP PROCEDURE IF EXISTS p')) + printf("[014] [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + + if (mysqli_real_query($link, 'CREATE PROCEDURE p(IN ver_in VARCHAR(25)) BEGIN SELECT ver_in AS _ver_out; SELECT 1 AS _more; END;')) { + // two result sets + if (!$stmt = mysqli_prepare($link, 'CALL p(?)')) + printf("[015] Cannot prepare CALL, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $version = 'myversion'; + if (!mysqli_stmt_bind_param($stmt, 's', $version)) + printf("[016] Cannot bind input parameter, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_execute($stmt)) + printf("[017] Cannot execute CALL, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + $version = NULL; + if (!mysqli_stmt_bind_result($stmt, $version) || + !mysqli_stmt_fetch($stmt)) + printf("[018] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if ($version !== "myversion") + printf("[019] Results seem wrong, got %s, [%d] %s\n", + $version, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_more_results($link) || !mysqli_next_result($link)) + printf("[020] [%d] %s\n", $link->errno, $link->error); + + $more = NULL; + if (!mysqli_stmt_bind_result($stmt, $more) || + !mysqli_stmt_fetch($stmt)) + printf("[021] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if ($more !== 1) + printf("[022] Results seem wrong, got %s, [%d] %s\n", + $more, + mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + if (!mysqli_stmt_close($stmt)) + printf("[023] Cannot close statement, [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); + + + if (!$link->query("SELECT 1")) + printf("[024] [%d] %s\n", $link->errno, $link->error); + + } else { + printf("[025] Cannot create SP, [%d] %s.\n", mysqli_errno($link), mysqli_error($link)); + } + + mysqli_close($link); + print "done!"; +?> +--CLEAN-- + +--EXPECTF-- +[010] More results: yes +[011] Next result: yes +done! \ No newline at end of file