Skip to content

Commit c40eff3

Browse files
author
Georg Richter
committed
test for mysqli_prepare_result
1 parent 3e45b23 commit c40eff3

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

ext/mysqli/tests/047.phpt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
--TEST--
2+
mysqli_prepare_result
3+
--FILE--
4+
<?php
5+
include "connect.inc";
6+
7+
/*** test mysqli_connect 127.0.0.1 ***/
8+
$link = mysqli_connect("localhost", $user, $passwd);
9+
10+
mysqli_select_db($link, "test");
11+
12+
mysqli_query($link, "DROP TABLE IF EXISTS test_affected");
13+
mysqli_query($link, "CREATE TABLE test_affected (foo int, bar varchar(10))");
14+
15+
mysqli_query($link, "INSERT INTO test_affected VALUES (1, 'Zak'),(2, 'Greant')");
16+
17+
$stmt = mysqli_prepare($link, "SELECT * FROM test_affected");
18+
mysqli_execute($stmt);
19+
$result = mysqli_prepare_result($stmt);
20+
21+
$fields = mysqli_fetch_fields($result);
22+
var_dump($fields);
23+
24+
mysqli_free_result($result);
25+
26+
mysqli_stmt_close($stmt);
27+
mysqli_close($link);
28+
?>
29+
--EXPECT--
30+
array(2) {
31+
[0]=>
32+
object()(9) {
33+
["name"]=>
34+
string(3) "foo"
35+
["orgname"]=>
36+
string(3) "foo"
37+
["table"]=>
38+
string(13) "test_affected"
39+
["orgtable"]=>
40+
string(13) "test_affected"
41+
["def"]=>
42+
string(0) ""
43+
["max_length"]=>
44+
int(0)
45+
["flags"]=>
46+
int(32768)
47+
["type"]=>
48+
int(3)
49+
["decimals"]=>
50+
int(0)
51+
}
52+
[1]=>
53+
object()(9) {
54+
["name"]=>
55+
string(3) "bar"
56+
["orgname"]=>
57+
string(3) "bar"
58+
["table"]=>
59+
string(13) "test_affected"
60+
["orgtable"]=>
61+
string(13) "test_affected"
62+
["def"]=>
63+
string(0) ""
64+
["max_length"]=>
65+
int(0)
66+
["flags"]=>
67+
int(0)
68+
["type"]=>
69+
int(253)
70+
["decimals"]=>
71+
int(0)
72+
}
73+
}

0 commit comments

Comments
 (0)