1--TEST-- 2Oracle Database 12c Implicit Result Sets: alternating oci_fetch_* calls 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 9require __DIR__.'/skipif.inc'; 10preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 die("skip expected output only valid when using Oracle Database 12c or greater"); 13} 14preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17} 18?> 19--FILE-- 20<?php 21 22require __DIR__.'/connect.inc'; 23 24// Initialization 25 26$stmtarray = array( 27 "drop table imp_res_6_tab", 28 "create table imp_res_6_tab (c1 number, c2 varchar2(10))", 29 "insert into imp_res_6_tab values (1, 'a')", 30 "insert into imp_res_6_tab values (2, 'b')", 31 "insert into imp_res_6_tab values (3, 'c')", 32 "insert into imp_res_6_tab values (4, 'd')", 33 "insert into imp_res_6_tab values (5, 'e')", 34 "insert into imp_res_6_tab values (6, 'f')", 35 36 "create or replace procedure imp_res_6_proc as 37 c1 sys_refcursor; 38 begin 39 open c1 for select * from imp_res_6_tab order by 1; 40 dbms_sql.return_result(c1); 41 end;" 42); 43 44oci8_test_sql_execute($c, $stmtarray); 45 46// Run Test 47 48echo "Test 1\n"; 49$s = oci_parse($c, "begin imp_res_6_proc(); end;"); 50oci_execute($s); 51 52$row = oci_fetch_assoc($s); 53var_dump($row); 54$row = oci_fetch_row($s); 55var_dump($row); 56$row = oci_fetch_object($s); 57var_dump($row); 58$row = oci_fetch_array($s); 59var_dump($row); 60$row = oci_fetch_array($s, OCI_NUM); 61var_dump($row); 62$row = oci_fetch_array($s, OCI_ASSOC); 63var_dump($row); 64 65 66// Clean up 67 68$stmtarray = array( 69 "drop procedure imp_res_6_proc", 70 "drop table imp_res_6_tab", 71); 72 73oci8_test_sql_execute($c, $stmtarray); 74 75?> 76--EXPECTF-- 77Test 1 78array(2) { 79 ["C1"]=> 80 string(1) "1" 81 ["C2"]=> 82 string(1) "a" 83} 84array(2) { 85 [0]=> 86 string(1) "2" 87 [1]=> 88 string(1) "b" 89} 90object(stdClass)#%d (2) { 91 ["C1"]=> 92 string(1) "3" 93 ["C2"]=> 94 string(1) "c" 95} 96array(4) { 97 [0]=> 98 string(1) "4" 99 ["C1"]=> 100 string(1) "4" 101 [1]=> 102 string(1) "d" 103 ["C2"]=> 104 string(1) "d" 105} 106array(2) { 107 [0]=> 108 string(1) "5" 109 [1]=> 110 string(1) "e" 111} 112array(2) { 113 ["C1"]=> 114 string(1) "6" 115 ["C2"]=> 116 string(1) "f" 117} 118