Annotation of embedaddon/php/ext/oci8/tests/fetch_object_1.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: oci_fetch_object()
                      3: --SKIPIF--
                      4: <?php
                      5: $target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
                      6: require(dirname(__FILE__).'/skipif.inc');
                      7: ?> 
                      8: --FILE--
                      9: <?php
                     10: 
                     11: require(dirname(__FILE__).'/connect.inc');
                     12: 
                     13: // Initialization
                     14: 
                     15: $stmtarray = array(
                     16:     "drop table fetch_object_tab",
                     17:     "create table fetch_object_tab (\"caseSensitive\" number, secondcol varchar2(20), anothercol char(15))",
                     18:     "insert into fetch_object_tab values (123, '1st row col2 string', '1 more text')",
                     19:     "insert into fetch_object_tab values (456, '2nd row col2 string', '2 more text')",
                     20:     "insert into fetch_object_tab values (789, '3rd row col2 string', '3 more text')",
                     21: );
                     22: 
                     23: oci8_test_sql_execute($c, $stmtarray);
                     24: 
                     25: // Run Test
                     26: 
                     27: echo "Test 1\n";
                     28: 
                     29: if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
                     30:     die("oci_parse(select) failed!\n");
                     31: }
                     32: 
                     33: if (!oci_execute($s)) {
                     34:     die("oci_execute(select) failed!\n");
                     35: }
                     36: 
                     37: while ($row = oci_fetch_object($s)) {
                     38:     var_dump($row);
                     39: }
                     40: 
                     41: echo "Test 2\n";
                     42: 
                     43: if (!($s = oci_parse($c, 'select * from fetch_object_tab'))) {
                     44:     die("oci_parse(select) failed!\n");
                     45: }
                     46: 
                     47: if (!oci_execute($s)) {
                     48:     die("oci_execute(select) failed!\n");
                     49: }
                     50: 
                     51: while ($row = oci_fetch_object($s)) {
                     52:     echo $row->caseSensitive . "\n";
                     53:     echo $row->SECONDCOL . "\n";
                     54:     echo $row->ANOTHERCOL . "\n";
                     55: }
                     56: 
                     57: echo "Test 3\n";
                     58: 
                     59: if (!($s = oci_parse($c, 'select * from fetch_object_tab where rownum < 2 order by "caseSensitive"'))) {
                     60:     die("oci_parse(select) failed!\n");
                     61: }
                     62: 
                     63: if (!oci_execute($s)) {
                     64:     die("oci_execute(select) failed!\n");
                     65: }
                     66: 
                     67: $row = oci_fetch_object($s);
                     68: echo $row->caseSensitive . "\n";
                     69: echo $row->CASESENSITIVE . "\n";
                     70: 
                     71: // Clean up
                     72: 
                     73: $stmtarray = array(
                     74:     "drop table fetch_object_tab"
                     75: );
                     76: 
                     77: oci8_test_sql_execute($c, $stmtarray);
                     78: 
                     79: ?>
                     80: ===DONE===
                     81: <?php exit(0); ?>
                     82: --EXPECTF--
                     83: Test 1
                     84: object(stdClass)#%d (3) {
                     85:   ["caseSensitive"]=>
                     86:   string(3) "123"
                     87:   ["SECONDCOL"]=>
                     88:   string(19) "1st row col2 string"
                     89:   ["ANOTHERCOL"]=>
                     90:   string(15) "1 more text    "
                     91: }
                     92: object(stdClass)#%d (3) {
                     93:   ["caseSensitive"]=>
                     94:   string(3) "456"
                     95:   ["SECONDCOL"]=>
                     96:   string(19) "2nd row col2 string"
                     97:   ["ANOTHERCOL"]=>
                     98:   string(15) "2 more text    "
                     99: }
                    100: object(stdClass)#%d (3) {
                    101:   ["caseSensitive"]=>
                    102:   string(3) "789"
                    103:   ["SECONDCOL"]=>
                    104:   string(19) "3rd row col2 string"
                    105:   ["ANOTHERCOL"]=>
                    106:   string(15) "3 more text    "
                    107: }
                    108: Test 2
                    109: 123
                    110: 1st row col2 string
                    111: 1 more text    
                    112: 456
                    113: 2nd row col2 string
                    114: 2 more text    
                    115: 789
                    116: 3rd row col2 string
                    117: 3 more text    
                    118: Test 3
                    119: 123
                    120: 
                    121: Notice: Undefined property: stdClass::$CASESENSITIVE in %sfetch_object_1.php on line %d
                    122: 
                    123: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>