xref: /PHP-8.0/ext/oci8/tests/fetch_row.phpt (revision f8d79582)
1--TEST--
2oci_fetch_row()
3--SKIPIF--
4<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
5--FILE--
6<?php
7
8require(__DIR__."/connect.inc");
9
10// Initialize
11
12$stmtarray = array(
13    "drop table fetch_row_tab",
14    "create table fetch_row_tab (id number, value number)",
15    "insert into fetch_row_tab (id, value) values (1,1)",
16    "insert into fetch_row_tab (id, value) values (1,1)",
17    "insert into fetch_row_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_row_tab"))) {
25    die("oci_parse(select) failed!\n");
26}
27
28if (!oci_execute($s)) {
29    die("oci_execute(select) failed!\n");
30}
31while ($row = oci_fetch_row($s)) {
32    var_dump($row);
33}
34
35// Cleanup
36
37$stmtarray = array(
38    "drop table fetch_row_tab"
39);
40
41oci8_test_sql_execute($c, $stmtarray);
42
43echo "Done\n";
44
45?>
46--EXPECT--
47array(2) {
48  [0]=>
49  string(1) "1"
50  [1]=>
51  string(1) "1"
52}
53array(2) {
54  [0]=>
55  string(1) "1"
56  [1]=>
57  string(1) "1"
58}
59array(2) {
60  [0]=>
61  string(1) "1"
62  [1]=>
63  string(1) "1"
64}
65Done
66