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

1.1     ! misho       1: --TEST--
        !             2: Bug #37220 (LOB Type mismatch when using windows & oci8.dll)
        !             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:        "create table bug37220_tab( mycolumn xmltype not null)",
        !            17:        "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))"
        !            18: );
        !            19: 
        !            20: oci8_test_sql_execute($c, $stmtarray);
        !            21: 
        !            22: // Now let's update the row where myId = 1234 and change the tag
        !            23: // 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and
        !            24: // bug37220_tab a normal Oracle table)
        !            25: 
        !            26: $query = "UPDATE  bug37220_tab 
        !            27:                  SET     bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data)) 
        !            28:                  WHERE   existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1"; 
        !            29: $stmt = oci_parse ($c, $query); 
        !            30: $clob = oci_new_descriptor($c, OCI_D_LOB); 
        !            31: oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB); 
        !            32: $clob->writetemporary("<MYTAG/>", OCI_TEMP_CLOB); 
        !            33: $success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS); 
        !            34: oci_free_statement($stmt);     
        !            35: $clob->close(); 
        !            36: 
        !            37: // Query back the change
        !            38: 
        !            39: $query = "select * from bug37220_tab";
        !            40: $stmt = oci_parse ($c, $query); 
        !            41: 
        !            42: oci_execute($stmt);
        !            43: 
        !            44: while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
        !            45:        foreach ($row as $item) {
        !            46:                echo trim($item)."\n";
        !            47:        }
        !            48:        echo "\n";
        !            49: }
        !            50: 
        !            51: // Cleanup
        !            52: 
        !            53: $stmtarray = array(
        !            54:        "drop table bug37220_tab"
        !            55: );
        !            56: 
        !            57: oci8_test_sql_execute($c, $stmtarray);
        !            58: 
        !            59: echo "Done\n";
        !            60: 
        !            61: ?>
        !            62: --EXPECT--
        !            63: <MYTAG/>
        !            64: 
        !            65: Done

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