Commit c0f05887 authored by Alexander Barkov's avatar Alexander Barkov

Adding a test for entities

(special characters and characters outside of the file ENCODING)

modified:
  mysql-test/suite/connect/r/xml.result
  mysql-test/suite/connect/t/xml.test
parent 9716acfc
...@@ -390,3 +390,37 @@ SELECT LEFT(@a,43); ...@@ -390,3 +390,37 @@ SELECT LEFT(@a,43);
LEFT(@a,43) <?xml version="1.0" encoding="iso-8859-1"?> LEFT(@a,43) <?xml version="1.0" encoding="iso-8859-1"?>
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node')); SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
HEX(EXTRACTVALUE(@a,'/t1/line/node')) C0C1C2C3 HEX(EXTRACTVALUE(@a,'/t1/line/node')) C0C1C2C3
#
# Testing XML entities
#
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET utf8
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C380C381C382C383
node АБВГ
hex(node) D090D091D092D093
node &<>"'
hex(node) 263C3E2227
DROP TABLE t1;
SET @a=LOAD_FILE('test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1);
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by CONNECT Version 1.01.0002 February 19, 2013 -->
<t1>
<line>
<node>ÀÁÂÃ</node>
</line>
<line>
<node>&#1040;&#1041;&#1042;&#1043;</node>
</line>
<line>
<node>&amp;&lt;&gt;"'</node>
</line>
</t1>
...@@ -301,6 +301,25 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node')); ...@@ -301,6 +301,25 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
--remove_file $MYSQLD_DATADIR/test/t1.xml --remove_file $MYSQLD_DATADIR/test/t1.xml
--echo #
--echo # Testing XML entities
--echo #
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET utf8
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1;
DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.xml
SET @a=LOAD_FILE('test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1);
--remove_file $MYSQLD_DATADIR/test/t1.xml
# #
# Clean up # Clean up
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment