Annotation of embedaddon/php/ext/mysqli/tests/010.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: mysqli fetch float values
! 3: --INI--
! 4: precision=12
! 5: --SKIPIF--
! 6: <?php
! 7: require_once('skipif.inc');
! 8: require_once('skipifconnectfailure.inc');
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: require_once("connect.inc");
! 13:
! 14: /*** test mysqli_connect 127.0.0.1 ***/
! 15: $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
! 16:
! 17: if (!mysqli_query($link, "SET sql_mode=''"))
! 18: printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 19:
! 20: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
! 21: printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 22:
! 23: $rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
! 24: c2 float,
! 25: c3 float unsigned,
! 26: c4 float,
! 27: c5 float,
! 28: c6 float,
! 29: c7 float(10) unsigned) ENGINE=" . $engine);
! 30: if (!$rc)
! 31: printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 32:
! 33:
! 34: mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
! 35: sin(0.6), 1.00000000000001, 888888888888888)");
! 36:
! 37: $stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
! 38: mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
! 39: mysqli_stmt_execute($stmt);
! 40: mysqli_stmt_fetch($stmt);
! 41:
! 42: $test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
! 43:
! 44: var_dump($test);
! 45:
! 46: mysqli_stmt_close($stmt);
! 47: mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
! 48: mysqli_close($link);
! 49: print "done!";
! 50: ?>
! 51: --CLEAN--
! 52: <?php
! 53: require_once("connect.inc");
! 54: if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
! 55: printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
! 56:
! 57: if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
! 58: printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
! 59:
! 60: mysqli_close($link);
! 61: ?>
! 62: --EXPECT--
! 63: array(7) {
! 64: [0]=>
! 65: float(3.14159274101)
! 66: [1]=>
! 67: float(-9.99999997475E-7)
! 68: [2]=>
! 69: float(0)
! 70: [3]=>
! 71: float(999999995904)
! 72: [4]=>
! 73: float(0.564642488956)
! 74: [5]=>
! 75: float(1)
! 76: [6]=>
! 77: float(8.88888914608E+14)
! 78: }
! 79: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>