Annotation of embedaddon/php/ext/mysqli/tests/004.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli fetch char/text
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: include ("connect.inc");
! 11:
! 12: /*** test mysqli_connect 127.0.0.1 ***/
! 13: $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
! 14:
! 15: mysqli_select_db($link, $db);
! 16:
! 17: if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
! 18: printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 19:
! 20: if (!mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
! 21: printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 22:
! 23: if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test0')"))
! 24: printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 25:
! 26: if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567891', 'this is a test1')"))
! 27: printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 28:
! 29: if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567892', 'this is a test2')"))
! 30: printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 31:
! 32: if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567893', 'this is a test3')"))
! 33: printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 34:
! 35: if (!$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch ORDER BY c1"))
! 36: printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 37:
! 38: $c1 = $c2 = NULL;
! 39: mysqli_stmt_bind_result($stmt, $c1, $c2);
! 40: mysqli_stmt_execute($stmt);
! 41: $i = 4;
! 42: while ($i--) {
! 43: mysqli_stmt_fetch($stmt);
! 44: $test = array($c1, $c2);
! 45: var_dump($test);
! 46: }
! 47:
! 48: mysqli_stmt_close($stmt);
! 49: mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
! 50: mysqli_close($link);
! 51: print "done!";
! 52: ?>
! 53: --CLEAN--
! 54: <?php
! 55: require_once("connect.inc");
! 56: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
! 57: printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
! 58:
! 59: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
! 60: printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 61:
! 62: mysqli_close($link);
! 63: ?>
! 64: --EXPECTF--
! 65: array(2) {
! 66: [0]=>
! 67: %unicode|string%(10) "1234567890"
! 68: [1]=>
! 69: %unicode|string%(15) "this is a test0"
! 70: }
! 71: array(2) {
! 72: [0]=>
! 73: %unicode|string%(10) "1234567891"
! 74: [1]=>
! 75: %unicode|string%(15) "this is a test1"
! 76: }
! 77: array(2) {
! 78: [0]=>
! 79: %unicode|string%(10) "1234567892"
! 80: [1]=>
! 81: %unicode|string%(15) "this is a test2"
! 82: }
! 83: array(2) {
! 84: [0]=>
! 85: %unicode|string%(10) "1234567893"
! 86: [1]=>
! 87: %unicode|string%(15) "this is a test3"
! 88: }
! 89: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>