xref: /PHP-8.1/ext/oci8/tests/fetch.phpt (revision 74859783)
1--TEST--
2ocifetch() & ociresult()
3--EXTENSIONS--
4oci8
5--FILE--
6<?php
7
8require(__DIR__."/connect.inc");
9
10// Initialize
11
12$stmtarray = array(
13    "drop table fetch_tab",
14    "create table fetch_tab (id number, value number)",
15    "insert into fetch_tab (id, value) values (1,1)",
16    "insert into fetch_tab (id, value) values (1,1)",
17    "insert into fetch_tab (id, value) values (1,1)",
18);
19
20oci8_test_sql_execute($c, $stmtarray);
21
22// Run Test
23
24if (!($s = oci_parse($c, "select * from fetch_tab"))) {
25    die("oci_parse(select) failed!\n");
26}
27
28if (!oci_execute($s)) {
29    die("oci_execute(select) failed!\n");
30}
31
32while(oci_fetch($s)) {
33        $row = oci_result($s, 1);
34        $row1 = oci_result($s, 2);
35        var_dump($row);
36        var_dump($row1);
37}
38
39// Cleanup
40
41$stmtarray = array(
42    "drop table fetch_tab"
43);
44
45oci8_test_sql_execute($c, $stmtarray);
46
47echo "Done\n";
48?>
49--EXPECT--
50string(1) "1"
51string(1) "1"
52string(1) "1"
53string(1) "1"
54string(1) "1"
55string(1) "1"
56Done
57