From: Christopher Jones Date: Thu, 1 Oct 2009 06:22:32 +0000 (+0000) Subject: Add xmltype_02.phpt. Add XFAIL to xmltype_01 for PHP 6 X-Git-Tag: php-5.4.0alpha1~191^2~2555 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09a37f0d0ea03b6dd8f1d066359dacd8248884b8;p=php Add xmltype_02.phpt. Add XFAIL to xmltype_01 for PHP 6 --- diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt index 731e554446..af63f1bd0b 100644 --- a/ext/oci8/tests/xmltype_01.phpt +++ b/ext/oci8/tests/xmltype_01.phpt @@ -90,6 +90,8 @@ foreach ($stmts as $q) { echo "Done\n"; ?> +--XFAIL-- +Fails in PHP 6 due to an Oracle XML issue with the character set --EXPECT-- Initial Data unicode(250) " diff --git a/ext/oci8/tests/xmltype_02.phpt b/ext/oci8/tests/xmltype_02.phpt new file mode 100644 index 0000000000..65f25361d7 --- /dev/null +++ b/ext/oci8/tests/xmltype_02.phpt @@ -0,0 +1,199 @@ +--TEST-- +Basic XMLType test #2 +--SKIPIF-- + +--FILE-- + + +1 +Southlake, Texas +Owned +25000 +2 +Rear load +true +N +Street +10 + +EOF; + +echo "Test 1 Insert new XML data using a temporary CLOB\n"; +$s = oci_parse($c, + "insert into xmltype_02_tab (warehouse_id, warehouse_spec) + values (:id, XMLType(:clob))"); +oci_bind_by_name($s, ':id', $id); +$lob = oci_new_descriptor($c, OCI_D_LOB); +oci_bind_by_name($s, ':clob', $lob, -1, OCI_B_CLOB); +$lob->writeTemporary($xml); +oci_execute($s); +$lob->close(); + +// Query the row back +$s = oci_parse($c, 'select xmltype.getclobval(warehouse_spec) + from xmltype_02_tab where warehouse_id = :id'); +$r = oci_bind_by_name($s, ':id', $id); +oci_execute($s); +$row = oci_fetch_array($s, OCI_NUM); + +var_dump($row); + +echo "Test 2 Manipulate the data using SimpleXML\n"; + +$sx = simplexml_load_string((binary)$row[0]->load()); +$row[0]->free(); +var_dump($sx); + +$sx->Docks -= 1; // change the data + +var_dump($sx); + +echo "Test 3: Update changes using a temporary CLOB\n"; + +$s = oci_parse($c, 'update xmltype_02_tab + set warehouse_spec = XMLType(:clob) + where warehouse_id = :id'); +oci_bind_by_name($s, ':id', $id); +$lob = oci_new_descriptor($c, OCI_D_LOB); +oci_bind_by_name($s, ':clob', $lob, -1, OCI_B_CLOB); +$lob->writeTemporary($sx->asXml()); +oci_execute($s); +$lob->close(); + +// Query the changed row back and print it +$s = oci_parse($c, 'select xmltype.getclobval(warehouse_spec) + from xmltype_02_tab where warehouse_id = :id'); +$r = oci_bind_by_name($s, ':id', $id); +oci_execute($s); +$row = oci_fetch_array($s, OCI_NUM); +var_dump($row[0]->load()); +$row[0]->free(); + +// Clean up + +//require(dirname(__FILE__).'/drop_table.inc'); + +$stmtarray = array( + "drop table xmltype_02_tab" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + oci_execute($s); +} + +oci_close($c); + +?> +===DONE=== + +--XFAIL-- +Fails in PHP 6 due to an Oracle XML issue with the character set +--EXPECTF-- +Test 1 Insert new XML data using a temporary CLOB +array(1) { + [0]=> + object(OCI-Lob)#%d (1) { + [%u|b%"descriptor"]=> + resource(%d) of type (oci8 descriptor) + } +} +Test 2 Manipulate the data using SimpleXML +object(SimpleXMLElement)#%d (10) { + [%u|b%"WarehouseId"]=> + %unicode|string%(1) "1" + [%u|b%"WarehouseName"]=> + %unicode|string%(16) "Southlake, Texas" + [%u|b%"Building"]=> + %unicode|string%(5) "Owned" + [%u|b%"Area"]=> + %unicode|string%(5) "25000" + [%u|b%"Docks"]=> + %unicode|string%(1) "2" + [%u|b%"DockType"]=> + %unicode|string%(9) "Rear load" + [%u|b%"WaterAccess"]=> + %unicode|string%(4) "true" + [%u|b%"RailAccess"]=> + %unicode|string%(1) "N" + [%u|b%"Parking"]=> + %unicode|string%(6) "Street" + [%u|b%"VClearance"]=> + %unicode|string%(2) "10" +} +object(SimpleXMLElement)#%d (10) { + [%u|b%"WarehouseId"]=> + %unicode|string%(1) "1" + [%u|b%"WarehouseName"]=> + %unicode|string%(16) "Southlake, Texas" + [%u|b%"Building"]=> + %unicode|string%(5) "Owned" + [%u|b%"Area"]=> + %unicode|string%(5) "25000" + [%u|b%"Docks"]=> + %unicode|string%(1) "1" + [%u|b%"DockType"]=> + %unicode|string%(9) "Rear load" + [%u|b%"WaterAccess"]=> + %unicode|string%(4) "true" + [%u|b%"RailAccess"]=> + %unicode|string%(1) "N" + [%u|b%"Parking"]=> + %unicode|string%(6) "Street" + [%u|b%"VClearance"]=> + %unicode|string%(2) "10" +} +Test 3: Update changes using a temporary CLOB +%unicode|string%(331) " + +1 +Southlake, Texas +Owned +25000 +1 +Rear load +true +N +Street +10 + +" +===DONE=== \ No newline at end of file