1--TEST-- 2oci_fetch_array() 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'; 10?> 11--FILE-- 12<?php 13 14require __DIR__."/connect.inc"; 15require __DIR__.'/create_table.inc'; 16 17$insert_sql = "INSERT INTO ".$schema."".$table_name." (id, value) VALUES (1,1)"; 18 19if (!($s = oci_parse($c, $insert_sql))) { 20 die("oci_parse(insert) failed!\n"); 21} 22 23for ($i = 0; $i<3; $i++) { 24 if (!oci_execute($s)) { 25 die("oci_execute(insert) failed!\n"); 26 } 27} 28 29if (!oci_commit($c)) { 30 die("oci_commit() failed!\n"); 31} 32 33echo "Test 1\n"; 34 35$select_sql = "SELECT * FROM ".$schema."".$table_name.""; 36 37if (!($s = oci_parse($c, $select_sql))) { 38 die("oci_parse(select) failed!\n"); 39} 40 41if (!oci_execute($s)) { 42 die("oci_execute(select) failed!\n"); 43} 44while ($row = oci_fetch_array($s)) { 45 var_dump($row); 46} 47 48echo "Test 2\n"; 49 50if (!oci_execute($s)) { 51 die("oci_execute(select) failed!\n"); 52} 53while ($row = oci_fetch_array($s, OCI_NUM)) { 54 var_dump($row); 55} 56 57echo "Test 3\n"; 58 59if (!oci_execute($s)) { 60 die("oci_execute(select) failed!\n"); 61} 62while ($row = oci_fetch_array($s, OCI_ASSOC)) { 63 var_dump($row); 64} 65 66echo "Test 4\n"; 67 68if (!oci_execute($s)) { 69 die("oci_execute(select) failed!\n"); 70} 71while ($row = oci_fetch_array($s, OCI_BOTH)) { 72 var_dump($row); 73} 74 75echo "Test 5\n"; 76 77if (!oci_execute($s)) { 78 die("oci_execute(select) failed!\n"); 79} 80while ($row = oci_fetch_array($s, OCI_RETURN_LOBS)) { 81 var_dump($row); 82} 83 84echo "Test 6\n"; 85 86if (!oci_execute($s)) { 87 die("oci_execute(select) failed!\n"); 88} 89while ($row = oci_fetch_array($s, OCI_RETURN_NULLS)) { 90 var_dump($row); 91} 92 93echo "Test 7\n"; 94 95if (!oci_execute($s)) { 96 die("oci_execute(select) failed!\n"); 97} 98while ($row = oci_fetch_array($s, OCI_NUM+OCI_RETURN_NULLS)) { 99 var_dump($row); 100} 101 102require __DIR__.'/drop_table.inc'; 103 104echo "Done\n"; 105?> 106--EXPECT-- 107Test 1 108array(10) { 109 [0]=> 110 string(1) "1" 111 ["ID"]=> 112 string(1) "1" 113 [1]=> 114 string(1) "1" 115 ["VALUE"]=> 116 string(1) "1" 117 [2]=> 118 NULL 119 ["BLOB"]=> 120 NULL 121 [3]=> 122 NULL 123 ["CLOB"]=> 124 NULL 125 [4]=> 126 NULL 127 ["STRING"]=> 128 NULL 129} 130array(10) { 131 [0]=> 132 string(1) "1" 133 ["ID"]=> 134 string(1) "1" 135 [1]=> 136 string(1) "1" 137 ["VALUE"]=> 138 string(1) "1" 139 [2]=> 140 NULL 141 ["BLOB"]=> 142 NULL 143 [3]=> 144 NULL 145 ["CLOB"]=> 146 NULL 147 [4]=> 148 NULL 149 ["STRING"]=> 150 NULL 151} 152array(10) { 153 [0]=> 154 string(1) "1" 155 ["ID"]=> 156 string(1) "1" 157 [1]=> 158 string(1) "1" 159 ["VALUE"]=> 160 string(1) "1" 161 [2]=> 162 NULL 163 ["BLOB"]=> 164 NULL 165 [3]=> 166 NULL 167 ["CLOB"]=> 168 NULL 169 [4]=> 170 NULL 171 ["STRING"]=> 172 NULL 173} 174Test 2 175array(2) { 176 [0]=> 177 string(1) "1" 178 [1]=> 179 string(1) "1" 180} 181array(2) { 182 [0]=> 183 string(1) "1" 184 [1]=> 185 string(1) "1" 186} 187array(2) { 188 [0]=> 189 string(1) "1" 190 [1]=> 191 string(1) "1" 192} 193Test 3 194array(2) { 195 ["ID"]=> 196 string(1) "1" 197 ["VALUE"]=> 198 string(1) "1" 199} 200array(2) { 201 ["ID"]=> 202 string(1) "1" 203 ["VALUE"]=> 204 string(1) "1" 205} 206array(2) { 207 ["ID"]=> 208 string(1) "1" 209 ["VALUE"]=> 210 string(1) "1" 211} 212Test 4 213array(4) { 214 [0]=> 215 string(1) "1" 216 ["ID"]=> 217 string(1) "1" 218 [1]=> 219 string(1) "1" 220 ["VALUE"]=> 221 string(1) "1" 222} 223array(4) { 224 [0]=> 225 string(1) "1" 226 ["ID"]=> 227 string(1) "1" 228 [1]=> 229 string(1) "1" 230 ["VALUE"]=> 231 string(1) "1" 232} 233array(4) { 234 [0]=> 235 string(1) "1" 236 ["ID"]=> 237 string(1) "1" 238 [1]=> 239 string(1) "1" 240 ["VALUE"]=> 241 string(1) "1" 242} 243Test 5 244array(4) { 245 [0]=> 246 string(1) "1" 247 ["ID"]=> 248 string(1) "1" 249 [1]=> 250 string(1) "1" 251 ["VALUE"]=> 252 string(1) "1" 253} 254array(4) { 255 [0]=> 256 string(1) "1" 257 ["ID"]=> 258 string(1) "1" 259 [1]=> 260 string(1) "1" 261 ["VALUE"]=> 262 string(1) "1" 263} 264array(4) { 265 [0]=> 266 string(1) "1" 267 ["ID"]=> 268 string(1) "1" 269 [1]=> 270 string(1) "1" 271 ["VALUE"]=> 272 string(1) "1" 273} 274Test 6 275array(10) { 276 [0]=> 277 string(1) "1" 278 ["ID"]=> 279 string(1) "1" 280 [1]=> 281 string(1) "1" 282 ["VALUE"]=> 283 string(1) "1" 284 [2]=> 285 NULL 286 ["BLOB"]=> 287 NULL 288 [3]=> 289 NULL 290 ["CLOB"]=> 291 NULL 292 [4]=> 293 NULL 294 ["STRING"]=> 295 NULL 296} 297array(10) { 298 [0]=> 299 string(1) "1" 300 ["ID"]=> 301 string(1) "1" 302 [1]=> 303 string(1) "1" 304 ["VALUE"]=> 305 string(1) "1" 306 [2]=> 307 NULL 308 ["BLOB"]=> 309 NULL 310 [3]=> 311 NULL 312 ["CLOB"]=> 313 NULL 314 [4]=> 315 NULL 316 ["STRING"]=> 317 NULL 318} 319array(10) { 320 [0]=> 321 string(1) "1" 322 ["ID"]=> 323 string(1) "1" 324 [1]=> 325 string(1) "1" 326 ["VALUE"]=> 327 string(1) "1" 328 [2]=> 329 NULL 330 ["BLOB"]=> 331 NULL 332 [3]=> 333 NULL 334 ["CLOB"]=> 335 NULL 336 [4]=> 337 NULL 338 ["STRING"]=> 339 NULL 340} 341Test 7 342array(5) { 343 [0]=> 344 string(1) "1" 345 [1]=> 346 string(1) "1" 347 [2]=> 348 NULL 349 [3]=> 350 NULL 351 [4]=> 352 NULL 353} 354array(5) { 355 [0]=> 356 string(1) "1" 357 [1]=> 358 string(1) "1" 359 [2]=> 360 NULL 361 [3]=> 362 NULL 363 [4]=> 364 NULL 365} 366array(5) { 367 [0]=> 368 string(1) "1" 369 [1]=> 370 string(1) "1" 371 [2]=> 372 NULL 373 [3]=> 374 NULL 375 [4]=> 376 NULL 377} 378Done 379