Author: uwendel
Date: 2007-07-18 20:54:44 +0200 (Wed, 18 Jul 2007)
New Revision: 788
Modified:
trunk/tests/ext/mysqli/mysqli_next_result.phpt
trunk/tests/ext/mysqli/mysqli_num_fields.phpt
trunk/tests/ext/mysqli/mysqli_num_rows.phpt
trunk/tests/ext/mysqli/mysqli_options.phpt
trunk/tests/ext/mysqli/mysqli_pconnect.phpt
trunk/tests/ext/mysqli/mysqli_phpinfo.phpt
trunk/tests/ext/mysqli/mysqli_ping.phpt
trunk/tests/ext/mysqli/mysqli_prepare.phpt
trunk/tests/ext/mysqli/mysqli_prepare_no_object.phpt
Log:
Space2Tab for php.net and minor tweaks
Modified: trunk/tests/ext/mysqli/mysqli_next_result.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_next_result.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_next_result.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,111 +5,111 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $strict_on = false;
- if (defined('E_STRICT')) {
- error_reporting(((int)ini_get('error_reporting')) | E_STRICT );
- $strict_on = true;
- }
+ include "connect.inc";
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_next_result()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_next_result($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $strict_on = false;
+ if (defined('E_STRICT')) {
+ error_reporting(((int)ini_get('error_reporting')) | E_STRICT );
+ $strict_on = true;
+ }
- require('table.inc');
-
- if ($strict_on)
- ob_start();
-
- if (false !== ($tmp = mysqli_next_result($link)))
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if ($strict_on) {
- $tmp = ob_get_contents();
- ob_end_clean();
- if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next
result set@ismU', $tmp)) {
- printf("[003a] Strict Standards warning missing\n");
- } else {
- $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line
\d+@ism', '', $tmp));
- }
- print trim($tmp) . "\n";
- ob_start();
- }
-
- $res = mysqli_query($link, "SELECT 1 AS res");
- if (false !== ($tmp = mysqli_next_result($link)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
-
- if ($strict_on) {
- $tmp = ob_get_contents();
- ob_end_clean();
- if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next
result set@ismU', $tmp)) {
- printf("[004a] Strict Standards warning missing\n");
- } else {
- $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line
\d+@ism', '', $tmp));
- }
- print trim($tmp) . "\n";
- }
-
- mysqli_free_result($res);
-
- function func_test_mysqli_next_result($link, $query, $offset, $num_results,
$strict_on) {
+ $tmp = NULL;
+ $link = NULL;
- if (!mysqli_multi_query($link, $query))
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link),
mysqli_error($link));
+ if (!is_null($tmp = @mysqli_next_result()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $i = 0;
- if ($strict_on)
- ob_start();
-
- do {
- if ($res = mysqli_store_result($link)) {
- mysqli_free_result($res);
- $i++;
- }
- } while (true === mysqli_next_result($link));
-
- if ($strict_on) {
- $tmp = ob_get_contents();
- ob_end_clean();
- if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next
result set@ismU', $tmp)) {
- printf("[%03d] Strict Standards warning missing\n", $offset + 1);
- } else {
- $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on
line \d+@ism', '', $tmp));
- }
- print trim($tmp) . "\n";
- }
+ if (!is_null($tmp = @mysqli_next_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if ($i !== $num_results) {
- printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2,
$num_results, $i);
- }
+ require('table.inc');
- if (mysqli_more_results($link))
- printf("[%03d] mysqli_more_results() indicates more results than expected\n",
$offset + 3);
+ if ($strict_on)
+ ob_start();
- if (!($res = mysqli_query($link, "SELECT 1 AS b"))) {
- printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link),
mysqli_error($link));
- } else {
- mysqli_free_result($res);
- }
+ if (false !== ($tmp = mysqli_next_result($link)))
+ printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
- }
+ if ($strict_on) {
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next result
set@ismU', $tmp)) {
+ printf("[003a] Strict Standards warning missing\n");
+ } else {
+ $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line \d+@ism',
'', $tmp));
+ }
+ print trim($tmp) . "\n";
+ ob_start();
+ }
- func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id
FROM test ORDER BY id LIMIT 3", 5, 3, $strict_on);
- func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label)
VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2, $strict_on);
- func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS
a; ", 11, 1, $strict_on);
-
- mysqli_close($link);
-
- var_dump(mysqli_next_result($link));
-
- print "done!";
+ $res = mysqli_query($link, "SELECT 1 AS res");
+ if (false !== ($tmp = mysqli_next_result($link)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+
+ if ($strict_on) {
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next result
set@ismU', $tmp)) {
+ printf("[004a] Strict Standards warning missing\n");
+ } else {
+ $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line \d+@ism',
'', $tmp));
+ }
+ print trim($tmp) . "\n";
+ }
+
+ mysqli_free_result($res);
+
+ function func_test_mysqli_next_result($link, $query, $offset, $num_results, $strict_on)
{
+
+ if (!mysqli_multi_query($link, $query))
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+
+ $i = 0;
+ if ($strict_on)
+ ob_start();
+
+ do {
+ if ($res = mysqli_store_result($link)) {
+ mysqli_free_result($res);
+ $i++;
+ }
+ } while (true === mysqli_next_result($link));
+
+ if ($strict_on) {
+ $tmp = ob_get_contents();
+ ob_end_clean();
+ if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next result
set@ismU', $tmp)) {
+ printf("[%03d] Strict Standards warning missing\n", $offset + 1);
+ } else {
+ $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line
\d+@ism', '', $tmp));
+ }
+ print trim($tmp) . "\n";
+ }
+
+ if ($i !== $num_results) {
+ printf("[%03d] Expecting %d result(s), got %d result(s)\n", $offset + 2, $num_results,
$i);
+ }
+
+ if (mysqli_more_results($link))
+ printf("[%03d] mysqli_more_results() indicates more results than expected\n", $offset
+ 3);
+
+ if (!($res = mysqli_query($link, "SELECT 1 AS b"))) {
+ printf("[%03d] [%d] %s\n", $offset + 4, mysqli_errno($link), mysqli_error($link));
+ } else {
+ mysqli_free_result($res);
+ }
+
+ }
+
+ func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id
FROM test ORDER BY id LIMIT 3", 5, 3, $strict_on);
+ func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES
(100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2, $strict_on);
+ func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a;
", 11, 1, $strict_on);
+
+ mysqli_close($link);
+
+ var_dump(mysqli_next_result($link));
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_next_result(): Couldn't fetch mysqli in %s on line %d
Modified: trunk/tests/ext/mysqli/mysqli_num_fields.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_num_fields.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_num_fields.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,45 +5,45 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
+ include "connect.inc";
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_num_fields()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_num_fields($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = NULL;
+ $link = NULL;
- require('table.inc');
+ if (!is_null($tmp = @mysqli_num_fields()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free =
false) {
+ if (!is_null($tmp = @mysqli_num_fields($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- if (!($res = mysqli_query($link, $query))) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link),
mysqli_error($link));
- return;
- }
+ require('table.inc');
- if ($expected !== ($tmp = mysqli_num_fields($res)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
+ function func_test_mysqli_num_fields($link, $query, $expected, $offset, $test_free =
false) {
- mysqli_free_result($res);
+ if (!($res = mysqli_query($link, $query))) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return;
+ }
- if ($test_free && (NULL !== ($tmp = mysqli_num_fields($res))))
- printf("[%03d] Expecting NULL, got %s/%s\n", $offset + 2, gettype($tmp),
$tmp);
- }
+ if ($expected !== ($tmp = mysqli_num_fields($res)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
- func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5);
- func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10);
- func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15);
- func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true);
+ mysqli_free_result($res);
- mysqli_close($link);
-
- print "done!";
+ if ($test_free && (NULL !== ($tmp = mysqli_num_fields($res))))
+ printf("[%03d] Expecting NULL, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
+ }
+
+ func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5);
+ func_test_mysqli_num_fields($link, "SELECT id, label FROM test", 2, 10);
+ func_test_mysqli_num_fields($link, "SELECT 1 AS a, NULL AS b, 'foo' AS c", 3, 15);
+ func_test_mysqli_num_fields($link, "SELECT id FROM test", 1, 20, true);
+
+ mysqli_close($link);
+
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_num_fields(): Couldn't fetch mysqli_result in %s on line %d
Modified: trunk/tests/ext/mysqli/mysqli_num_rows.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_num_rows.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_num_rows.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,70 +5,70 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_num_rows()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_num_rows($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ include "connect.inc";
- require('table.inc');
-
- function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free =
false) {
-
- if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) {
- printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link),
mysqli_error($link));
- return;
- }
-
- if ($expected !== ($tmp = mysqli_num_rows($res)))
- printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
- gettype($expected), $expected,
- gettype($tmp), $tmp);
-
- mysqli_free_result($res);
-
- if ($test_free && (NULL !== ($tmp = mysqli_num_rows($res))))
- printf("[%03d] Expecting NULL, got %s/%s\n", $offset + 2, gettype($tmp),
$tmp);
-
- }
-
- func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5);
- func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
- func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')",
NULL, 15);
- func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
-
- if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
-
- $row = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
-
- func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'],
25);
-
- } else {
- printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
-
- if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) {
+ $tmp = NULL;
+ $link = NULL;
- $row = mysqli_fetch_row($res);
- if (0 !== ($tmp = mysqli_num_rows($res)))
- printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp);
-
- mysqli_free_result($res);
-
- } else {
- printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- }
-
- mysqli_close($link);
- print "done!";
+ if (!is_null($tmp = @mysqli_num_rows()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_num_rows($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ function func_test_mysqli_num_rows($link, $query, $expected, $offset, $test_free =
false) {
+
+ if (!$res = mysqli_query($link, $query, MYSQLI_STORE_RESULT)) {
+ printf("[%03d] [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
+ return;
+ }
+
+ if ($expected !== ($tmp = mysqli_num_rows($res)))
+ printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 1,
+ gettype($expected), $expected,
+ gettype($tmp), $tmp);
+
+ mysqli_free_result($res);
+
+ if ($test_free && (NULL !== ($tmp = mysqli_num_rows($res))))
+ printf("[%03d] Expecting NULL, got %s/%s\n", $offset + 2, gettype($tmp), $tmp);
+
+ }
+
+ func_test_mysqli_num_rows($link, "SELECT 1 AS a", 1, 5);
+ func_test_mysqli_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
+ func_test_mysqli_num_rows($link, "INSERT INTO test(id, label) VALUES (100, 'z')", NULL,
15);
+ func_test_mysqli_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
+
+ if ($res = mysqli_query($link, 'SELECT COUNT(id) AS num FROM test')) {
+
+ $row = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ func_test_mysqli_num_rows($link, "SELECT id, label FROM test", (int)$row['num'], 25);
+
+ } else {
+ printf("[030] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+
+ if ($res = mysqli_query($link, 'SELECT id FROM test', MYSQLI_USE_RESULT)) {
+
+ $row = mysqli_fetch_row($res);
+ if (0 !== ($tmp = mysqli_num_rows($res)))
+ printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp);
+
+ mysqli_free_result($res);
+
+ } else {
+ printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ }
+
+ mysqli_close($link);
+ print "done!";
?>
--EXPECTF--
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in %s
on line %d
Modified: trunk/tests/ext/mysqli/mysqli_options.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_options.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_options.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,60 +5,60 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
- $valid_options = array( MYSQLI_READ_DEFAULT_GROUP, MYSQLI_READ_DEFAULT_FILE,
- MYSQLI_OPT_CONNECT_TIMEOUT, MYSQLI_OPT_LOCAL_INFILE,
- MYSQLI_INIT_COMMAND, MYSQLI_READ_DEFAULT_GROUP,
- MYSQLI_READ_DEFAULT_FILE, MYSQLI_OPT_CONNECT_TIMEOUT,
- MYSQLI_OPT_LOCAL_INFILE, MYSQLI_INIT_COMMAND,
- MYSQLI_SET_CHARSET_NAME);
-
- if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_YEARS_AS_INT'))
- $valid_options[] = constant('MYSQLI_OPT_INT_AND_YEARS_AS_INT');
- if (defined('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE'))
- $valid_options[] = constant('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE');
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_options()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ include "connect.inc";
+ $valid_options = array( MYSQLI_READ_DEFAULT_GROUP, MYSQLI_READ_DEFAULT_FILE,
+ MYSQLI_OPT_CONNECT_TIMEOUT, MYSQLI_OPT_LOCAL_INFILE,
+ MYSQLI_INIT_COMMAND, MYSQLI_READ_DEFAULT_GROUP,
+ MYSQLI_READ_DEFAULT_FILE, MYSQLI_OPT_CONNECT_TIMEOUT,
+ MYSQLI_OPT_LOCAL_INFILE, MYSQLI_INIT_COMMAND,
+ MYSQLI_SET_CHARSET_NAME);
- $link = mysqli_init();
-
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
- printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, "s", 'extra_my.cnf')))
- printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0',
'foo')))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_YEARS_AS_INT'))
+ $valid_options[] = constant('MYSQLI_OPT_INT_AND_YEARS_AS_INT');
+ if (defined('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE'))
+ $valid_options[] = constant('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE');
- // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
- var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link,
MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE,
'extra_my.cnf'));
- var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link,
MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE,
1));
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND,
array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
- var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link,
MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
- var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE,
'extra_my.cnf'));
- var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link,
MYSQLI_OPT_CONNECT_TIMEOUT, 10));
- var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE,
1));
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET
AUTOCOMMIT=0'));
- var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not an
mysqli_option'));
-
- if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_YEARS_AS_INT') &&
- !($tmp = mysqli_options($link, constant('MYSQLI_OPT_INT_AND_YEARS_AS_INT'),
true)))
- printf("[006] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
-
- if (defined('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE') &&
- !($tmp = mysqli_options($link,
constant('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE'), true)))
- printf("[006] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+ $tmp = NULL;
+ $link = NULL;
+ if (!is_null($tmp = @mysqli_options()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_options($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ $link = mysqli_init();
+
+ if (!is_null($tmp = @mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_options($link, "s", 'extra_my.cnf')))
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!is_null($tmp = @mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0',
'foo')))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ // print "run_tests.php don't fool me with your 'ungreedy' expression '.+?'!\n";
+ var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP,
'extra_my.cnf'));
+ var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE,
'extra_my.cnf'));
+ var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT,
10));
+ var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET
AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
+ var_dump("MYSQLI_READ_DEFAULT_GROUP", mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP,
'extra_my.cnf'));
+ var_dump("MYSQLI_READ_DEFAULT_FILE", mysqli_options($link, MYSQLI_READ_DEFAULT_FILE,
'extra_my.cnf'));
+ var_dump("MYSQLI_OPT_CONNECT_TIMEOUT", mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT,
10));
+ var_dump("MYSQLI_OPT_LOCAL_INFILE", mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET
AUTOCOMMIT=0'));
+ var_dump("MYSQLI_CLIENT_SSL", mysqli_options($link, MYSQLI_CLIENT_SSL, 'not an
mysqli_option'));
+
+ if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_YEARS_AS_INT') &&
+ !($tmp = mysqli_options($link, constant('MYSQLI_OPT_INT_AND_YEARS_AS_INT'), true)))
+ printf("[006] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+
+ if (defined('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE') &&
+ !($tmp = mysqli_options($link, constant('MYSQLI_OPT_NUMERIC_AND_DATETIME_AS_UNICODE'),
true)))
+ printf("[006] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+
for ($flag = -10000; $flag < 10000; $flag++) {
if (in_array($flag, $valid_options))
continue;
@@ -66,14 +66,13 @@
var_dump("SOME_FLAG", $flag, $tmp);
}
}
-
- mysqli_close($link);
+ mysqli_close($link);
+
echo "Link closed";
- var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET
AUTOCOMMIT=1'));
- var_dump("SOME_RANDOM_FLAG", mysqli_options($link, $flag, 'definetly not an
mysqli_option'));
-
- print "done!";
+ var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET
AUTOCOMMIT=1'));
+ var_dump("SOME_RANDOM_FLAG", mysqli_options($link, $flag, 'definetly not an
mysqli_option'));
+ print "done!";
?>
--EXPECTF--
%s(25) "MYSQLI_READ_DEFAULT_GROUP"
@@ -106,4 +105,4 @@
Warning: mysqli_options(): Couldn't fetch mysqli in %s line %d
%s(16) "SOME_RANDOM_FLAG"
NULL
-done!
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_pconnect.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_pconnect.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_pconnect.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -1,74 +1,74 @@
--TEST--
-mysqli_connect()
+mysqli_pconnect()
--SKIPIF--
-<?php
+<?php
require_once('skipif.inc');
-require_once('skipifemb.inc');
+require_once('skipifemb.inc');
if (!stristr(mysqli_get_client_info(), 'mysqlnd'))
- die("skip: only available in mysqlnd");
+ die("skip: only available in mysqlnd");
?>
--FILE--
<?php
- include "connect.inc";
-
- $host = 'p:' . $host;
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- mysqli_close($link);
-
- $num = 20;
- $connections = array();
- for ($i = 0; $i < $num; $i++) {
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
- $connections[] = $link;
- }
- while (count($connections)) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]));
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- }
-
-
- $connections = array();
- $num = 20;
- for ($i = 0; $i < $num; $i++) {
- if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
- $connections[] = $link;
- }
- $left = $num;
-
- while (count($connections) && $left > 0) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]) && $left > 0);
- if (mt_rand(0, 1) > 0) {
- $left--;
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- } else {
- $left--;
- if (!$connections[$index] = mysqli_connect($host, $user, $passwd, $db, $port,
$socket))
- printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
- }
- flush();
- }
-
- while (count($connections)) {
- do {
- $index = mt_rand(0, $num);
- } while (!isset($connections[$index]));
- mysqli_close($connections[$index]);
- unset($connections[$index]);
- }
-
- print "done!";
+ include "connect.inc";
+
+ $host = 'p:' . $host;
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ mysqli_close($link);
+
+ $num = 20;
+ $connections = array();
+ for ($i = 0; $i < $num; $i++) {
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+ $connections[] = $link;
+ }
+ while (count($connections)) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]));
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ }
+
+
+ $connections = array();
+ $num = 20;
+ for ($i = 0; $i < $num; $i++) {
+ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+ $connections[] = $link;
+ }
+ $left = $num;
+
+ while (count($connections) && $left > 0) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]) && $left > 0);
+ if (mt_rand(0, 1) > 0) {
+ $left--;
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ } else {
+ $left--;
+ if (!$connections[$index] = mysqli_connect($host, $user, $passwd, $db, $port,
$socket))
+ printf("[004] Connect failed, [%d] %s\n", mysqli_connect_errno(),
mysqli_connect_error());
+ }
+ flush();
+ }
+
+ while (count($connections)) {
+ do {
+ $index = mt_rand(0, $num);
+ } while (!isset($connections[$index]));
+ mysqli_close($connections[$index]);
+ unset($connections[$index]);
+ }
+
+ print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_phpinfo.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_phpinfo.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_phpinfo.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,65 +5,65 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include("connect.inc");
-
- @ob_clean();
- ob_start();
- phpinfo();
- $phpinfo = ob_get_contents();
- ob_end_clean();
-
- /* all versions should at least dump this minimum information */
- if (!stristr($phpinfo, "mysqli support"))
- printf("[001] ext/mysqli should have exposed itself.\n");
-
- if (!stristr($phpinfo, "client api library version"))
- printf("[002] ext/mysqli should have exposed the library version.\n");
-
- if (!stristr($phpinfo, "mysqli.default_host"))
- printf("[003] php.ini setting mysqli.default_host not shown.\n");
+ include("connect.inc");
- if (!stristr($phpinfo, "mysqli.default_port"))
- printf("[004] php.ini setting mysqli.default_port not shown.\n");
+ @ob_clean();
+ ob_start();
+ phpinfo();
+ $phpinfo = ob_get_contents();
+ ob_end_clean();
- if (!stristr($phpinfo, "mysqli.default_pw"))
- printf("[005] php.ini setting mysqli.default_pw not shown.\n");
+ /* all versions should at least dump this minimum information */
+ if (!stristr($phpinfo, "mysqli support"))
+ printf("[001] ext/mysqli should have exposed itself.\n");
- if (!stristr($phpinfo, "mysqli.default_socket"))
- printf("[006] php.ini setting mysqli.default_socket not shown.\n");
+ if (!stristr($phpinfo, "client api library version"))
+ printf("[002] ext/mysqli should have exposed the library version.\n");
- if (!stristr($phpinfo, "mysqli.default_user"))
- printf("[007] php.ini setting mysqli.default_user not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_host"))
+ printf("[003] php.ini setting mysqli.default_host not shown.\n");
- if (!stristr($phpinfo, "mysqli.max_links"))
- printf("[008] php.ini setting mysqli.max_links not shown.\n");
+ if (!stristr($phpinfo, "mysqli.default_port"))
+ printf("[004] php.ini setting mysqli.default_port not shown.\n");
- if (!stristr($phpinfo, "mysqli.reconnect"))
- printf("[009] php.ini setting mysqli.reconnect not shown.\n");
-
- if ($IS_MYSQLND) {
- $expected = array(
- 'client statistics',
- 'bytes_sent', 'bytes_received', 'packets_sent', 'packets_received',
- 'protocol_overhead_in', 'protocol_overhead_out', 'result_set_queries',
- 'non_result_set_queries', 'no_index_used', 'bad_index_used',
- 'buffered_sets', 'unbuffered_sets', 'ps_buffered_sets', 'ps_unbuffered_sets',
- 'flushed_normal_sets', 'flushed_ps_sets', 'rows_fetched_from_server',
- 'rows_fetched_from_client', 'rows_skipped', 'copy_on_write_saved',
- 'copy_on_write_performed', 'command_buffer_too_small', 'connect_success',
- 'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
- 'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
- 'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
- 'put_hits', 'put_misses', 'get_hits', 'get_misses',
- 'size', 'free_items', 'references', 'mysqli.cache_size',
- 'mysql.allow_local_infile'
- );
- foreach ($expected as $k => $entry)
- if (!stristr($phpinfo, $entry))
- printf("[010] Could not find entry for '%s'\n", $entry);
- }
-
- print "done!";
+ if (!stristr($phpinfo, "mysqli.default_pw"))
+ printf("[005] php.ini setting mysqli.default_pw not shown.\n");
+
+ if (!stristr($phpinfo, "mysqli.default_socket"))
+ printf("[006] php.ini setting mysqli.default_socket not shown.\n");
+
+ if (!stristr($phpinfo, "mysqli.default_user"))
+ printf("[007] php.ini setting mysqli.default_user not shown.\n");
+
+ if (!stristr($phpinfo, "mysqli.max_links"))
+ printf("[008] php.ini setting mysqli.max_links not shown.\n");
+
+ if (!stristr($phpinfo, "mysqli.reconnect"))
+ printf("[009] php.ini setting mysqli.reconnect not shown.\n");
+
+ if ($IS_MYSQLND) {
+ $expected = array(
+ 'client statistics',
+ 'bytes_sent', 'bytes_received', 'packets_sent', 'packets_received',
+ 'protocol_overhead_in', 'protocol_overhead_out', 'result_set_queries',
+ 'non_result_set_queries', 'no_index_used', 'bad_index_used',
+ 'buffered_sets', 'unbuffered_sets', 'ps_buffered_sets', 'ps_unbuffered_sets',
+ 'flushed_normal_sets', 'flushed_ps_sets', 'rows_fetched_from_server',
+ 'rows_fetched_from_client', 'rows_skipped', 'copy_on_write_saved',
+ 'copy_on_write_performed', 'command_buffer_too_small', 'connect_success',
+ 'connect_failure', 'connection_reused', 'explicit_close', 'implicit_close',
+ 'disconnect_close', 'in_middle_of_command_close', 'explicit_free_result',
+ 'implicit_free_result', 'explicit_stmt_close', 'implicit_stmt_close',
+ 'put_hits', 'put_misses', 'get_hits', 'get_misses',
+ 'size', 'free_items', 'references', 'mysqli.cache_size',
+ 'mysql.allow_local_infile'
+ );
+ foreach ($expected as $k => $entry)
+ if (!stristr($phpinfo, $entry))
+ printf("[010] Could not find entry for '%s'\n", $entry);
+ }
+
+ print "done!";
?>
--EXPECTF--
done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_ping.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_ping.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_ping.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,40 +5,40 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_ping()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (!is_null($tmp = @mysqli_ping($link, $link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- var_dump(mysqli_ping($link));
-
- // provoke an error to check if mysqli_ping resets it
- $res = mysqli_query($link, 'SELECT * FROM unknown_table');
- if (!($errno = mysqli_errno($link)))
- printf("[003] Statement should have caused an error\n");
-
- var_dump(mysqli_ping($link));
- if ($errno === mysqli_errno($link))
- printf("[004] Error codes should have been reset\n");
-
- mysqli_close($link);
-
- if (!is_null($tmp = mysqli_ping($link)))
- printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ include "connect.inc";
+
+ $tmp = NULL;
+ $link = NULL;
+
+ if (!is_null($tmp = @mysqli_ping()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (!is_null($tmp = @mysqli_ping($link, $link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ var_dump(mysqli_ping($link));
+
+ // provoke an error to check if mysqli_ping resets it
+ $res = mysqli_query($link, 'SELECT * FROM unknown_table');
+ if (!($errno = mysqli_errno($link)))
+ printf("[003] Statement should have caused an error\n");
+
+ var_dump(mysqli_ping($link));
+ if ($errno === mysqli_errno($link))
+ printf("[004] Error codes should have been reset\n");
+
+ mysqli_close($link);
+
+ if (!is_null($tmp = mysqli_ping($link)))
+ printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
bool(true)
bool(true)
Warning: mysqli_ping(): Couldn't fetch mysqli in %s on line %d
-done!
\ No newline at end of file
+done!
\ No newline at end of file
Modified: trunk/tests/ext/mysqli/mysqli_prepare.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_prepare.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_prepare.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,111 +5,114 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
-
- $tmp = NULL;
- $link = NULL;
-
- if (!is_null($tmp = @mysqli_prepare()))
- printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- if (!is_null($tmp = @mysqli_prepare($link)))
- printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- require('table.inc');
-
- if (false !== ($tmp = @mysqli_prepare($link, false)))
- printf("[003] Expecting boolean/false, got %s\n", gettype($tmp));
-
- if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT))
- printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link),
mysqli_error($link));
-
- if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?')))
- printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp),
mysqli_errno($link), mysqli_error($link));
-
- mysqli_free_result($res);
+ include "connect.inc";
- if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) ||
!mysqli_stmt_execute($stmt))
- printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
+ $tmp = NULL;
+ $link = NULL;
- if (!mysqli_query($link, "DROP TABLE IF EXISTS test2"))
- printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' .
$engine))) || !mysqli_stmt_execute($stmt))
- printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
-
- if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)'))))
- printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ if (!is_null($tmp = @mysqli_prepare()))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
- $id = 1;
- if (!mysqli_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
- printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
- if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)'))))
- printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $id = 2;
- if (!mysqli_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
- printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
- if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id =
?'))))
- printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $id = 3;
- $where = 2;
- if (!mysqli_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt))
- printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
- if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?'))))
- printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $where = 3;
- if (!mysqli_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt))
- printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
- if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?'))))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $testvar = 'testvar';
- if (!mysqli_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt))
- printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
- if (!is_object(($stmt = mysqli_prepare($link, 'DO GET_LOCK("testlock", 1)'))))
- printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- mysqli_stmt_close($stmt);
-
- if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2'))))
- printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- $id = $testvar = null;
- if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar))
- printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- while (mysqli_stmt_fetch($stmt)) {
- if (('testvar' !== $testvar) || (1 !== $id))
- printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n",
- $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
- }
-
- mysqli_stmt_close($stmt);
-
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test', 'foo')))
- printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- mysqli_close($link);
-
- if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test')))
- printf("[024] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
- print "done!";
+ if (!is_null($tmp = @mysqli_prepare($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ require('table.inc');
+
+ if (false !== ($tmp = @mysqli_prepare($link, false)))
+ printf("[003] Expecting boolean/false, got %s\n", gettype($tmp));
+
+ if (!$res = mysqli_query($link, "SELECT id, label FROM test", MYSQLI_USE_RESULT))
+ printf("[004] [%d] %s, next test will fail\n", mysqli_errno($link),
mysqli_error($link));
+
+ if (false !== ($tmp = mysqli_prepare($link, 'SELECT id FROM test WHERE id > ?')))
+ printf("[005] Expecting boolean/false, got %s, [%d] %s\n", gettype($tmp),
mysqli_errno($link), mysqli_error($link));
+
+ mysqli_free_result($res);
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id FROM test'))) ||
!mysqli_stmt_execute($stmt))
+ printf("[006][%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+
+ if (!mysqli_query($link, "DROP TABLE IF EXISTS test2"))
+ printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'CREATE TABLE test2(id INT) ENGINE =' .
$engine))) || !mysqli_stmt_execute($stmt))
+ printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'INSERT INTO test2(id) VALUES(?)'))))
+ printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $id = 1;
+ if (!mysqli_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
+ printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'REPLACE INTO test2(id) VALUES (?)'))))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $id = 2;
+ if (!mysqli_bind_param($stmt, 'i', $id) || !mysqli_stmt_execute($stmt))
+ printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'UPDATE test2 SET id = ? WHERE id = ?'))))
+ printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $id = 3;
+ $where = 2;
+ if (!mysqli_bind_param($stmt, 'ii', $id, $where) || !mysqli_stmt_execute($stmt))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'DELETE FROM test2 WHERE id = ?'))))
+ printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $where = 3;
+ if (!mysqli_bind_param($stmt, 'i', $where) || !mysqli_stmt_execute($stmt))
+ printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'SET @testvar = ?'))))
+ printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $testvar = 'testvar';
+ if (!mysqli_bind_param($stmt, 's', $testvar) || !mysqli_stmt_execute($stmt))
+ printf("[018] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'DO GET_LOCK("testlock", 1)'))))
+ printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ mysqli_stmt_close($stmt);
+
+ if (!is_object(($stmt = mysqli_prepare($link, 'SELECT id, @testvar FROM test2'))))
+ printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ $id = $testvar = null;
+ if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_bind_result($stmt, $id, $testvar))
+ printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ while (mysqli_stmt_fetch($stmt)) {
+ if (('testvar' !== $testvar) || (1 !== $id))
+ printf("[022] Expecting 'testvar'/1, got %s/%s. [%d] %s\n",
+ $testvar, $id, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+ }
+
+ var_dump(mysqli_stmt_prepare($stmt, 'SELECT 1; SELECT 2'));
+
+ mysqli_stmt_close($stmt);
+
+ if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test', 'foo')))
+ printf("[023] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ mysqli_close($link);
+
+ if (!is_null($tmp = @mysqli_stmt_prepare($link, 'SELECT id FROM test')))
+ printf("[024] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+ print "done!";
?>
--EXPECTF--
+bool(false)
done!
Modified: trunk/tests/ext/mysqli/mysqli_prepare_no_object.phpt
===================================================================
--- trunk/tests/ext/mysqli/mysqli_prepare_no_object.phpt 2007-07-18 18:35:53 UTC (rev 787)
+++ trunk/tests/ext/mysqli/mysqli_prepare_no_object.phpt 2007-07-18 18:54:44 UTC (rev 788)
@@ -5,32 +5,32 @@
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
- include "connect.inc";
- require('table.inc');
-
- if (false !== ($tmp = mysqli_prepare($link, false)))
- printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
- if (false !== ($tmp = mysqli_prepare($link, '')))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ include "connect.inc";
+ require('table.inc');
- mysqli_close($link);
-
- if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
- printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
- $host, $user, $db, $port, $socket);
-
- if (false !== ($tmp = $mysqli->prepare(false)))
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
-
- if (false !== ($tmp = $mysqli->prepare('')))
- printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp),
(is_object($tmp) ? var_dump($tmp, true) : $tmp));
- printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
-
- print "done!";
+ if (false !== ($tmp = mysqli_prepare($link, false)))
+ printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ?
var_dump($tmp, true) : $tmp));
+ printf("a) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (false !== ($tmp = mysqli_prepare($link, '')))
+ printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ?
var_dump($tmp, true) : $tmp));
+ printf("b) [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ mysqli_close($link);
+
+ if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket))
+ printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***,
dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
+
+ if (false !== ($tmp = $mysqli->prepare(false)))
+ printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ?
var_dump($tmp, true) : $tmp));
+ printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
+
+ if (false !== ($tmp = $mysqli->prepare('')))
+ printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), (is_object($tmp) ?
var_dump($tmp, true) : $tmp));
+ printf("c) [%d] %s\n", $mysqli->errno, $mysqli->error);
+
+ print "done!";
?>
--EXPECTF--
a) [1065] Query was empty
| Thread |
|---|
| • PHP mysqlnd svn commit: r788 - trunk/tests/ext/mysqli | uwendel | 18 Jul |