xref: /PHP-5.6/ext/mysqli/tests/006.phpt (revision 389965f1)
1--TEST--
2mysqli fetch long values
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_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, "SET sql_mode=''"))
16		printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
17
18	if (!mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch"))
19		printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
20
21	$rc = mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 int unsigned,
22													c2 int unsigned,
23													c3 int,
24													c4 int,
25													c5 int,
26													c6 int unsigned,
27													c7 int) ENGINE=" . $engine);
28	if (!$rc)
29		printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
30
31	if (!mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)"))
32		printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
33
34	$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
35	mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
36	mysqli_stmt_execute($stmt);
37	mysqli_stmt_fetch($stmt);
38
39	$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
40
41	var_dump($test);
42
43	mysqli_stmt_close($stmt);
44	mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch");
45	mysqli_close($link);
46	print "done!";
47?>
48--CLEAN--
49<?php
50require_once("connect.inc");
51if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
52   printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
53
54if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
55	printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
56
57mysqli_close($link);
58?>
59--EXPECT--
60array(7) {
61  [0]=>
62  int(0)
63  [1]=>
64  int(35999)
65  [2]=>
66  NULL
67  [3]=>
68  int(-500)
69  [4]=>
70  int(-9999999)
71  [5]=>
72  int(0)
73  [6]=>
74  int(0)
75}
76done!