xref: /PHP-8.1/ext/oci8/tests/fetch_all1.phpt (revision 74859783)
1--TEST--
2oci_fetch_all()
3--EXTENSIONS--
4oci8
5--FILE--
6<?php
7
8require(__DIR__."/connect.inc");
9
10// Initialize
11
12$stmtarray = array(
13    "drop table fetch_all_tab",
14    "create table fetch_all_tab (id number, value number)",
15    "insert into fetch_all_tab (id, value) values (1,1)",
16    "insert into fetch_all_tab (id, value) values (1,1)",
17    "insert into fetch_all_tab (id, value) values (1,1)"
18);
19
20oci8_test_sql_execute($c, $stmtarray);
21
22if (!($s = oci_parse($c, "select * from fetch_all_tab"))) {
23    die("oci_parse(select) failed!\n");
24}
25
26/* oci_fetch_all */
27if (!oci_execute($s)) {
28    die("oci_execute(select) failed!\n");
29}
30var_dump(oci_fetch_all($s, $all));
31var_dump($all);
32
33// Cleanup
34
35$stmtarray = array(
36    "drop table fetch_all_tab"
37);
38
39oci8_test_sql_execute($c, $stmtarray);
40
41echo "Done\n";
42?>
43--EXPECT--
44int(3)
45array(2) {
46  ["ID"]=>
47  array(3) {
48    [0]=>
49    string(1) "1"
50    [1]=>
51    string(1) "1"
52    [2]=>
53    string(1) "1"
54  }
55  ["VALUE"]=>
56  array(3) {
57    [0]=>
58    string(1) "1"
59    [1]=>
60    string(1) "1"
61    [2]=>
62    string(1) "1"
63  }
64}
65Done
66