From 1884a16d01db5bf277d12bda0c62afb7de3f1cf0 Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Mon, 23 Jul 2007 12:04:19 +0000 Subject: [PATCH] Primarily whitespace/CS - synching with mysqlnd SVN repository --- ext/mysqli/tests/001.phpt | 10 ++--- ext/mysqli/tests/002.phpt | 22 +++++----- ext/mysqli/tests/009.phpt | 22 ++++++---- ext/mysqli/tests/020.phpt | 10 ++--- ext/mysqli/tests/023.phpt | 12 +++--- ext/mysqli/tests/024.phpt | 12 +++--- ext/mysqli/tests/025.phpt | 12 +++--- ext/mysqli/tests/045.phpt | 7 ++- ext/mysqli/tests/048.phpt | 14 +++--- ext/mysqli/tests/060.phpt | 12 +++--- ext/mysqli/tests/065.phpt | 42 +++++++++--------- ext/mysqli/tests/067.phpt | 21 +++++---- ext/mysqli/tests/connect.inc | 72 +++++++++++++++---------------- ext/mysqli/tests/skipif.inc | 2 +- ext/mysqli/tests/skipifemb.inc | 8 ++-- ext/mysqli/tests/skipifnotemb.inc | 8 ++-- ext/mysqli/tests/table.inc | 24 +++++------ 17 files changed, 163 insertions(+), 147 deletions(-) diff --git a/ext/mysqli/tests/001.phpt b/ext/mysqli/tests/001.phpt index 51adb6a3de..1e76695d4f 100644 --- a/ext/mysqli/tests/001.phpt +++ b/ext/mysqli/tests/001.phpt @@ -34,13 +34,13 @@ mysqli connect /* temporary addition for Kent's setup, Win32 box */ for ($i = 0; $i < 10; $i++) { - if (!$link = mysqli_init()) - printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); + if (!$link = mysqli_init()) + printf("[001 + %d] mysqli_init() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); - if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) - printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); + if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) + printf("[002 + %d] mysqli_real_connect() failed, [%d] %s\n", $i, mysqli_connect_errno(), mysqli_connect_error()); - mysqli_close($link); + mysqli_close($link); } /*** test mysqli_real_connect compressed ***/ diff --git a/ext/mysqli/tests/002.phpt b/ext/mysqli/tests/002.phpt index 5a9630bc2f..bfec8c7aca 100644 --- a/ext/mysqli/tests/002.phpt +++ b/ext/mysqli/tests/002.phpt @@ -1,35 +1,35 @@ --TEST-- -mysqli bind_result 1 +mysqli bind_result 1 --SKIPIF-- --FILE-- --EXPECTF-- -array(7) { +array(8) { [0]=> int(5) [1]=> @@ -90,12 +92,14 @@ array(7) { int(0) [6]=> int(100) + [7]=> + int(4567) } 20123456 3123456789 done! --UEXPECTF-- -array(7) { +array(8) { [0]=> int(5) [1]=> @@ -110,7 +114,9 @@ array(7) { int(0) [6]=> int(100) + [7]=> + int(4567) } 20123456 3123456789 -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/020.phpt b/ext/mysqli/tests/020.phpt index 65ac2a0e16..cc33d2e4fd 100644 --- a/ext/mysqli/tests/020.phpt +++ b/ext/mysqli/tests/020.phpt @@ -18,11 +18,11 @@ mysqli bind_param/bind_result date mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); mysqli_query($link,"CREATE TABLE test_bind_result(c1 date, c2 time, - c3 timestamp(14), - c4 year, - c5 datetime, - c6 timestamp(4), - c7 timestamp(6))"); + c3 timestamp(14), + c4 year, + c5 datetime, + c6 timestamp(4), + c7 timestamp(6))"); $stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)"); mysqli_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7); diff --git a/ext/mysqli/tests/023.phpt b/ext/mysqli/tests/023.phpt index 97398001f8..d7bf23db72 100644 --- a/ext/mysqli/tests/023.phpt +++ b/ext/mysqli/tests/023.phpt @@ -14,12 +14,12 @@ mysqli bind_param/bind_prepare fetch long values mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned, - c2 int unsigned, - c3 int, - c4 int, - c5 int, - c6 int unsigned, - c7 int)"); + c2 int unsigned, + c3 int, + c4 int, + c5 int, + c6 int unsigned, + c7 int)"); $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); mysqli_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); diff --git a/ext/mysqli/tests/024.phpt b/ext/mysqli/tests/024.phpt index 58302b39d4..414a5a2b4b 100644 --- a/ext/mysqli/tests/024.phpt +++ b/ext/mysqli/tests/024.phpt @@ -14,12 +14,12 @@ mysqli bind_param/bind_result short values mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint)"); $stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)"); mysqli_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); diff --git a/ext/mysqli/tests/025.phpt b/ext/mysqli/tests/025.phpt index 8d3e2388e1..9cf0351ce3 100644 --- a/ext/mysqli/tests/025.phpt +++ b/ext/mysqli/tests/025.phpt @@ -14,12 +14,12 @@ mysqli bind_param/bind_result tinyint values mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 tinyint, - c2 tinyint unsigned, - c3 tinyint not NULL, - c4 tinyint, - c5 tinyint, - c6 tinyint unsigned, - c7 tinyint)"); + c2 tinyint unsigned, + c3 tinyint not NULL, + c4 tinyint, + c5 tinyint, + c6 tinyint unsigned, + c7 tinyint)"); $stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)"); mysqli_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7); diff --git a/ext/mysqli/tests/045.phpt b/ext/mysqli/tests/045.phpt index 36bb92a525..62c348bc75 100644 --- a/ext/mysqli/tests/045.phpt +++ b/ext/mysqli/tests/045.phpt @@ -31,6 +31,11 @@ mysqli_bind_result (SHOW) mysqli_bind_result($stmt, $c1, $c2); mysqli_fetch($stmt); mysqli_stmt_close($stmt); + if (ini_get("unicode.semantics") && mysqli_get_server_version($link) < 50000) { + /* variables are binary */ + settype($c1, "unicode"); + settype($c2, "unicode"); + } $test = array ($c1,$c2); var_dump($test); @@ -53,4 +58,4 @@ array(2) { [1]=> unicode(%d) "%s" } -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/048.phpt b/ext/mysqli/tests/048.phpt index d713947763..8da3e4544d 100644 --- a/ext/mysqli/tests/048.phpt +++ b/ext/mysqli/tests/048.phpt @@ -12,13 +12,13 @@ mysqli bind_result (OO-Style) $mysql->select_db($db); $mysql->query("DROP TABLE IF EXISTS test_fetch_null"); - $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, - col3 int, col4 bigint, - col5 float, col6 double, - col7 date, col8 time, - col9 varbinary(10), - col10 varchar(50), - col11 char(20))"); + $mysql->query("CREATE TABLE test_fetch_null(col1 tinyint, col2 smallint, + col3 int, col4 bigint, + col5 float, col6 double, + col7 date, col8 time, + col9 varbinary(10), + col10 varchar(50), + col11 char(20))"); $mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)"); diff --git a/ext/mysqli/tests/060.phpt b/ext/mysqli/tests/060.phpt index 805bf569cd..d77dca0342 100644 --- a/ext/mysqli/tests/060.phpt +++ b/ext/mysqli/tests/060.phpt @@ -20,12 +20,12 @@ mysqli_fetch_object with classes mysqli_query($link,"DROP TABLE IF EXISTS test_fetch"); mysqli_query($link,"CREATE TABLE test_fetch(c1 smallint unsigned, - c2 smallint unsigned, - c3 smallint, - c4 smallint, - c5 smallint, - c6 smallint unsigned, - c7 smallint)"); + c2 smallint unsigned, + c3 smallint, + c4 smallint, + c5 smallint, + c6 smallint unsigned, + c7 smallint)"); mysqli_query($link, "INSERT INTO test_fetch VALUES ( -23, 35999, NULL, -500, -9999999, -0, 0)"); diff --git a/ext/mysqli/tests/065.phpt b/ext/mysqli/tests/065.phpt index 80e3bbf92b..8f24152cfe 100644 --- a/ext/mysqli/tests/065.phpt +++ b/ext/mysqli/tests/065.phpt @@ -1,8 +1,8 @@ --TEST-- -set character set +set character set --SKIPIF-- -set_charset("latin1")) { /* 5C should be escaped */ if (3 !== ($tmp = strlen($mysql->real_escape_string($esc_str)))) - printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp); - + printf("[003] Expecting 3/int got %s/%s\n", gettype($tmp), $tmp); + if ('latin1' !== ($tmp = $mysql->client_encoding())) - printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp); + printf("[004] Expecting latin1/string got %s/%s\n", gettype($tmp), $tmp); } if ($res = $mysql->query("SHOW CHARACTER SET LIKE 'gbk'")) { - $res->free_result(); - if ($mysql->set_charset("gbk")) { - /* nothing should be escaped, it's a valid gbk character */ - - if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str)))) - printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp); - - if ('gbk' !== ($tmp = $mysql->client_encoding())) - printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp);; - } + $res->free_result(); + if ($mysql->set_charset("gbk")) { + /* nothing should be escaped, it's a valid gbk character */ + + if (2 !== ($tmp = strlen($mysql->real_escape_string($esc_str)))) + printf("[005] Expecting 2/int got %s/%s\n", gettype($tmp), $tmp); + + if ('gbk' !== ($tmp = $mysql->client_encoding())) + printf("[005] Expecting gbk/string got %s/%s\n", gettype($tmp), $tmp);; + } } $mysql->close(); - - print "done!"; + + print "done!"; ?> --EXPECT-- done! \ No newline at end of file diff --git a/ext/mysqli/tests/067.phpt b/ext/mysqli/tests/067.phpt index fd6016bd59..b7e457f298 100644 --- a/ext/mysqli/tests/067.phpt +++ b/ext/mysqli/tests/067.phpt @@ -10,9 +10,9 @@ function test: nested selects (cursors) /* skip cursor test for versions < 50004 */ if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) || - (mysqli_get_server_version($link) < 50009)) { - die(sprintf("skip Client library doesn't support cursors (%s/%s)", - mysqli_get_client_version(), mysqli_get_server_version($link)); + (mysqli_get_server_version($link) < 50009)) { + die(sprintf("skip Client library doesn't support cursors (%s/%s)", + mysqli_get_client_version(), mysqli_get_server_version($link)); } mysqli_close($link); ?> @@ -21,8 +21,8 @@ function test: nested selects (cursors) function open_cursor($mysql, $query) { if (!is_object($stmt = $mysql->prepare($query))) { - printf("[001] Cannot create statement object for '%s', [%d] %s\n", - $query, $mysql->errno, $mysql->error); + printf("[001] Cannot create statement object for '%s', [%d] %s\n", + $query, $mysql->errno, $mysql->error); } $stmt->attr_set(MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_READ_ONLY); @@ -30,11 +30,16 @@ function test: nested selects (cursors) } include "connect.inc"; - $a = array(); - - /*** test mysqli_connect 127.0.0.1 ***/ $mysql = new mysqli($host, $user, $passwd, $db, $port, $socket); + if ((!$IS_MYSQLND && mysqli_get_client_version() < 50009) || + (mysqli_get_server_version($mysql) < 50009)) { + /* we really want to skip it... */ + die(var_dump(63)); + } + + $a = array(); + for ($i=0;$i < 3; $i++) { $mysql->query("DROP TABLE IF EXISTS cursor$i"); $mysql->query("CREATE TABLE cursor$i (a int not null) ENGINE=" . $engine); diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc index 8b86355564..5db701d93b 100644 --- a/ext/mysqli/tests/connect.inc +++ b/ext/mysqli/tests/connect.inc @@ -1,11 +1,11 @@ \ No newline at end of file diff --git a/ext/mysqli/tests/skipif.inc b/ext/mysqli/tests/skipif.inc index 5562aab84b..a7581fb480 100644 --- a/ext/mysqli/tests/skipif.inc +++ b/ext/mysqli/tests/skipif.inc @@ -2,4 +2,4 @@ if (!extension_loaded('mysqli')){ die('skip mysqli extension not available'); } -?> +?> \ No newline at end of file diff --git a/ext/mysqli/tests/skipifemb.inc b/ext/mysqli/tests/skipifemb.inc index 298c7219a6..254a4ccece 100644 --- a/ext/mysqli/tests/skipifemb.inc +++ b/ext/mysqli/tests/skipifemb.inc @@ -1,5 +1,5 @@ embedded) - die("skip test doesn't run with embedded server"); -?> + $driver = new mysqli_driver(); + if ($driver->embedded) + die("skip test doesn't run with embedded server"); +?> \ No newline at end of file diff --git a/ext/mysqli/tests/skipifnotemb.inc b/ext/mysqli/tests/skipifnotemb.inc index 8639130cbe..d73d185bc4 100644 --- a/ext/mysqli/tests/skipifnotemb.inc +++ b/ext/mysqli/tests/skipifnotemb.inc @@ -1,5 +1,5 @@ embedded) - die("skip test for with embedded server only"); -?> + $driver = new mysqli_driver(); + if (!$driver->embedded) + die("skip test for with embedded server only"); +?> \ No newline at end of file diff --git a/ext/mysqli/tests/table.inc b/ext/mysqli/tests/table.inc index 142053cbed..bfbbed7102 100644 --- a/ext/mysqli/tests/table.inc +++ b/ext/mysqli/tests/table.inc @@ -2,22 +2,22 @@ require_once('connect.inc'); if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { - printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", - $host, $user, $db, $port, $socket); - exit(1); -} - + printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", + $host, $user, $db, $port, $socket); + exit(1); +} + if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { - printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - exit(1); -} - + printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + exit(1); +} + if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) { - printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - exit(1); + printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + exit(1); } if (!mysqli_query($link, 'INSERT INTO test(id, label) VALUES (1, "a"), (2, "b"), (3, "c"), (4, "d"), (5, "e"), (6, "f")')) { - printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); + printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link)); } ?> \ No newline at end of file -- 2.50.1