1--TEST-- 2oci_fetch_object() 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'; 15 16// Initialization 17 18$stmtarray = array( 19 "drop table fetch_object_tab", 20 "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))", 21 "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')", 22 "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')", 23 "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')", 24); 25 26oci8_test_sql_execute($c, $stmtarray); 27 28// Run Test 29 30echo "Test 1\n"; 31 32if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) { 33 die("oci_parse(select) failed!\n"); 34} 35 36if (!oci_execute($s)) { 37 die("oci_execute(select) failed!\n"); 38} 39 40while ($row = oci_fetch_object($s)) { 41 var_dump($row); 42} 43 44echo "Test 2\n"; 45 46if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) { 47 die("oci_parse(select) failed!\n"); 48} 49 50if (!oci_execute($s)) { 51 die("oci_execute(select) failed!\n"); 52} 53 54while ($row = oci_fetch_object($s)) { 55 echo $row->caseSensitive . "\n"; 56 echo $row->SECONDCOL . "\n"; 57 echo $row->ANOTHERCOL . "\n"; 58} 59 60echo "Test 3\n"; 61 62if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) { 63 die("oci_parse(select) failed!\n"); 64} 65 66if (!oci_execute($s)) { 67 die("oci_execute(select) failed!\n"); 68} 69 70$row = oci_fetch_object($s); 71echo $row->caseSensitive . "\n"; 72echo $row->CASESENSITIVE . "\n"; 73 74// Clean up 75 76$stmtarray = array( 77 "drop table fetch_object_tab" 78); 79 80oci8_test_sql_execute($c, $stmtarray); 81 82?> 83--EXPECTF-- 84Test 1 85object(stdClass)#%d (3) { 86 ["caseSensitive"]=> 87 string(3) "123" 88 ["SECONDCOL"]=> 89 string(19) "1st row col2 string" 90 ["ANOTHERCOL"]=> 91 string(15) "1 more text " 92} 93object(stdClass)#%d (3) { 94 ["caseSensitive"]=> 95 string(3) "456" 96 ["SECONDCOL"]=> 97 string(19) "2nd row col2 string" 98 ["ANOTHERCOL"]=> 99 string(15) "2 more text " 100} 101object(stdClass)#%d (3) { 102 ["caseSensitive"]=> 103 string(3) "789" 104 ["SECONDCOL"]=> 105 string(19) "3rd row col2 string" 106 ["ANOTHERCOL"]=> 107 string(15) "3 more text " 108} 109Test 2 110123 1111st row col2 string 1121 more text 113456 1142nd row col2 string 1152 more text 116789 1173rd row col2 string 1183 more text 119Test 3 120123 121 122Warning: Undefined property: stdClass::$CASESENSITIVE in %sfetch_object_1.php on line %d 123 124