1--TEST-- 2Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: basic test 3 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--INI-- 18oci8.statement_cache_size = 0 19--FILE-- 20<?php 21 22require(__DIR__.'/connect.inc'); 23 24// Initialization 25 26$stmtarray = array( 27 "drop table imp_res_get_3_tab_1", 28 "create table imp_res_get_3_tab_1 (c1 number, c2 varchar2(10))", 29 "insert into imp_res_get_3_tab_1 values (1, 'abcde')", 30 "insert into imp_res_get_3_tab_1 values (2, 'fghij')", 31 "insert into imp_res_get_3_tab_1 values (3, 'klmno')", 32 33 "drop table imp_res_get_3_tab_2", 34 "create table imp_res_get_3_tab_2 (c3 varchar2(1))", 35 "insert into imp_res_get_3_tab_2 values ('t')", 36 "insert into imp_res_get_3_tab_2 values ('u')", 37 "insert into imp_res_get_3_tab_2 values ('v')", 38 39 "create or replace procedure imp_res_get_3_proc as 40 c1 sys_refcursor; 41 i pls_integer; 42 begin 43 for i in 1..30 loop -- if this value is too big for Oracle's open_cursors, calling imp_res_get_3_proc() can fail with ORA-1000 44 open c1 for select * from imp_res_get_3_tab_1 order by 1; 45 dbms_sql.return_result(c1); 46 open c1 for select * from imp_res_get_3_tab_2 where rownum < 3 order by 1; 47 dbms_sql.return_result(c1); 48 open c1 for select * from dual; 49 dbms_sql.return_result (c1); 50 end loop; 51 end;" 52); 53 54oci8_test_sql_execute($c, $stmtarray); 55 56// Run Test 57 58echo "Test 1\n"; 59 60$s = oci_parse($c, "begin imp_res_get_3_proc(); end;"); 61oci_execute($s); 62 63while (($s1 = oci_get_implicit_resultset($s))) { 64 while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { 65 foreach ($row as $item) { 66 echo " ".$item; 67 } 68 echo "\n"; 69 } 70} 71 72// Clean up 73 74$stmtarray = array( 75 "drop procedure imp_res_get_3_proc", 76 "drop table imp_res_get_3_tab_1", 77 "drop table imp_res_get_3_tab_2" 78); 79 80oci8_test_sql_execute($c, $stmtarray); 81 82?> 83--EXPECT-- 84Test 1 85 1 abcde 86 2 fghij 87 3 klmno 88 t 89 u 90 X 91 1 abcde 92 2 fghij 93 3 klmno 94 t 95 u 96 X 97 1 abcde 98 2 fghij 99 3 klmno 100 t 101 u 102 X 103 1 abcde 104 2 fghij 105 3 klmno 106 t 107 u 108 X 109 1 abcde 110 2 fghij 111 3 klmno 112 t 113 u 114 X 115 1 abcde 116 2 fghij 117 3 klmno 118 t 119 u 120 X 121 1 abcde 122 2 fghij 123 3 klmno 124 t 125 u 126 X 127 1 abcde 128 2 fghij 129 3 klmno 130 t 131 u 132 X 133 1 abcde 134 2 fghij 135 3 klmno 136 t 137 u 138 X 139 1 abcde 140 2 fghij 141 3 klmno 142 t 143 u 144 X 145 1 abcde 146 2 fghij 147 3 klmno 148 t 149 u 150 X 151 1 abcde 152 2 fghij 153 3 klmno 154 t 155 u 156 X 157 1 abcde 158 2 fghij 159 3 klmno 160 t 161 u 162 X 163 1 abcde 164 2 fghij 165 3 klmno 166 t 167 u 168 X 169 1 abcde 170 2 fghij 171 3 klmno 172 t 173 u 174 X 175 1 abcde 176 2 fghij 177 3 klmno 178 t 179 u 180 X 181 1 abcde 182 2 fghij 183 3 klmno 184 t 185 u 186 X 187 1 abcde 188 2 fghij 189 3 klmno 190 t 191 u 192 X 193 1 abcde 194 2 fghij 195 3 klmno 196 t 197 u 198 X 199 1 abcde 200 2 fghij 201 3 klmno 202 t 203 u 204 X 205 1 abcde 206 2 fghij 207 3 klmno 208 t 209 u 210 X 211 1 abcde 212 2 fghij 213 3 klmno 214 t 215 u 216 X 217 1 abcde 218 2 fghij 219 3 klmno 220 t 221 u 222 X 223 1 abcde 224 2 fghij 225 3 klmno 226 t 227 u 228 X 229 1 abcde 230 2 fghij 231 3 klmno 232 t 233 u 234 X 235 1 abcde 236 2 fghij 237 3 klmno 238 t 239 u 240 X 241 1 abcde 242 2 fghij 243 3 klmno 244 t 245 u 246 X 247 1 abcde 248 2 fghij 249 3 klmno 250 t 251 u 252 X 253 1 abcde 254 2 fghij 255 3 klmno 256 t 257 u 258 X 259 1 abcde 260 2 fghij 261 3 klmno 262 t 263 u 264 X 265