Annotation of embedaddon/php/ext/oci8/tests/fetch_object_2.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: oci_fetch_object() with CLOB and NULL
        !             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_2_tab",
        !            17:     "create table fetch_object_2_tab (col1 number, col2 CLOB, col3 varchar2(15))",
        !            18:     "insert into fetch_object_2_tab values (123, '1st row col2 string', '1 more text')",
        !            19:     "insert into fetch_object_2_tab values (456, '2nd row col2 string', NULL)",
        !            20:     "insert into fetch_object_2_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_2_tab order by 1'))) {
        !            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_2_tab order by 1'))) {
        !            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->COL1 . "\n";
        !            53:     echo $row->COL2->load(100) . "\n";
        !            54:     echo $row->COL3 . "\n";
        !            55: }
        !            56: 
        !            57: // Clean up
        !            58: 
        !            59: $stmtarray = array(
        !            60:     "drop table fetch_object_2_tab"
        !            61: );
        !            62: 
        !            63: oci8_test_sql_execute($c, $stmtarray);
        !            64: 
        !            65: ?>
        !            66: ===DONE===
        !            67: <?php exit(0); ?>
        !            68: --EXPECTF--
        !            69: Test 1
        !            70: object(stdClass)#%d (3) {
        !            71:   ["COL1"]=>
        !            72:   string(3) "123"
        !            73:   ["COL2"]=>
        !            74:   object(OCI-Lob)#%d (1) {
        !            75:     ["descriptor"]=>
        !            76:     resource(%d) of type (oci8 descriptor)
        !            77:   }
        !            78:   ["COL3"]=>
        !            79:   string(11) "1 more text"
        !            80: }
        !            81: object(stdClass)#%d (3) {
        !            82:   ["COL1"]=>
        !            83:   string(3) "456"
        !            84:   ["COL2"]=>
        !            85:   object(OCI-Lob)#%d (1) {
        !            86:     ["descriptor"]=>
        !            87:     resource(%d) of type (oci8 descriptor)
        !            88:   }
        !            89:   ["COL3"]=>
        !            90:   NULL
        !            91: }
        !            92: object(stdClass)#%d (3) {
        !            93:   ["COL1"]=>
        !            94:   string(3) "789"
        !            95:   ["COL2"]=>
        !            96:   object(OCI-Lob)#%d (1) {
        !            97:     ["descriptor"]=>
        !            98:     resource(%d) of type (oci8 descriptor)
        !            99:   }
        !           100:   ["COL3"]=>
        !           101:   string(11) "3 more text"
        !           102: }
        !           103: Test 2
        !           104: 123
        !           105: 1st row col2 string
        !           106: 1 more text
        !           107: 456
        !           108: 2nd row col2 string
        !           109: 
        !           110: 789
        !           111: 3rd row col2 string
        !           112: 3 more text
        !           113: ===DONE===

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