1--TEST-- 2Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_fetch_all 3--SKIPIF-- 4<?php 5if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 6$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 7require(__DIR__.'/skipif.inc'); 8preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 9if (!(isset($matches[0]) && $matches[1] >= 12)) { 10 die("skip expected output only valid when using Oracle Database 12c or greater"); 11} 12preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 13if (!(isset($matches[0]) && $matches[0] >= 12)) { 14 die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 15} 16?> 17--FILE-- 18<?php 19 20require(__DIR__.'/connect.inc'); 21 22$plsql = "declare 23 c1 sys_refcursor; 24 begin 25 open c1 for select 1 from dual union all select 2 from dual; 26 dbms_sql.return_result(c1); 27 open c1 for select 3 from dual union all select 4 from dual; 28 dbms_sql.return_result(c1); 29 open c1 for select 5 from dual union all select 6 from dual; 30 dbms_sql.return_result(c1); 31 end;"; 32 33// Run Test 34 35echo "Test 1\n"; 36$s = oci_parse($c, $plsql); 37oci_execute($s); 38 39$s1 = oci_get_implicit_resultset($s); 40oci_fetch_all($s1, $res); 41var_dump($res); 42 43$s2 = oci_get_implicit_resultset($s); 44oci_fetch_all($s2, $res); 45var_dump($res); 46 47$s3 = oci_get_implicit_resultset($s); 48oci_fetch_all($s3, $res); 49var_dump($res); 50 51echo "\nTest 2\n"; 52$s = oci_parse($c, $plsql); 53oci_execute($s); 54while (($s1 = oci_get_implicit_resultset($s))) { 55 $r = oci_fetch_all($s1, $res); 56 var_dump($res); 57} 58 59?> 60--EXPECT-- 61Test 1 62array(1) { 63 [1]=> 64 array(2) { 65 [0]=> 66 string(1) "1" 67 [1]=> 68 string(1) "2" 69 } 70} 71array(1) { 72 [3]=> 73 array(2) { 74 [0]=> 75 string(1) "3" 76 [1]=> 77 string(1) "4" 78 } 79} 80array(1) { 81 [5]=> 82 array(2) { 83 [0]=> 84 string(1) "5" 85 [1]=> 86 string(1) "6" 87 } 88} 89 90Test 2 91array(1) { 92 [1]=> 93 array(2) { 94 [0]=> 95 string(1) "1" 96 [1]=> 97 string(1) "2" 98 } 99} 100array(1) { 101 [3]=> 102 array(2) { 103 [0]=> 104 string(1) "3" 105 [1]=> 106 string(1) "4" 107 } 108} 109array(1) { 110 [5]=> 111 array(2) { 112 [0]=> 113 string(1) "5" 114 [1]=> 115 string(1) "6" 116 } 117} 118