xref: /PHP-8.3/ext/oci8/tests/fetch.phpt (revision a53e5617)
1--TEST--
2ocifetch() & ociresult()
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_tab",
18    "create table fetch_tab (id number, value number)",
19    "insert into fetch_tab (id, value) values (1,1)",
20    "insert into fetch_tab (id, value) values (1,1)",
21    "insert into fetch_tab (id, value) values (1,1)",
22);
23
24oci8_test_sql_execute($c, $stmtarray);
25
26// Run Test
27
28if (!($s = oci_parse($c, "select * from fetch_tab"))) {
29    die("oci_parse(select) failed!\n");
30}
31
32if (!oci_execute($s)) {
33    die("oci_execute(select) failed!\n");
34}
35
36while(oci_fetch($s)) {
37        $row = oci_result($s, 1);
38        $row1 = oci_result($s, 2);
39        var_dump($row);
40        var_dump($row1);
41}
42
43// Cleanup
44
45$stmtarray = array(
46    "drop table fetch_tab"
47);
48
49oci8_test_sql_execute($c, $stmtarray);
50
51echo "Done\n";
52?>
53--EXPECT--
54string(1) "1"
55string(1) "1"
56string(1) "1"
57string(1) "1"
58string(1) "1"
59string(1) "1"
60Done
61