xref: /PHP-7.2/ext/oci8/tests/fetch_all.phpt (revision 37652336)
1--TEST--
2oci_fetch_all()
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--FILE--
6<?php
7
8require(dirname(__FILE__)."/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/* ocifetchstatement */
34if (!oci_execute($s)) {
35	die("oci_execute(select) failed!\n");
36}
37
38var_dump(ocifetchstatement($s, $all));
39var_dump($all);
40
41// Cleanup
42
43$stmtarray = array(
44    "drop table fetch_all_tab"
45);
46
47oci8_test_sql_execute($c, $stmtarray);
48
49echo "Done\n";
50?>
51--EXPECTF--
52int(3)
53array(2) {
54  ["ID"]=>
55  array(3) {
56    [0]=>
57    string(1) "1"
58    [1]=>
59    string(1) "1"
60    [2]=>
61    string(1) "1"
62  }
63  ["VALUE"]=>
64  array(3) {
65    [0]=>
66    string(1) "1"
67    [1]=>
68    string(1) "1"
69    [2]=>
70    string(1) "1"
71  }
72}
73int(3)
74array(2) {
75  ["ID"]=>
76  array(3) {
77    [0]=>
78    string(1) "1"
79    [1]=>
80    string(1) "1"
81    [2]=>
82    string(1) "1"
83  }
84  ["VALUE"]=>
85  array(3) {
86    [0]=>
87    string(1) "1"
88    [1]=>
89    string(1) "1"
90    [2]=>
91    string(1) "1"
92  }
93}
94Done
95