File tree Expand file tree Collapse file tree 1 file changed +71
-0
lines changed
Expand file tree Collapse file tree 1 file changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ SQLite3Result::fetchAll usage
3+ --EXTENSIONS--
4+ sqlite3
5+ --FILE--
6+ <?php
7+ $ conn = new sqlite3 (':memory: ' );
8+ $ conn ->query ('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id)) ' );
9+
10+ $ stmt = $ conn ->query ('insert into users (id, num) values (1, 1) ' );
11+ $ stmt = $ conn ->query ('insert into users (id, num) values (2, 2) ' );
12+
13+ $ stmt = $ conn ->query ('SELECT * FROM users ' );
14+ $ rowall = $ stmt ->fetchAll ();
15+ var_dump ($ rowall );
16+ $ rowfetch = [];
17+ while (($ row = $ stmt ->fetchArray ())) $ rowfetch [] = $ row ;
18+ var_dump ($ rowfetch );
19+ var_dump ($ rowall == $ rowfetch );
20+
21+ ?>
22+ --EXPECT--
23+ array(2) {
24+ [0]=>
25+ array(4) {
26+ [0]=>
27+ int(1)
28+ ["id"]=>
29+ int(1)
30+ [1]=>
31+ int(1)
32+ ["num"]=>
33+ int(1)
34+ }
35+ [1]=>
36+ array(4) {
37+ [0]=>
38+ int(2)
39+ ["id"]=>
40+ int(2)
41+ [1]=>
42+ int(2)
43+ ["num"]=>
44+ int(2)
45+ }
46+ }
47+ array(2) {
48+ [0]=>
49+ array(4) {
50+ [0]=>
51+ int(1)
52+ ["id"]=>
53+ int(1)
54+ [1]=>
55+ int(1)
56+ ["num"]=>
57+ int(1)
58+ }
59+ [1]=>
60+ array(4) {
61+ [0]=>
62+ int(2)
63+ ["id"]=>
64+ int(2)
65+ [1]=>
66+ int(2)
67+ ["num"]=>
68+ int(2)
69+ }
70+ }
71+ bool(true)
You can’t perform that action at this time.
0 commit comments