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