Skip to content

Commit b0cae30

Browse files
Update ext/mysqli/tests/bind_fetch/varied_data_types.phpt
Co-authored-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent d9b478c commit b0cae30

File tree

1 file changed

+36
-33
lines changed

1 file changed

+36
-33
lines changed

ext/mysqli/tests/bind_fetch/varied_data_types.phpt

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,69 @@ mysqli_check_skip_test();
1111
<?php
1212
require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
1313

14-
$link = default_mysqli_connect();
14+
$link = default_mysqli_connect();
1515

16-
mysqli_query(
17-
$link,
18-
"CREATE TABLE test_bind_fetch_varied(
19-
col1 tinyint, col2 smallint,
20-
col3 int, col4 bigint,
21-
col5 float, col6 double,
22-
col7 date, col8 time,
23-
col9 varbinary(10),
24-
col10 varchar(50),
25-
col11 char(20)
26-
) ENGINE=" . get_default_db_engine()
27-
);
16+
mysqli_query(
17+
$link,
18+
"CREATE TABLE test_bind_fetch_varied(
19+
col1 tinyint, col2 smallint,
20+
col3 int, col4 bigint,
21+
col5 float, col6 double,
22+
col7 date, col8 time,
23+
col9 varbinary(10),
24+
col10 varchar(50),
25+
col11 char(20),
26+
col12 char(3) DEFAULT NULL
27+
) ENGINE=" . get_default_db_engine()
28+
);
2829

29-
mysqli_query($link, "INSERT INTO test_bind_fetch_varied(col1,col10, col11)
30-
VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
30+
mysqli_query($link, "INSERT INTO test_bind_fetch_varied
31+
VALUES(1, 2, 3, 4, 5.1, 6.2, '2020-02-21', '11:04', '111', 'foo1', 1000, null)");
3132

32-
$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_bind_fetch_varied ORDER BY col1");
33-
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
34-
mysqli_stmt_execute($stmt);
33+
$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12 from test_bind_fetch_varied ORDER BY col1");
34+
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11, $c12);
35+
mysqli_stmt_execute($stmt);
3536

36-
mysqli_stmt_fetch($stmt);
37+
mysqli_stmt_fetch($stmt);
3738

38-
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11);
39+
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7,$c8,$c9,$c10,$c11,$c12);
3940

40-
var_dump($test);
41+
var_dump($test);
4142

42-
mysqli_stmt_close($stmt);
43-
mysqli_close($link);
44-
print "done!";
43+
mysqli_stmt_close($stmt);
44+
mysqli_close($link);
45+
print "done!";
4546
?>
4647
--CLEAN--
4748
<?php
4849
require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
4950
tear_down_table_on_default_connection('test_bind_fetch_varied');
5051
?>
5152
--EXPECT--
52-
array(11) {
53+
array(12) {
5354
[0]=>
5455
int(1)
5556
[1]=>
56-
NULL
57+
int(2)
5758
[2]=>
58-
NULL
59+
int(3)
5960
[3]=>
60-
NULL
61+
int(4)
6162
[4]=>
62-
NULL
63+
float(5.1)
6364
[5]=>
64-
NULL
65+
float(6.2)
6566
[6]=>
66-
NULL
67+
string(10) "2020-02-21"
6768
[7]=>
68-
NULL
69+
string(8) "11:04:00"
6970
[8]=>
70-
NULL
71+
string(3) "111"
7172
[9]=>
7273
string(4) "foo1"
7374
[10]=>
7475
string(4) "1000"
76+
[11]=>
77+
NULL
7578
}
7679
done!

0 commit comments

Comments
 (0)