Annotation of embedaddon/php/ext/mysqli/tests/013.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli fetch mixed / mysql_query (may fail when using 4.1 library with 5.x server)
! 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_result"))
! 16: printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 17:
! 18: $rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
! 19: c3 int, c4 bigint,
! 20: c5 decimal(4,2), c6 double,
! 21: c7 varbinary(10),
! 22: c8 varchar(10)) ENGINE=" . $engine);
! 23: if (!$rc)
! 24: printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 25:
! 26: if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
! 27: 2.6,58.89,
! 28: '206','6.7')"))
! 29: printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 30:
! 31: $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
! 32:
! 33: $c = array(0,0,0,0,0,0,0,0);
! 34: $b_res= mysqli_stmt_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
! 35: mysqli_stmt_execute($stmt);
! 36: mysqli_stmt_fetch($stmt);
! 37: mysqli_stmt_fetch($stmt);
! 38: mysqli_stmt_close($stmt);
! 39:
! 40: $result = mysqli_query($link, "select * from test_bind_result");
! 41: $d = mysqli_fetch_row($result);
! 42: mysqli_free_result($result);
! 43:
! 44: $test = "";
! 45: for ($i=0; $i < count($c); $i++)
! 46: $test .= ($c[$i] == $d[$i]) ? "1" : "0";
! 47: if ($test == "11111111")
! 48: echo "ok\n";
! 49: else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
! 50: mysqli_get_server_version($link) > 50000)
! 51: echo "error (4.1 library with 5.x server)";
! 52: else
! 53: echo "error";
! 54:
! 55: mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result");
! 56: mysqli_close($link);
! 57: print "done!";
! 58: ?>
! 59: --CLEAN--
! 60: <?php
! 61: require_once("connect.inc");
! 62: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
! 63: printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
! 64:
! 65: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
! 66: printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 67:
! 68: mysqli_close($link);
! 69: ?>
! 70: --EXPECTF--
! 71: ok
! 72: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>