Commit df153bb5 authored by Alexander Barkov's avatar Alexander Barkov

Adding tests to check that TABLE_TYPE=XML creates the XML

file according to the ENCODING option.

modified:
  mysql-test/suite/connect/r/xml.result
  mysql-test/suite/connect/t/xml.test
parent f41aadfa
......@@ -359,3 +359,34 @@ HEX(c) C8CACBCCCD
c ОПРСТ
HEX(c) CECFD0D1D2
DROP TABLE t1;
#
# Testing that the underlying file is created with a proper Encoding
#
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=utf-8';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C0C1C2C3
DROP TABLE t1;
SET @a=LOAD_FILE('test/t1.xml');
SELECT LEFT(@a,38);
LEFT(@a,38) <?xml version="1.0" encoding="utf-8"?>
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
HEX(EXTRACTVALUE(@a,'/t1/line/node')) C380C381C382C383
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1
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);
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C0C1C2C3
DROP TABLE t1;
SET @a=LOAD_FILE('test/t1.xml');
SELECT LEFT(@a,43);
LEFT(@a,43) <?xml version="1.0" encoding="iso-8859-1"?>
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
HEX(EXTRACTVALUE(@a,'/t1/line/node')) C0C1C2C3
......@@ -271,6 +271,36 @@ SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing that the underlying file is created with a proper Encoding
--echo #
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=utf-8';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1;
DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.xml
SET @a=LOAD_FILE('test/t1.xml');
SELECT LEFT(@a,38);
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
--remove_file $MYSQLD_DATADIR/test/t1.xml
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1
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);
SELECT node, hex(node) FROM t1;
DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.xml
SET @a=LOAD_FILE('test/t1.xml');
SELECT LEFT(@a,43);
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
--remove_file $MYSQLD_DATADIR/test/t1.xml
#
# 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