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

1.1     ! misho       1: --TEST--
        !             2: oci_lob_copy() - 2 
        !             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: require dirname(__FILE__).'/create_table.inc';
        !            13: 
        !            14: $ora_sql = "INSERT INTO
        !            15:                        ".$schema.$table_name." (id, blob)
        !            16:                       VALUES (1, empty_blob())
        !            17:                       RETURNING
        !            18:                                blob
        !            19:                       INTO :v_blob ";
        !            20: 
        !            21: $statement = oci_parse($c,$ora_sql);
        !            22: $blob = oci_new_descriptor($c,OCI_D_LOB);
        !            23: oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
        !            24: oci_execute($statement, OCI_DEFAULT);
        !            25: 
        !            26: var_dump($blob->write("some string here. string, I said"));
        !            27: oci_commit($c);
        !            28: 
        !            29: $ora_sql = "INSERT INTO
        !            30:                        ".$schema.$table_name." (id, blob)
        !            31:                       VALUES (2, empty_blob())
        !            32:                       RETURNING
        !            33:                                blob
        !            34:                       INTO :v_blob ";
        !            35: 
        !            36: $statement = oci_parse($c,$ora_sql);
        !            37: $blob = oci_new_descriptor($c,OCI_D_LOB);
        !            38: oci_bind_by_name($statement,":v_blob", $blob,-1,OCI_B_BLOB);
        !            39: oci_execute($statement, OCI_DEFAULT);
        !            40: 
        !            41: oci_commit($c);
        !            42: 
        !            43: $select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 1";
        !            44: $s = oci_parse($c, $select_sql);
        !            45: oci_execute($s);
        !            46: 
        !            47: $row1 = oci_fetch_array($s);
        !            48: 
        !            49: $select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE";
        !            50: $s = oci_parse($c, $select_sql);
        !            51: oci_execute($s, OCI_DEFAULT);
        !            52: 
        !            53: $row2 = oci_fetch_array($s);
        !            54: 
        !            55: $dummy = oci_new_descriptor($c, OCI_D_LOB);
        !            56: 
        !            57: var_dump(oci_lob_copy($dummy, $row1[0]));
        !            58: var_dump(oci_lob_copy($row2[0], $dummy));
        !            59: 
        !            60: var_dump(oci_lob_copy($row2[0], $row1[0], 0));
        !            61: var_dump(oci_lob_copy($row2[0], $row1[0], -1));
        !            62: var_dump(oci_lob_copy($row2[0], $row1[0], 100000));
        !            63: 
        !            64: var_dump(oci_lob_size());
        !            65: var_dump(oci_lob_size($row2[0]));
        !            66: unset($dummy->descriptor);
        !            67: var_dump(oci_lob_size($dummy));
        !            68: 
        !            69: oci_rollback($c);
        !            70: oci_rollback($c);
        !            71: oci_commit($c);
        !            72: oci_commit($c);
        !            73: 
        !            74: $select_sql = "SELECT blob FROM ".$schema.$table_name." WHERE id = 2 FOR UPDATE";
        !            75: $s = oci_parse($c, $select_sql);
        !            76: oci_execute($s, OCI_DEFAULT);
        !            77: 
        !            78: var_dump($row2 = oci_fetch_array($s, OCI_RETURN_LOBS));
        !            79: 
        !            80: require dirname(__FILE__).'/drop_table.inc';
        !            81: 
        !            82: echo "Done\n";
        !            83: 
        !            84: ?>
        !            85: --EXPECTF--
        !            86: int(32)
        !            87: 
        !            88: Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
        !            89: bool(false)
        !            90: 
        !            91: Warning: oci_lob_copy(): OCI_INVALID_HANDLE in %s on line %d
        !            92: bool(false)
        !            93: bool(false)
        !            94: 
        !            95: Warning: oci_lob_copy(): Length parameter must be greater than 0 in %s on line %d
        !            96: bool(false)
        !            97: bool(true)
        !            98: 
        !            99: Warning: oci_lob_size() expects exactly 1 parameter, 0 given in %s on line %d
        !           100: NULL
        !           101: int(0)
        !           102: 
        !           103: Warning: oci_lob_size(): Unable to find descriptor property in %s on line %d
        !           104: bool(false)
        !           105: array(2) {
        !           106:   [0]=>
        !           107:   string(0) ""
        !           108:   ["BLOB"]=>
        !           109:   string(0) ""
        !           110: }
        !           111: Done

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