uw Thu Jul 12 20:42:48 2007 UTC Modified files: /php-src/ext/mysqli/tests 010.phpt 011.phpt 012.phpt 013.phpt 014.phpt 015.phpt 016.phpt 017.phpt 018.phpt 019.phpt Log: Next 10 in row to be tweaked: - take connection parameter from connect.inc - use proper UEXPECTF - have 'print "done!"' or similar at the end to detect crashes - whitespace changes where needed - take care of portability: PHP 5 vs. PHP 5, MySQL 4.1 - 6.0 - understand return value checking as sometime that makes you type more when you write but makes you happy when you debug
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/010.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/mysqli/tests/010.phpt diff -u php-src/ext/mysqli/tests/010.phpt:1.6 php-src/ext/mysqli/tests/010.phpt:1.7 --- php-src/ext/mysqli/tests/010.phpt:1.6 Wed Jan 4 23:04:06 2006 +++ php-src/ext/mysqli/tests/010.phpt Thu Jul 12 20:42:48 2007 @@ -9,20 +9,23 @@ include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, "test"); - mysqli_query($link, "SET sql_mode=''"); + if (!mysqli_query($link, "SET sql_mode=''")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"); - - mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 float(3), - c2 float, - c3 float unsigned, - c4 float, - c5 float, - c6 float, - c7 float(10) unsigned)"); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3), + c2 float, + c3 float unsigned, + c4 float, + c5 float, + c6 float, + c7 float(10) unsigned) ENGINE=" . $engine); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999, @@ -39,6 +42,7 @@ mysqli_stmt_close($stmt); mysqli_close($link); + print "done!"; ?> --EXPECT-- array(7) { @@ -57,3 +61,4 @@ [6]=> float(888888914608000) } +done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/011.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/mysqli/tests/011.phpt diff -u php-src/ext/mysqli/tests/011.phpt:1.6 php-src/ext/mysqli/tests/011.phpt:1.7 --- php-src/ext/mysqli/tests/011.phpt:1.6 Tue Sep 26 13:06:13 2006 +++ php-src/ext/mysqli/tests/011.phpt Thu Jul 12 20:42:48 2007 @@ -9,21 +9,25 @@ include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, "test"); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); - - mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(50))"); - - mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999, - 2345.6,5678.89563, - 'foobar','mysql rulez')"); + $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 float, c6 double, + c7 varbinary(10), + c8 varchar(50)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + $rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999, + 2345.6,5678.89563, + 'foobar','mysql rulez')"); + if (!$rc) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); mysqli_execute($stmt); @@ -35,6 +39,7 @@ mysqli_stmt_close($stmt); mysqli_close($link); + print "done!"; ?> --EXPECTF-- array(8) { @@ -51,7 +56,28 @@ [5]=> float(5678.89563) [6]=> - %s(6) "foobar" + string(6) "foobar" + [7]=> + string(11) "mysql rulez" +} +done! +--UEXPECTF-- +array(8) { + [0]=> + int(19) + [1]=> + int(2999) + [2]=> + int(3999) + [3]=> + int(4999999) + [4]=> + float(2345.60009766) + [5]=> + float(5678.89563) + [6]=> + string(6) "foobar" [7]=> - %s(11) "mysql rulez" + unicode(11) "mysql rulez" } +done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/012.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/mysqli/tests/012.phpt diff -u php-src/ext/mysqli/tests/012.phpt:1.6 php-src/ext/mysqli/tests/012.phpt:1.7 --- php-src/ext/mysqli/tests/012.phpt:1.6 Tue Sep 26 13:06:13 2006 +++ php-src/ext/mysqli/tests/012.phpt Thu Jul 12 20:42:48 2007 @@ -7,23 +7,25 @@ --FILE-- <?php include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); - - mysqli_select_db($link, "test"); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 float, c6 double, - c7 varbinary(10), - c8 varchar(10))"); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')"); + $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 float, c6 double, + c7 varbinary(10), + c8 varchar(10)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54, + 2.6,58.89, + '206','6.7')")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8); @@ -36,6 +38,7 @@ mysqli_stmt_close($stmt); mysqli_close($link); + print "done!"; ?> --EXPECTF-- array(8) { @@ -52,7 +55,28 @@ [5]=> float(58.89) [6]=> - %s(3) "206" + string(3) "206" + [7]=> + string(3) "6.7" +} +done! +--UEXPECTF-- +array(8) { + [0]=> + int(120) + [1]=> + int(2999) + [2]=> + int(3999) + [3]=> + int(54) + [4]=> + float(2.59999990463) + [5]=> + float(58.89) + [6]=> + string(3) "206" [7]=> - %s(3) "6.7" + unicode(3) "6.7" } +done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/013.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/mysqli/tests/013.phpt diff -u php-src/ext/mysqli/tests/013.phpt:1.6 php-src/ext/mysqli/tests/013.phpt:1.7 --- php-src/ext/mysqli/tests/013.phpt:1.6 Tue Jul 18 00:09:21 2006 +++ php-src/ext/mysqli/tests/013.phpt Thu Jul 12 20:42:48 2007 @@ -5,48 +5,53 @@ --FILE-- <?php include "connect.inc"; - - /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); - mysqli_select_db($link, "test"); + /*** test mysqli_connect 127.0.0.1 ***/ + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result"); + if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, - c3 int, c4 bigint, - c5 decimal(4,2), c6 double, - c7 varbinary(10), - c8 varchar(10))"); + $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint, + c3 int, c4 bigint, + c5 decimal(4,2), c6 double, + c7 varbinary(10), + c8 varchar(10)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54, + 2.6,58.89, + '206','6.7')")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54, - 2.6,58.89, - '206','6.7')"); $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result"); $c = array(0,0,0,0,0,0,0,0); $b_res= mysqli_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]); mysqli_execute($stmt); - mysqli_fetch($stmt); - mysqli_fetch($stmt); + mysqli_fetch($stmt); + mysqli_fetch($stmt); mysqli_stmt_close($stmt); $result = mysqli_query($link, "select * from test_bind_result"); - $d = mysqli_fetch_row($result); + $d = mysqli_fetch_row($result); mysqli_free_result($result); $test = ""; for ($i=0; $i < count($c); $i++) - $test .= ($c[0] == $d[0]) ? "1" : "0"; + $test .= ($c[$i] == $d[$i]) ? "1" : "0"; if ($test == "11111111") - echo "ok"; + echo "ok\n"; else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 && - mysqli_get_server_version($link) > 50000) + mysqli_get_server_version($link) > 50000) echo "error (4.1 library with 5.x server)"; else echo "error"; mysqli_close($link); + print "done!"; ?> --EXPECTF-- ok +done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/014.phpt?r1=1.11&r2=1.12&diff_format=u Index: php-src/ext/mysqli/tests/014.phpt diff -u php-src/ext/mysqli/tests/014.phpt:1.11 php-src/ext/mysqli/tests/014.phpt:1.12 --- php-src/ext/mysqli/tests/014.phpt:1.11 Tue Sep 26 13:06:13 2006 +++ php-src/ext/mysqli/tests/014.phpt Thu Jul 12 20:42:48 2007 @@ -1,12 +1,16 @@ --TEST-- -mysqli autocommit/commit/rollback +mysqli autocommit/commit/rollback --SKIPIF-- <?php require_once('skipif.inc'); include "connect.inc"; - $link = mysqli_connect($host, $user, $passwd); - $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'"); - $row = mysqli_fetch_row($result); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); + if (!$result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'")) { + die("skip Cannot check for required InnoDB suppot"); + } + if (!$row = mysqli_fetch_row($result)) + die("skip Cannot check for required InnoDB suppot"); + mysqli_free_result($result); mysqli_close($link); if ($row[1] == "DISABLED" || $row[1] == "NO") { @@ -17,53 +21,92 @@ --FILE-- <?php include "connect.inc"; - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); + + if (!mysqli_autocommit($link, TRUE)) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "DROP TABLE IF EXISTS ac_01")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "CREATE TABLE ac_01(a int, b varchar(10)) type=InnoDB")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_select_db($link, "test"); + if (!mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_autocommit($link, TRUE); + if (!mysqli_autocommit($link, FALSE)) + printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link,"DROP TABLE IF EXISTS ac_01"); + if (!mysqli_query($link, "DELETE FROM ac_01")) + printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10)) type=InnoDB"); + if (!mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')")) + printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')"); - mysqli_autocommit($link, FALSE); - mysqli_query($link, "DELETE FROM ac_01"); - mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"); + if (!mysqli_rollback($link)) + printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_rollback($link); + if (!$result = mysqli_query($link, "SELECT * FROM ac_01")) + printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $result = mysqli_query($link, "SELECT * FROM ac_01"); printf("Num_of_rows=%d\n", mysqli_num_rows($result)); - $row = mysqli_fetch_row($result); + if (!$row = mysqli_fetch_row($result)) + printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_free_result($result); var_dump($row); - mysqli_query($link, "DELETE FROM ac_01"); - mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"); - mysqli_commit($link); + if (!mysqli_query($link, "DELETE FROM ac_01")) + printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')")) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!mysqli_commit($link)) + printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$result = mysqli_query($link, "SELECT * FROM ac_01")) + printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + + if (!$row = mysqli_fetch_row($result)) + printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $result = mysqli_query($link, "SELECT * FROM ac_01"); - $row = mysqli_fetch_row($result); mysqli_free_result($result); var_dump($row); mysqli_close($link); + print "done!"; ?> --EXPECTF-- Num_of_rows=1 array(2) { [0]=> - %s(1) "1" + string(1) "1" + [1]=> + string(6) "foobar" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(4) "egon" +} +done! +--UEXPECTF-- +Num_of_rows=1 +array(2) { + [0]=> + unicode(1) "1" [1]=> - %s(6) "foobar" + unicode(6) "foobar" } array(2) { [0]=> - %s(1) "2" + unicode(1) "2" [1]=> - %s(4) "egon" + unicode(4) "egon" } +done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/015.phpt?r1=1.6&r2=1.7&diff_format=u Index: php-src/ext/mysqli/tests/015.phpt diff -u php-src/ext/mysqli/tests/015.phpt:1.6 php-src/ext/mysqli/tests/015.phpt:1.7 --- php-src/ext/mysqli/tests/015.phpt:1.6 Tue Sep 26 13:06:13 2006 +++ php-src/ext/mysqli/tests/015.phpt Thu Jul 12 20:42:48 2007 @@ -1,15 +1,15 @@ --TEST-- -mysqli autocommit/commit/rollback with myisam +mysqli autocommit/commit/rollback with innodb --SKIPIF-- -<?php +<?php require_once('skipif.inc'); include "connect.inc"; - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); $result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'"); $row = mysqli_fetch_row($result); mysqli_free_result($result); mysqli_close($link); - + if ($row[1] == "NO") { printf ("skip innodb support not installed."); } @@ -17,16 +17,16 @@ --FILE-- <?php include "connect.inc"; - - $link = mysqli_connect($host, $user, $passwd); - mysqli_select_db($link, "test"); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); + + mysqli_select_db($link, $db); mysqli_autocommit($link, TRUE); mysqli_query($link,"DROP TABLE IF EXISTS ac_01"); - mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10))"); + mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10)) Engine=InnoDB"); mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')"); mysqli_autocommit($link, FALSE); @@ -36,7 +36,7 @@ mysqli_rollback($link); - $result = mysqli_query($link, "SELECT * FROM ac_01"); + $result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM ac_01"); $row = mysqli_fetch_row($result); mysqli_free_result($result); @@ -53,17 +53,33 @@ var_dump($row); mysqli_close($link); + print "done!"; ?> --EXPECTF-- array(2) { [0]=> - %s(1) "2" + string(1) "1" + [1]=> + string(6) "foobar" +} +array(2) { + [0]=> + string(1) "2" + [1]=> + string(4) "egon" +} +done! +--UEXPECTF-- +array(2) { + [0]=> + unicode(1) "1" [1]=> - %s(4) "egon" + unicode(6) "foobar" } array(2) { [0]=> - %s(1) "2" + unicode(1) "2" [1]=> - %s(4) "egon" + unicode(4) "egon" } +done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/016.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/mysqli/tests/016.phpt diff -u php-src/ext/mysqli/tests/016.phpt:1.5 php-src/ext/mysqli/tests/016.phpt:1.6 --- php-src/ext/mysqli/tests/016.phpt:1.5 Tue Sep 26 13:06:13 2006 +++ php-src/ext/mysqli/tests/016.phpt Thu Jul 12 20:42:48 2007 @@ -7,13 +7,14 @@ include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, "test"); + if (!mysqli_query($link, "SET @dummy='foobar'")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link, "SET @dummy='foobar'"); - - $stmt = mysqli_prepare($link, "SELECT @dummy"); + if (!$stmt = mysqli_prepare($link, "SELECT @dummy")) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_bind_result($stmt, $dummy); mysqli_execute($stmt); mysqli_fetch($stmt); @@ -22,6 +23,11 @@ mysqli_stmt_close($stmt); mysqli_close($link); + print "done!"; ?> --EXPECTF-- -%s(6) "foobar" +string(6) "foobar" +done! +--UEXPECTF-- +unicode(6) "foobar" +done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/017.phpt?r1=1.9&r2=1.10&diff_format=u Index: php-src/ext/mysqli/tests/017.phpt diff -u php-src/ext/mysqli/tests/017.phpt:1.9 php-src/ext/mysqli/tests/017.phpt:1.10 --- php-src/ext/mysqli/tests/017.phpt:1.9 Tue Sep 26 13:06:13 2006 +++ php-src/ext/mysqli/tests/017.phpt Thu Jul 12 20:42:48 2007 @@ -8,11 +8,11 @@ include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, "test"); + if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"); mysqli_bind_result($stmt, $c0, $c1, $c2); mysqli_execute($stmt); @@ -20,16 +20,31 @@ mysqli_stmt_close($stmt); $test = array($c0, $c1, $c2); + if ($c1 !== $db) { + echo "Different data\n"; + } var_dump($test); mysqli_close($link); + print "done!"; ?> --EXPECTF-- array(3) { [0]=> - %s(32) "37b51d194a7513e45b56f6524f2d51f2" + string(32) "37b51d194a7513e45b56f6524f2d51f2" [1]=> - %s(4) "test" + string(%d) "%s" [2]=> - %s(3) "foo" + string(3) "foo" } +done! +--UEXPECTF-- +array(3) { + [0]=> + string(32) "37b51d194a7513e45b56f6524f2d51f2" + [1]=> + unicode(%d) "%s" + [2]=> + unicode(3) "foo" +} +done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/018.phpt?r1=1.4&r2=1.5&diff_format=u Index: php-src/ext/mysqli/tests/018.phpt diff -u php-src/ext/mysqli/tests/018.phpt:1.4 php-src/ext/mysqli/tests/018.phpt:1.5 --- php-src/ext/mysqli/tests/018.phpt:1.4 Sat Dec 4 08:50:33 2004 +++ php-src/ext/mysqli/tests/018.phpt Thu Jul 12 20:42:48 2007 @@ -5,16 +5,17 @@ --FILE-- <?php include "connect.inc"; - + /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, "test"); + if (!mysqli_query($link, "SET AUTOCOMMIT=0")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_query($link, "SET AUTOCOMMIT=0"); + if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt = mysqli_prepare($link, "SELECT @@autocommit"); - mysqli_bind_result($stmt, $c0); + mysqli_bind_result($stmt, $c0); mysqli_execute($stmt); mysqli_fetch($stmt); @@ -22,6 +23,8 @@ var_dump($c0); mysqli_close($link); + print "done!"; ?> --EXPECT-- int(0) +done! \ No newline at end of file http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/019.phpt?r1=1.8&r2=1.9&diff_format=u Index: php-src/ext/mysqli/tests/019.phpt diff -u php-src/ext/mysqli/tests/019.phpt:1.8 php-src/ext/mysqli/tests/019.phpt:1.9 --- php-src/ext/mysqli/tests/019.phpt:1.8 Fri May 18 11:47:31 2007 +++ php-src/ext/mysqli/tests/019.phpt Thu Jul 12 20:42:48 2007 @@ -2,27 +2,29 @@ mysqli fetch (bind_param + bind_result) --SKIPIF-- <?php require_once('skipif.inc'); ?> ---INI-- -precision=14 --FILE-- <?php include "connect.inc"; /*** test mysqli_connect 127.0.0.1 ***/ - $link = mysqli_connect($host, $user, $passwd); + $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); - mysqli_select_db($link, "test"); - $rc = mysqli_query($link,"DROP TABLE IF EXISTS insert_read"); + if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read")) + printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $rc = mysqli_query($link,"CREATE TABLE insert_read(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))"); + $rc = mysqli_query($link,"CREATE TABLE insert_read(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)) ENGINE=" . $engine); + if (!$rc) + printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - $stmt= mysqli_prepare($link,"INSERT INTO insert_read(col1,col10, col11, col6) VALUES(?,?,?,?)"); + if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES(?,?,?,?)")) + printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_bind_param($stmt, "issd", $c1, $c2, $c3, $c4); $c1 = 1; @@ -33,7 +35,9 @@ mysqli_execute($stmt); mysqli_stmt_close($stmt); - $stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read"); + if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read")) + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11); mysqli_execute($stmt); @@ -45,6 +49,7 @@ mysqli_stmt_close($stmt); mysqli_close($link); + print "done!"; ?> --EXPECTF-- array(11) { @@ -67,7 +72,34 @@ [8]=> NULL [9]=> - %s(3) "foo" + string(3) "foo" + [10]=> + string(6) "foobar" +} +done! +--UEXPECTF-- +array(11) { + [0]=> + int(1) + [1]=> + NULL + [2]=> + NULL + [3]=> + NULL + [4]=> + NULL + [5]=> + float(3.14) + [6]=> + NULL + [7]=> + NULL + [8]=> + NULL + [9]=> + unicode(3) "foo" [10]=> - %s(6) "foobar" + unicode(6) "foobar" } +done! \ No newline at end of file
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php