1--TEST-- 2Bug #37220 (LOB Type mismatch when using windows & oci8.dll) 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 8require(__DIR__.'/skipif.inc'); 9?> 10--FILE-- 11<?php 12 13require __DIR__.'/connect.inc'; 14 15// Initialization 16 17$stmtarray = array( 18 "create table bug37220_tab( mycolumn xmltype not null)", 19 "insert into bug37220_tab values(xmltype('<THETAG myID=\"1234\"></THETAG>'))" 20); 21 22oci8_test_sql_execute($c, $stmtarray); 23 24// Now let's update the row where myId = 1234 and change the tag 25// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and 26// bug37220_tab a normal Oracle table) 27 28$query = "UPDATE bug37220_tab 29 SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data)) 30 WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1"; 31$stmt = oci_parse ($c, $query); 32$clob = oci_new_descriptor($c, OCI_D_LOB); 33oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB); 34$clob->writeTemporary("<MYTAG/>", OCI_TEMP_CLOB); 35$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS); 36oci_free_statement($stmt); 37$clob->close(); 38 39// Query back the change 40 41$query = "select * from bug37220_tab"; 42$stmt = oci_parse ($c, $query); 43 44oci_execute($stmt); 45 46while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { 47 foreach ($row as $item) { 48 echo trim($item)."\n"; 49 } 50 echo "\n"; 51} 52 53// Cleanup 54 55$stmtarray = array( 56 "drop table bug37220_tab" 57); 58 59oci8_test_sql_execute($c, $stmtarray); 60 61echo "Done\n"; 62 63?> 64--EXPECT-- 65<MYTAG/> 66 67Done 68