uw Fri Dec 28 14:50:48 2007 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mysqli/tests bug42548.phpt Log: Cutting off a few edges: - use connection parameter from environment variables - check if MySQL supports procedures - whitespace http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/bug42548.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u Index: php-src/ext/mysqli/tests/bug42548.phpt diff -u php-src/ext/mysqli/tests/bug42548.phpt:1.1.2.2 php-src/ext/mysqli/tests/bug42548.phpt:1.1.2.3 --- php-src/ext/mysqli/tests/bug42548.phpt:1.1.2.2 Tue Dec 25 18:54:29 2007 +++ php-src/ext/mysqli/tests/bug42548.phpt Fri Dec 28 14:50:48 2007 @@ -1,43 +1,56 @@ --TEST-- Bug #42548 PROCEDURE xxx can't return a result set in the given context (works in 5.2.3!!) --SKIPIF-- -<?php if (!extension_loaded("mysqli")) print "skip"; ?> +<?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))); +} +?> --FILE-- <?php +require_once('connect.inc'); + $mysqli = mysqli_init(); -$mysqli->real_connect('localhost', 'root', '', 'test'); +$mysqli->real_connect($host, $user, $passwd, $db, $port, $socket); if (mysqli_connect_errno()) { - printf("Connect failed: %s\n", mysqli_connect_error()); - exit(); + printf("Connect failed: %s\n", mysqli_connect_error()); + exit(); } $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();")) -{ - 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"; - } - } while ($mysqli->more_results() && $mysqli->next_result()); +{ + 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()); } else { - print $mysqli->error; + print $mysqli->error; } $mysqli->query("DROP PROCEDURE p1") or die($mysqli->error); $mysqli->close(); +print "done!"; ?> ---EXPECT-- +--EXPECT-- Array ( [23] => 23 @@ -49,3 +62,4 @@ ) ----- next result ----------- no results found +done! \ No newline at end of file
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php