xref: /PHP-8.3/ext/oci8/tests/fetch_row.phpt (revision a53e5617)
1--TEST--
2oci_fetch_row()
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_row_tab",
18    "create table fetch_row_tab (id number, value number)",
19    "insert into fetch_row_tab (id, value) values (1,1)",
20    "insert into fetch_row_tab (id, value) values (1,1)",
21    "insert into fetch_row_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_row_tab"))) {
29    die("oci_parse(select) failed!\n");
30}
31
32if (!oci_execute($s)) {
33    die("oci_execute(select) failed!\n");
34}
35while ($row = oci_fetch_row($s)) {
36    var_dump($row);
37}
38
39// Cleanup
40
41$stmtarray = array(
42    "drop table fetch_row_tab"
43);
44
45oci8_test_sql_execute($c, $stmtarray);
46
47echo "Done\n";
48
49?>
50--EXPECT--
51array(2) {
52  [0]=>
53  string(1) "1"
54  [1]=>
55  string(1) "1"
56}
57array(2) {
58  [0]=>
59  string(1) "1"
60  [1]=>
61  string(1) "1"
62}
63array(2) {
64  [0]=>
65  string(1) "1"
66  [1]=>
67  string(1) "1"
68}
69Done
70