Annotation of embedaddon/php/ext/mysqli/tests/005.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli fetch char/text long
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifconnectfailure.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10: require_once("connect.inc");
! 11:
! 12: /*** test mysqli_connect 127.0.0.1 ***/
! 13: $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
! 14:
! 15: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
! 16: printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 17:
! 18: if (!mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 char(10), c2 text) ENGINE=" . $engine))
! 19: printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 20:
! 21: $a = str_repeat("A1", 32000);
! 22:
! 23: mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
! 24:
! 25: $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
! 26: mysqli_stmt_bind_result($stmt, $c1, $c2);
! 27: mysqli_stmt_execute($stmt);
! 28: mysqli_stmt_fetch($stmt);
! 29:
! 30: $test[] = $c1;
! 31: $test[] = ($a == $c2) ? "32K String ok" : "32K String failed";
! 32:
! 33: var_dump($test);
! 34:
! 35: /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */
! 36: mysqli_stmt_fetch($stmt);
! 37:
! 38: mysqli_stmt_close($stmt);
! 39: mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
! 40: mysqli_close($link);
! 41: print "done!";
! 42: ?>
! 43: --CLEAN--
! 44: <?php
! 45: require_once("connect.inc");
! 46: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
! 47: printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
! 48:
! 49: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
! 50: printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 51:
! 52: mysqli_close($link);
! 53: ?>
! 54: --EXPECTF--
! 55: array(2) {
! 56: [0]=>
! 57: %unicode|string%(10) "1234567890"
! 58: [1]=>
! 59: %unicode|string%(13) "32K String ok"
! 60: }
! 61: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>