Commit 7f02ab70 authored by Olivier Bertrand's avatar Olivier Bertrand

Recognize xmlsup option case insensitive

  modified:   storage/connect/ha_connect.cc

Update tests to reflect recent changes, in particular new Jpath syntax
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/mysql-test/connect/r/alter_xml.result
  modified:   storage/connect/mysql-test/connect/r/bin.result
  modified:   storage/connect/mysql-test/connect/r/dir.result
  modified:   storage/connect/mysql-test/connect/r/grant.result
  modified:   storage/connect/mysql-test/connect/r/grant2.result
  modified:   storage/connect/mysql-test/connect/r/infoschema-9739.result
  modified:   storage/connect/mysql-test/connect/r/ini_grant.result
  modified:   storage/connect/mysql-test/connect/r/jdbc_new.result
  modified:   storage/connect/mysql-test/connect/r/mysql_discovery.result
  modified:   storage/connect/mysql-test/connect/r/mysql_exec.result
  modified:   storage/connect/mysql-test/connect/r/mysql_grant.result
  modified:   storage/connect/mysql-test/connect/r/mysql_new.result
  modified:   storage/connect/mysql-test/connect/r/unsigned.result
  modified:   storage/connect/mysql-test/connect/r/upd.result
  modified:   storage/connect/mysql-test/connect/r/xml.result
  modified:   storage/connect/mysql-test/connect/r/xml_grant.result
  modified:   storage/connect/mysql-test/connect/r/xml_html.result
  modified:   storage/connect/mysql-test/connect/r/xml_mdev5261.result
  modified:   storage/connect/mysql-test/connect/r/xml_mult.result
  modified:   storage/connect/mysql-test/connect/r/xml_zip.result
  modified:   storage/connect/mysql-test/connect/t/alter_xml.test
  modified:   storage/connect/mysql-test/connect/t/dir.test
  modified:   storage/connect/mysql-test/connect/t/infoschema-9739.test
  modified:   storage/connect/mysql-test/connect/t/jdbc_new.test
  modified:   storage/connect/mysql-test/connect/t/mysql_exec.test
  modified:   storage/connect/mysql-test/connect/t/mysql_new.test
  modified:   storage/connect/mysql-test/connect/t/unsigned.test
  modified:   storage/connect/mysql-test/connect/t/upd.test
  modified:   storage/connect/mysql-test/connect/t/xml.test
  modified:   storage/connect/mysql-test/connect/t/xml_grant.test
  modified:   storage/connect/mysql-test/connect/t/xml_html.test
  modified:   storage/connect/mysql-test/connect/t/xml_mdev5261.test
  modified:   storage/connect/mysql-test/connect/t/xml_mult.test
  modified:   storage/connect/mysql-test/connect/t/xml_zip.test
parent 46cf1a0d
...@@ -6199,7 +6199,7 @@ int ha_connect::create(const char *name, TABLE *table_arg, ...@@ -6199,7 +6199,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
// Note that if no support is specified, the default is MS-DOM // Note that if no support is specified, the default is MS-DOM
// on Windows and libxml2 otherwise // on Windows and libxml2 otherwise
switch (*xsup) { switch (toupper(*xsup)) {
case '*': case '*':
#if defined(__WIN__) #if defined(__WIN__)
dom= true; dom= true;
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
# #
# Testing changing table type (not in-place) # Testing changing table type (not in-place)
# #
...@@ -16,7 +14,7 @@ c d ...@@ -16,7 +14,7 @@ c d
# This is because the XML top node name defaults to the table name. # This is because the XML top node name defaults to the table name.
# Sure enough the temporary table name begins with '#' and is rejected by XML. # Sure enough the temporary table name begins with '#' and is rejected by XML.
# Therefore the top node name must be specified (along with the row nodes name). # Therefore the top node name must be specified (along with the row nodes name).
ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row'; ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='xmlsup=domdoc,rownode=row';
SELECT * FROM t1; SELECT * FROM t1;
c d c d
1 One 1 One
...@@ -27,7 +25,7 @@ Table Create Table ...@@ -27,7 +25,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
`d` char(10) NOT NULL `d` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='rownode=row' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=domdoc,rownode=row'
# Let us see the XML file # Let us see the XML file
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml'; CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
Warnings: Warnings:
...@@ -67,7 +65,7 @@ Table Create Table ...@@ -67,7 +65,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL, `c` int(11) NOT NULL,
`d` char(10) NOT NULL `FIELD_FORMAT`='@' `d` char(10) NOT NULL `FIELD_FORMAT`='@'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='rownode=row' `HEADER`=0 ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=domdoc,rownode=row' `HEADER`=0
SELECT * FROM t2; SELECT * FROM t2;
line line
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
#
# Testing changing table type (not in-place)
#
CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1 QUOTED=1;
Warnings:
Warning 1105 No file name. Table will use t1.csv
INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
SELECT * FROM t1;
c d
1 One
2 Two
3 Three
# This would fail if the top node name is not specified.
# This is because the XML top node name defaults to the table name.
# Sure enough the temporary table name begins with '#' and is rejected by XML.
# Therefore the top node name must be specified (along with the row nodes name).
ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='xmlsup=libxml2,rownode=row';
SELECT * FROM t1;
c d
1 One
2 Two
3 Three
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
`d` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `HEADER`=1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=libxml2,rownode=row'
# Let us see the XML file
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
Warnings:
Warning 1105 No table_type. Will be set to DOS
SELECT * FROM t2;
line
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by the MariaDB CONNECT Storage Engine-->
<t1>
<row>
<TH>c</TH>
<TH>d</TH>
</row>
<row>
<c>1</c>
<d>One</d>
</row>
<row>
<c>2</c>
<d>Two</d>
</row>
<row>
<c>3</c>
<d>Three</d>
</row>
</t1>
# NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
# Testing field option modification
ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
SELECT * FROM t1;
c d
1 One
2 Two
3 Three
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` int(11) NOT NULL,
`d` char(10) NOT NULL `FIELD_FORMAT`='@'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `QUOTED`=1 `TABLE_TYPE`=XML `TABNAME`=t1 `OPTION_LIST`='xmlsup=libxml2,rownode=row' `HEADER`=0
SELECT * FROM t2;
line
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created by the MariaDB CONNECT Storage Engine-->
<t1>
<row d="One">
<c>1</c>
</row>
<row d="Two">
<c>2</c>
</row>
<row d="Three">
<c>3</c>
</row>
</t1>
DROP TABLE t1, t2;
...@@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` ( ...@@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` (
`name` char(10) NOT NULL, `name` char(10) NOT NULL,
`birth` date NOT NULL, `birth` date NOT NULL,
`id` char(5) NOT NULL `FIELD_FORMAT`='S', `id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F', `salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S' `dept` int(4) NOT NULL `FIELD_FORMAT`='S'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
...@@ -76,7 +76,7 @@ t1 CREATE TABLE `t1` ( ...@@ -76,7 +76,7 @@ t1 CREATE TABLE `t1` (
`name` char(10) NOT NULL, `name` char(10) NOT NULL,
`birth` date NOT NULL, `birth` date NOT NULL,
`id` char(5) NOT NULL `FIELD_FORMAT`='S', `id` char(5) NOT NULL `FIELD_FORMAT`='S',
`salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F', `salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F',
`dept` int(4) NOT NULL `FIELD_FORMAT`='S' `dept` int(4) NOT NULL `FIELD_FORMAT`='S'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
......
...@@ -26,7 +26,7 @@ fname ftype size ...@@ -26,7 +26,7 @@ fname ftype size
boys .txt 282 boys .txt 282
boyswin .txt 288 boyswin .txt 288
INSERT INTO t1 VALUES ('','','',''); INSERT INTO t1 VALUES ('','','','');
ERROR HY000: Got error 174 'COLBLK SetBuffer: undefined Access Method' from CONNECT ERROR 22007: Incorrect double value: '' for column 'size' at row 1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
ERROR HY000: Cannot get column info for table type DIR ERROR HY000: Cannot get column info for table type DIR
Warnings: create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=domdoc';
Warning 1105 No file name. Table will use t1.xml
create table t1 (i int) engine=Connect table_type=XML;
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.xml Warning 1105 No file name. Table will use t1.xml
select * from information_schema.tables where create_options like '%table_type=XML%'; select * from information_schema.tables where create_options like '%table_type=XML%';
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=libxml2';
Warnings:
Warning 1105 No file name. Table will use t1.xml
select * from information_schema.tables where create_options like '%table_type=XML%';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT
Warnings:
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1286 Unknown storage engine 'InnoDB'
Warning 1296 Got error 174 'File t1.xml not found' from CONNECT
drop table t1;
...@@ -5,6 +5,8 @@ set sql_mode=""; ...@@ -5,6 +5,8 @@ set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
set sql_mode=default; set sql_mode=default;
connect user,localhost,user,,;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -33,11 +35,13 @@ DROP VIEW v1; ...@@ -33,11 +35,13 @@ DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT'; CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT'; CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES ('sec1','val1'); INSERT INTO t1 VALUES ('sec1','val1');
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -58,10 +62,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -58,10 +62,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE # Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -73,6 +79,8 @@ UPDATE v1 SET val='val11'; ...@@ -73,6 +79,8 @@ UPDATE v1 SET val='val11';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
disconnect user;
connection default;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
DROP USER user@localhost; DROP USER user@localhost;
......
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
connection slave;
SET GLOBAL time_zone='+1:00'; SET GLOBAL time_zone='+1:00';
CREATE TABLE t1 (a int, b char(10)); CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
...@@ -11,6 +15,7 @@ NULL NULL ...@@ -11,6 +15,7 @@ NULL NULL
# #
# Testing errors # Testing errors
# #
connection master;
SET GLOBAL time_zone='+1:00'; SET GLOBAL time_zone='+1:00';
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=unknown'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=unknown';
...@@ -36,10 +41,14 @@ ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unkn ...@@ -36,10 +41,14 @@ ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unkn
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
connection slave;
ALTER TABLE t1 RENAME t1backup; ALTER TABLE t1 RENAME t1backup;
connection master;
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT
connection slave;
ALTER TABLE t1backup RENAME t1; ALTER TABLE t1backup RENAME t1;
connection master;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing SELECT, etc. # Testing SELECT, etc.
...@@ -108,6 +117,7 @@ NULL NULL ...@@ -108,6 +117,7 @@ NULL NULL
2 0 2 0
3 0 3 0
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing numeric data types # Testing numeric data types
...@@ -126,6 +136,7 @@ t1 CREATE TABLE `t1` ( ...@@ -126,6 +136,7 @@ t1 CREATE TABLE `t1` (
`h` decimal(20,5) DEFAULT NULL `h` decimal(20,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265);
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -144,6 +155,7 @@ SELECT * FROM t1; ...@@ -144,6 +155,7 @@ SELECT * FROM t1;
a b c d e f g h a b c d e f g h
100 3333 41235 1234567890 235000000000 3 3 3141.59265 100 3333 41235 1234567890 235000000000 3 3 3141.59265
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing character data types # Testing character data types
...@@ -159,6 +171,7 @@ INSERT INTO t1 VALUES('Welcome','Hello, World'); ...@@ -159,6 +171,7 @@ INSERT INTO t1 VALUES('Welcome','Hello, World');
SELECT * FROM t1; SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -171,6 +184,7 @@ SELECT * FROM t1; ...@@ -171,6 +184,7 @@ SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing temporal data types # Testing temporal data types
...@@ -182,10 +196,10 @@ t1 CREATE TABLE `t1` ( ...@@ -182,10 +196,10 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
Warnings: Warnings:
Note 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'c' at row 1 Note 1265 Data truncated for column 'c' at row 1
...@@ -193,6 +207,7 @@ Warning 1265 Data truncated for column 'e' at row 1 ...@@ -193,6 +207,7 @@ Warning 1265 Data truncated for column 'e' at row 1
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -201,13 +216,15 @@ t1 CREATE TABLE `t1` ( ...@@ -201,13 +216,15 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`='JDBC' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`='JDBC'
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 11:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 11:45:23 10:45:23 2003-05-27 10:45:23 2003
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL time_zone=SYSTEM; SET GLOBAL time_zone=SYSTEM;
connection master;
SET GLOBAL time_zone=SYSTEM; SET GLOBAL time_zone=SYSTEM;
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE TABLE t1 ( CREATE TABLE t1 (
`id` int(20) primary key, `id` int(20) primary key,
`group` int NOT NULL default 1, `group` int NOT NULL default 1,
...@@ -7,14 +12,15 @@ CREATE TABLE t1 ( ...@@ -7,14 +12,15 @@ CREATE TABLE t1 (
`a\\` int unsigned, `a\\` int unsigned,
`name` varchar(32) default 'name') `name` varchar(32) default 'name')
DEFAULT CHARSET=latin1; DEFAULT CHARSET=latin1;
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` int(20) NOT NULL, `id` int(20) NOT NULL,
`group` int(11) NOT NULL DEFAULT '1', `group` int(11) NOT NULL DEFAULT 1,
`a\\b` int(11) NOT NULL DEFAULT '2', `a\\b` int(11) NOT NULL DEFAULT 2,
`a\\` int(10) unsigned DEFAULT NULL, `a\\` int(10) unsigned DEFAULT NULL,
`name` varchar(32) DEFAULT 'name' `name` varchar(32) DEFAULT 'name'
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL'
...@@ -25,12 +31,15 @@ id group a\\b a\\ name ...@@ -25,12 +31,15 @@ id group a\\b a\\ name
1 1 2 NULL foo 1 1 2 NULL foo
2 1 2 NULL fee 2 1 2 NULL fee
DROP TABLE t1; DROP TABLE t1;
connection slave;
SELECT * FROM t1; SELECT * FROM t1;
id group a\\b a\\ name id group a\\b a\\ name
1 1 2 NULL foo 1 1 2 NULL foo
2 1 2 NULL fee 2 1 2 NULL fee
DROP TABLE t1; DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
# #
# Checking Sending Commands # Checking Sending Commands
# #
connection master;
CREATE TABLE t1 ( CREATE TABLE t1 (
command VARCHAR(128) NOT NULL, command VARCHAR(128) NOT NULL,
warnings INT(4) NOT NULL FLAG=3, warnings INT(4) NOT NULL FLAG=3,
...@@ -15,7 +20,7 @@ SELECT * FROM t1 WHERE command IN ('Warning','Note', ...@@ -15,7 +20,7 @@ SELECT * FROM t1 WHERE command IN ('Warning','Note',
"insert into t1(msg) values('One'),(NULL),('Three')", "insert into t1(msg) values('One'),(NULL),('Three')",
"insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'", "insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'",
"insert into t1(message) values('Four'),('Five'),('Six')", "insert into t1(message) values('Four'),('Five'),('Six')",
'insert into t1(id) values(NULL)', 'insert ignore into t1(id) values(NULL)',
"update t1 set msg = 'Four' where id = 4", "update t1 set msg = 'Four' where id = 4",
'select * from t1'); 'select * from t1');
command warnings number message command warnings number message
...@@ -26,7 +31,7 @@ insert into t1(msg) values('One'),(NULL),('Three') 1 3 Affected rows ...@@ -26,7 +31,7 @@ insert into t1(msg) values('One'),(NULL),('Three') 1 3 Affected rows
Warning 0 1048 Column 'msg' cannot be null Warning 0 1048 Column 'msg' cannot be null
insert into t1 values(2,'Deux') on duplicate key update msg = 'Two' 0 2 Affected rows insert into t1 values(2,'Deux') on duplicate key update msg = 'Two' 0 2 Affected rows
insert into t1(message) values('Four'),('Five'),('Six') 0 1054 Remote: Unknown column 'message' in 'field list' insert into t1(message) values('Four'),('Five'),('Six') 0 1054 Remote: Unknown column 'message' in 'field list'
insert into t1(id) values(NULL) 1 1 Affected rows insert ignore into t1(id) values(NULL) 1 1 Affected rows
Warning 0 1364 Field 'msg' doesn't have a default value Warning 0 1364 Field 'msg' doesn't have a default value
update t1 set msg = 'Four' where id = 4 0 1 Affected rows update t1 set msg = 'Four' where id = 4 0 1 Affected rows
select * from t1 0 2 Result set columns select * from t1 0 2 Result set columns
...@@ -39,15 +44,16 @@ Note 1305 PROCEDURE test.p1 does not exist ...@@ -39,15 +44,16 @@ Note 1305 PROCEDURE test.p1 does not exist
CREATE PROCEDURE p1(cmd varchar(512)) CREATE PROCEDURE p1(cmd varchar(512))
READS SQL DATA READS SQL DATA
SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd); SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd);
CALL p1('insert into t1(id) values(NULL)'); CALL p1('insert ignore into t1(id) values(NULL)');
command warnings number message command warnings number message
insert into t1(id) values(NULL) 1 1 Affected rows insert ignore into t1(id) values(NULL) 1 1 Affected rows
Warning 0 1364 Field 'msg' doesn't have a default value Warning 0 1364 Field 'msg' doesn't have a default value
CALL p1('update t1 set msg = "Five" where id = 5'); CALL p1('update t1 set msg = "Five" where id = 5');
command warnings number message command warnings number message
update t1 set msg = "Five" where id = 5 0 1 Affected rows update t1 set msg = "Five" where id = 5 0 1 Affected rows
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
connection slave;
SELECT * FROM t1; SELECT * FROM t1;
id msg id msg
1 One 1 One
...@@ -56,7 +62,9 @@ id msg ...@@ -56,7 +62,9 @@ id msg
4 Four 4 Four
5 Five 5 Five
DROP TABLE t1; DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
...@@ -5,11 +5,14 @@ set sql_mode=""; ...@@ -5,11 +5,14 @@ set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
set sql_mode=default; set sql_mode=default;
connect user,localhost,user,,;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=PORT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=PORT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
...@@ -21,6 +24,7 @@ a ...@@ -21,6 +24,7 @@ a
10 10
20 20
30 30
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -39,10 +43,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -39,10 +43,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE # Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -54,6 +60,8 @@ UPDATE v1 SET a=123; ...@@ -54,6 +60,8 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
disconnect user;
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
......
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE TABLE t1 (a int, b char(10)); CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
SELECT * FROM t1; SELECT * FROM t1;
...@@ -12,6 +17,7 @@ NULL NULL ...@@ -12,6 +17,7 @@ NULL NULL
# #
# Testing errors # Testing errors
# #
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://unknown@127.0.0.1:SLAVE_PORT/test/t1'; CONNECTION='mysql://unknown@127.0.0.1:SLAVE_PORT/test/t1';
ERROR HY000: (1045) Access denied for user 'unknown'@'localhost' (using password: NO) ERROR HY000: (1045) Access denied for user 'unknown'@'localhost' (using password: NO)
...@@ -39,10 +45,14 @@ ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x ...@@ -39,10 +45,14 @@ ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
connection slave;
ALTER TABLE t1 RENAME t1backup; ALTER TABLE t1 RENAME t1backup;
connection master;
SELECT * FROM t1; SELECT * FROM t1;
ERROR HY000: Got error 174 '(1146) Table 'test.t1' doesn't exist [SELECT `a`, `b` FROM `t1`]' from CONNECT ERROR HY000: Got error 174 '(1146) Table 'test.t1' doesn't exist [SELECT `a`, `b` FROM `t1`]' from CONNECT
connection slave;
ALTER TABLE t1backup RENAME t1; ALTER TABLE t1backup RENAME t1;
connection master;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing SELECT, etc. # Testing SELECT, etc.
...@@ -111,6 +121,7 @@ NULL NULL ...@@ -111,6 +121,7 @@ NULL NULL
2 0 2 0
3 0 3 0
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing numeric data types # Testing numeric data types
...@@ -129,6 +140,7 @@ t1 CREATE TABLE `t1` ( ...@@ -129,6 +140,7 @@ t1 CREATE TABLE `t1` (
`h` decimal(20,5) DEFAULT NULL `h` decimal(20,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265);
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT'; OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -147,6 +159,7 @@ SELECT * FROM t1; ...@@ -147,6 +159,7 @@ SELECT * FROM t1;
a b c d e f g h a b c d e f g h
100 3333 41235 1234567890 235000000000 3.14159 3.14159265 3141.59265 100 3333 41235 1234567890 235000000000 3.14159 3.14159265 3141.59265
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing character data types # Testing character data types
...@@ -162,6 +175,7 @@ INSERT INTO t1 VALUES('Welcome','Hello, World'); ...@@ -162,6 +175,7 @@ INSERT INTO t1 VALUES('Welcome','Hello, World');
SELECT * FROM t1; SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -174,6 +188,7 @@ SELECT * FROM t1; ...@@ -174,6 +188,7 @@ SELECT * FROM t1;
a b a b
Welcome Hello, World Welcome Hello, World
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
# #
# Testing temporal data types # Testing temporal data types
...@@ -185,10 +200,10 @@ t1 CREATE TABLE `t1` ( ...@@ -185,10 +200,10 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
Warnings: Warnings:
Note 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 1
Note 1265 Data truncated for column 'c' at row 1 Note 1265 Data truncated for column 'c' at row 1
...@@ -196,6 +211,7 @@ Warning 1265 Data truncated for column 'e' at row 1 ...@@ -196,6 +211,7 @@ Warning 1265 Data truncated for column 'e' at row 1
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT'; CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -204,15 +220,18 @@ t1 CREATE TABLE `t1` ( ...@@ -204,15 +220,18 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL, `a` date DEFAULT NULL,
`b` datetime DEFAULT NULL, `b` datetime DEFAULT NULL,
`c` time DEFAULT NULL, `c` time DEFAULT NULL,
`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`e` year(4) DEFAULT NULL `e` year(4) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL'
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003
DROP TABLE t1; DROP TABLE t1;
connection slave;
DROP TABLE t1; DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
...@@ -27,13 +27,13 @@ UPDATE t1 SET e = d; ...@@ -27,13 +27,13 @@ UPDATE t1 SET e = d;
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
255 65535 4294967295 18446744073709551615 18446744073709551615 255 65535 4294967295 18446744073709551615 18446744073709551615
UPDATE t1 SET c = d; UPDATE IGNORE t1 SET c = d;
Warnings: Warnings:
Warning 1264 Out of range value for column 'c' at row 1 Warning 1264 Out of range value for column 'c' at row 1
SELECT * FROM t1; SELECT * FROM t1;
a b c d e a b c d e
255 65535 4294967295 18446744073709551615 18446744073709551615 255 65535 4294967295 18446744073709551615 18446744073709551615
UPDATE t1 SET c = e; UPDATE IGNORE t1 SET c = e;
Warnings: Warnings:
Warning 1264 Out of range value for column 'c' at row 1 Warning 1264 Out of range value for column 'c' at row 1
SELECT * FROM t1; SELECT * FROM t1;
......
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE TABLE employee CREATE TABLE employee
( (
serialno CHAR(5) NOT NULL, serialno CHAR(5) NOT NULL,
...@@ -1625,3 +1626,4 @@ serialno name sex title manager department secretary salary ...@@ -1625,3 +1626,4 @@ serialno name sex title manager department secretary salary
# #
DROP PROCEDURE test.tst_up; DROP PROCEDURE test.tst_up;
DROP TABLE employee; DROP TABLE employee;
SET sql_mode = DEFAULT;
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8; SET NAMES utf8;
# #
# Testing tag values # Testing tag values
...@@ -12,7 +10,7 @@ TRANSLATOR CHAR(40), ...@@ -12,7 +10,7 @@ TRANSLATOR CHAR(40),
PUBLISHER CHAR(40), PUBLISHER CHAR(40),
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
AUTHOR Jean-Christophe Bernadac AUTHOR Jean-Christophe Bernadac
TITLE Construire une application XML TITLE Construire une application XML
...@@ -36,7 +34,7 @@ TRANSLATOR CHAR(40), ...@@ -36,7 +34,7 @@ TRANSLATOR CHAR(40),
PUBLISHER CHAR(40), PUBLISHER CHAR(40),
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
author NULL author NULL
TITLE Construire une application XML TITLE Construire une application XML
...@@ -57,7 +55,7 @@ ISBN CHAR(15), ...@@ -57,7 +55,7 @@ ISBN CHAR(15),
LANG CHAR(2), LANG CHAR(2),
SUBJECT CHAR(32) SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2'; OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
ISBN 9782212090819 ISBN 9782212090819
LANG fr LANG fr
...@@ -74,7 +72,7 @@ isbn CHAR(15), ...@@ -74,7 +72,7 @@ isbn CHAR(15),
LANG CHAR(2), LANG CHAR(2),
SUBJECT CHAR(32) SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2'; OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
isbn NULL isbn NULL
LANG fr LANG fr
...@@ -97,7 +95,7 @@ PUBLISHER CHAR(40), ...@@ -97,7 +95,7 @@ PUBLISHER CHAR(40),
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK' TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
ISBN 9782212090819 ISBN 9782212090819
LANG fr LANG fr
...@@ -130,7 +128,7 @@ PUBLISHER CHAR(40), ...@@ -130,7 +128,7 @@ PUBLISHER CHAR(40),
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.xml'
TABNAME='BIBLIO' TABNAME='BIBLIO'
OPTION_LIST='rownode=BOOK,xmlsup=libxml2'; OPTION_LIST='rownode=BOOK,xmlsup=domdoc';
INSERT INTO t1 (ISBN, LANG, SUBJECT, AUTHOR, TITLE, PUBLISHEr, DATEPUB) INSERT INTO t1 (ISBN, LANG, SUBJECT, AUTHOR, TITLE, PUBLISHEr, DATEPUB)
VALUES('9782212090529','fr','général','Alain Michard', VALUES('9782212090529','fr','général','Alain Michard',
'XML, Langage et Applications','Eyrolles Paris',1998); 'XML, Langage et Applications','Eyrolles Paris',1998);
...@@ -160,47 +158,47 @@ TRANSLATOR NULL ...@@ -160,47 +158,47 @@ TRANSLATOR NULL
PUBLISHER Eyrolles Paris PUBLISHER Eyrolles Paris
DATEPUB 1998 DATEPUB 1998
SELECT LOAD_FILE('MYSQLD_DATADIR/test/xsample2.xml') AS xml; SELECT LOAD_FILE('MYSQLD_DATADIR/test/xsample2.xml') AS xml;
xml <?xml version="1.0" encoding="UTF-8"?> xml <?xml version="1.0" encoding="UTF-8"?>
<BIBLIO SUBJECT="XML"> <BIBLIO SUBJECT="XML">
<BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications"> <BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications">
<AUTHOR> <AUTHOR>
<FIRSTNAME>Jean-Christophe</FIRSTNAME> <FIRSTNAME>Jean-Christophe</FIRSTNAME>
<LASTNAME>Bernadac</LASTNAME> <LASTNAME>Bernadac</LASTNAME>
</AUTHOR> </AUTHOR>
<AUTHOR> <AUTHOR>
<FIRSTNAME>François</FIRSTNAME> <FIRSTNAME>François</FIRSTNAME>
<LASTNAME>Knab</LASTNAME> <LASTNAME>Knab</LASTNAME>
</AUTHOR> </AUTHOR>
<TITLE>Construire une application XML</TITLE> <TITLE>Construire une application XML</TITLE>
<PUBLISHER> <PUBLISHER>
<NAME>Eyrolles</NAME> <NAME>Eyrolles</NAME>
<PLACE>Paris</PLACE> <PLACE>Paris</PLACE>
</PUBLISHER> </PUBLISHER>
<DATEPUB>1999</DATEPUB> <DATEPUB>1999</DATEPUB>
</BOOK> </BOOK>
<BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications"> <BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications">
<AUTHOR> <AUTHOR>
<FIRSTNAME>William J.</FIRSTNAME> <FIRSTNAME>William J.</FIRSTNAME>
<LASTNAME>Pardi</LASTNAME> <LASTNAME>Pardi</LASTNAME>
</AUTHOR> </AUTHOR>
<TRANSLATOR PREFIX="adapté de l'anglais par"> <TRANSLATOR PREFIX="adapté de l'anglais par">
<FIRSTNAME>James</FIRSTNAME> <FIRSTNAME>James</FIRSTNAME>
<LASTNAME>Guerin</LASTNAME> <LASTNAME>Guerin</LASTNAME>
</TRANSLATOR> </TRANSLATOR>
<TITLE>XML en Action</TITLE> <TITLE>XML en Action</TITLE>
<PUBLISHER> <PUBLISHER>
<NAME>Microsoft Press</NAME> <NAME>Microsoft Press</NAME>
<PLACE>Paris</PLACE> <PLACE>Paris</PLACE>
</PUBLISHER> </PUBLISHER>
<DATEPUB>1999</DATEPUB> <DATEPUB>1999</DATEPUB>
</BOOK> </BOOK>
<BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général"> <BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général">
<AUTHOR>Alain Michard</AUTHOR> <AUTHOR>Alain Michard</AUTHOR>
<TITLE>XML, Langage et Applications</TITLE> <TITLE>XML, Langage et Applications</TITLE>
<PUBLISHER>Eyrolles Paris</PUBLISHER> <PUBLISHER>Eyrolles Paris</PUBLISHER>
<DATEPUB>1998</DATEPUB> <DATEPUB>1998</DATEPUB>
</BOOK> </BOOK>
</BIBLIO> </BIBLIO>
DROP TABLE t1; DROP TABLE t1;
# #
...@@ -220,7 +218,7 @@ publisher CHAR(20) FIELD_FORMAT='PUBLISHER/NAME', ...@@ -220,7 +218,7 @@ publisher CHAR(20) FIELD_FORMAT='PUBLISHER/NAME',
location CHAR(20) FIELD_FORMAT='PUBLISHER/PLACE', location CHAR(20) FIELD_FORMAT='PUBLISHER/PLACE',
year INT(4) FIELD_FORMAT='DATEPUB' year INT(4) FIELD_FORMAT='DATEPUB'
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=libxml2'; TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
isbn 9782212090819 isbn 9782212090819
language fr language fr
...@@ -262,7 +260,7 @@ CREATE TABLE t1 ...@@ -262,7 +260,7 @@ CREATE TABLE t1
( (
isbn CHAR(15) FIELD_FORMAT='@isbn' isbn CHAR(15) FIELD_FORMAT='@isbn'
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=libxml2'; TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
isbn NULL isbn NULL
isbn NULL isbn NULL
...@@ -274,20 +272,20 @@ CREATE TABLE t1 ...@@ -274,20 +272,20 @@ CREATE TABLE t1
( (
c CHAR(16) c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2' OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=latin1; DATA_CHARSET=latin1;
ERROR HY000: DATA_CHARSET='latin1' is not supported for TABLE_TYPE=XML ERROR HY000: DATA_CHARSET='latin1' is not supported for TABLE_TYPE=XML
CREATE TABLE t1 CREATE TABLE t1
( (
c CHAR(16) c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2' OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=utf8; DATA_CHARSET=utf8;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table t1 Table t1
Create Table CREATE TABLE `t1` ( Create Table CREATE TABLE `t1` (
`c` char(16) DEFAULT NULL `c` char(16) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=XML `FILE_NAME`='latin1.xml' `OPTION_LIST`='xmlsup=libxml2' `DATA_CHARSET`=utf8 ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=XML `FILE_NAME`='latin1.xml' `OPTION_LIST`='xmlsup=domdoc' `DATA_CHARSET`=utf8
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
c ÁÂÃÄÅÆÇ c ÁÂÃÄÅÆÇ
HEX(c) C1C2C3C4C5C6C7 HEX(c) C1C2C3C4C5C6C7
...@@ -296,7 +294,7 @@ CREATE TABLE t1 ...@@ -296,7 +294,7 @@ CREATE TABLE t1
( (
c CHAR(16) c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
c ÁÂÃÄÅÆÇ c ÁÂÃÄÅÆÇ
HEX(c) C1C2C3C4C5C6C7 HEX(c) C1C2C3C4C5C6C7
...@@ -305,7 +303,7 @@ CREATE TABLE t1 ...@@ -305,7 +303,7 @@ CREATE TABLE t1
( (
c CHAR(16) CHARACTER SET utf8 c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
c ÁÂÃÄÅÆÇ c ÁÂÃÄÅÆÇ
HEX(c) C381C382C383C384C385C386C387 HEX(c) C381C382C383C384C385C386C387
...@@ -318,7 +316,7 @@ CREATE TABLE t1 ...@@ -318,7 +316,7 @@ CREATE TABLE t1
( (
c CHAR(16) CHARACTER SET cp1251 c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
c ??????? c ???????
HEX(c) 3F3F3F3F3F3F3F HEX(c) 3F3F3F3F3F3F3F
...@@ -333,44 +331,13 @@ DROP TABLE t1; ...@@ -333,44 +331,13 @@ DROP TABLE t1;
# #
# Testing Cyrillic # Testing Cyrillic
# #
CREATE TABLE t1
(
c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml'
OPTION_LIST='xmlsup=libxml2,rownode=b';
SELECT * FROM t1;
c БВГДЕЖЗ
INSERT INTO t1 VALUES ('ИКЛМН');
SELECT c, HEX(c) FROM t1;
c БВГДЕЖЗ
HEX(c) D091D092D093D094D095D096D097
c ИКЛМН
HEX(c) D098D09AD09BD09CD09D
DROP TABLE t1;
CREATE TABLE t1
(
c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml'
OPTION_LIST='xmlsup=libxml2,rownode=b';
SELECT * FROM t1;
c БВГДЕЖЗ
c ИКЛМН
INSERT INTO t1 VALUES ('ОПРСТ');
SELECT c, HEX(c) FROM t1;
c БВГДЕЖЗ
HEX(c) C1C2C3C4C5C6C7
c ИКЛМН
HEX(c) C8CACBCCCD
c ОПРСТ
HEX(c) CECFD0D1D2
DROP TABLE t1;
# #
# Testing that the underlying file is created with a proper Encoding # Testing that the underlying file is created with a proper Encoding
# #
CREATE TABLE t1 (node VARCHAR(50)) CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1 CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml' ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=utf-8'; OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=utf-8';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3); INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1; SELECT node, hex(node) FROM t1;
node ÀÁÂÃ node ÀÁÂÃ
...@@ -384,7 +351,7 @@ HEX(EXTRACTVALUE(@a,'/t1/line/node')) C380C381C382C383 ...@@ -384,7 +351,7 @@ HEX(EXTRACTVALUE(@a,'/t1/line/node')) C380C381C382C383
CREATE TABLE t1 (node VARCHAR(50)) CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1 CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml' ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1'; OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3); INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1; SELECT node, hex(node) FROM t1;
node ÀÁÂÃ node ÀÁÂÃ
...@@ -401,31 +368,26 @@ HEX(EXTRACTVALUE(@a,'/t1/line/node')) C0C1C2C3 ...@@ -401,31 +368,26 @@ HEX(EXTRACTVALUE(@a,'/t1/line/node')) C0C1C2C3
CREATE TABLE t1 (node VARCHAR(50)) CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET utf8 CHARACTER SET utf8
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml' ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1'; OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3); INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3); INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
Warnings:
Level Warning
Code 1105
Message Com error: Impossible d'enregistrer le caractre dans le codage iso-8859-1.
INSERT INTO t1 VALUES ('&<>"\''); INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1; SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C380C381C382C383
node АБВГ
hex(node) D090D091D092D093
node &<>"' node &<>"'
hex(node) 263C3E2227 hex(node) 263C3E2227
DROP TABLE t1; DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml'); SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1); SELECT CAST(@a AS CHAR CHARACTER SET latin1);
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?> CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by the MariaDB CONNECT Storage Engine--> <!-- Created by the MariaDB CONNECT Storage Engine-->
<t1> <t1>
<line> <line>
<node>ÀÁÂÃ</node> <node>&amp;&lt;&gt;"'</node>
</line> </line>
<line> </t1>
<node>&#1040;&#1041;&#1042;&#1043;</node>
</line>
<line>
<node>&amp;&lt;&gt;"'</node>
</line>
</t1>
This diff is collapsed.
Warnings:
Warning 1105 No file name. Table will use t1.xml
#
# Beginning of grant.inc
#
CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
SELECT user();
user()
user@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row';
Warnings:
Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
a
10
UPDATE t1 SET a=20;
SELECT * FROM t1;
a
20
DELETE FROM t1;
SELECT * FROM t1;
a
INSERT INTO t1 VALUES(10);
TRUNCATE TABLE t1;
SELECT * FROM t1;
a
CREATE VIEW v1 AS SELECT * FROM t1;
SELECT * FROM v1;
a
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row' FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row' FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
INSERT INTO t1 VALUES (10);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE t1 SET a=20;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 READONLY=1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
ALTER TABLE t1 FILE_NAME='t2.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
SELECT user();
user()
user@localhost
SELECT * FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1 VALUES (2);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT user();
user()
root@localhost
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row';
Warnings:
Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10);
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP TABLE t1;
DROP USER user@localhost;
#
# End of grant.inc
#
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing HTML like XML file
#
CREATE TABLE beers (
`Name` CHAR(16) FIELD_FORMAT='brandName',
`Origin` CHAR(16) FIELD_FORMAT='origin',
`Description` CHAR(32) FIELD_FORMAT='details')
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml'
TABNAME='table' OPTION_LIST='xmlsup=libxml2,rownode=tr,colnode=td';
SELECT * FROM beers;
Name Origin Description
Huntsman Bath, UK Wonderful hop, light alcohol
Tuborg Danmark In small bottles
DROP TABLE beers;
#
# Testing HTML file
#
CREATE TABLE coffee (
`Name` CHAR(16),
`Cups` INT(8),
`Type` CHAR(16),
`Sugar` CHAR(4))
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm'
TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=libxml2,Coltype=HTML';
SELECT * FROM coffee;
Name Cups Type Sugar
T. Sexton 10 Espresso No
J. Dinnen 5 Decaf Yes
DROP TABLE coffee;
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
ERROR HY000: Table type XML is not indexable
CREATE TABLE t1 (i INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
DESCRIBE t1;
Field Type Null Key Default Extra
i int(11) NO NULL
ALTER TABLE t1 ADD UNIQUE(i);
ERROR HY000: Table type XML is not indexable
CREATE UNIQUE INDEX i ON t1(i);
ERROR HY000: Table type XML is not indexable
DESCRIBE t1;
Field Type Null Key Default Extra
i int(11) NO NULL
INSERT INTO t1 VALUES(2),(5),(7);
SELECT * FROM t1 WHERE i = 5;
i
5
ALTER TABLE t1 DROP INDEX i;
ERROR 42000: Can't DROP 'i'; check that column/key exists
DROP INDEX i ON t1;
ERROR 42000: Can't DROP 'i'; check that column/key exists
DROP TABLE t1;
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing expanded values
#
CREATE TABLE `bookstore` (
`category` CHAR(16) NOT NULL FIELD_FORMAT='@',
`title` VARCHAR(50) NOT NULL,
`lang` char(2) NOT NULL FIELD_FORMAT='title/@',
`author` VARCHAR(24) NOT NULL,
`year` INT(4) NOT NULL,
`price` DOUBLE(8,2) NOT NULL)
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=libxml2';
SELECT * FROM bookstore;
category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
CHILDREN Harry Potter en J K. Rowling 2005 29.99
WEB XQuery Kick Start en James McGovern 2003 49.99
WEB XQuery Kick Start en Per Bothner 2003 49.99
WEB XQuery Kick Start en Kurt Cagle 2003 49.99
WEB XQuery Kick Start en James Linn 2003 49.99
WEB XQuery Kick Start en Vaidyanathan Nagarajan 2003 49.99
WEB Learning XML en Erik T. Ray 2003 39.95
SELECT category, title, price FROM bookstore;
category title price
COOKING Everyday Italian 30.00
CHILDREN Harry Potter 29.99
WEB XQuery Kick Start 49.99
WEB Learning XML 39.95
SELECT category, title, author, price FROM bookstore WHERE author LIKE '%K%';
category title author price
CHILDREN Harry Potter J K. Rowling 29.99
WEB XQuery Kick Start Kurt Cagle 49.99
WEB Learning XML Erik T. Ray 39.95
SELECT category, title, price FROM bookstore WHERE author LIKE 'J%';
category title price
CHILDREN Harry Potter 29.99
WEB XQuery Kick Start 49.99
WEB XQuery Kick Start 49.99
#
# Limiting expanded values
#
ALTER TABLE bookstore OPTION_LIST='expand=1,mulnode=author,limit=3,xmlsup=libxml2';
SELECT * FROM bookstore;
category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
CHILDREN Harry Potter en J K. Rowling 2005 29.99
WEB XQuery Kick Start en James McGovern 2003 49.99
WEB XQuery Kick Start en Per Bothner 2003 49.99
WEB XQuery Kick Start en Kurt Cagle 2003 49.99
WEB Learning XML en Erik T. Ray 2003 39.95
Warnings:
Warning 1105 Mutiple values limited to 3
# One line lost because the where clause is applied only on the first 3 rows
SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
category title author price
CHILDREN Harry Potter J K. Rowling 29.99
WEB XQuery Kick Start James McGovern 49.99
Warnings:
Warning 1105 Mutiple values limited to 3
#
# Testing concatenated values
#
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=6,xmlsup=libxml2';
# truncated
SELECT * FROM bookstore;
category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
CHILDREN Harry Potter en J K. Rowling 2005 29.99
WEB XQuery Kick Start en James McGovern, Per Both 2003 49.99
WEB Learning XML en Erik T. Ray 2003 39.95
Warnings:
Warning 1105 Truncated author content
# increase author size
ALTER TABLE bookstore MODIFY `author` VARCHAR(128) NOT NULL;
SELECT * FROM bookstore;
category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
CHILDREN Harry Potter en J K. Rowling 2005 29.99
WEB XQuery Kick Start en James McGovern, Per Bothner, Kurt Cagle, James Linn, Vaidyanathan Nagarajan 2003 49.99
WEB Learning XML en Erik T. Ray 2003 39.95
#
# Limiting concatenated values
#
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=4,xmlsup=libxml2';
SELECT * FROM bookstore;
category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
CHILDREN Harry Potter en J K. Rowling 2005 29.99
WEB XQuery Kick Start en James McGovern, Per Bothner, Kurt Cagle, James Linn 2003 49.99
WEB Learning XML en Erik T. Ray 2003 39.95
Warnings:
Warning 1105 Mutiple values limited to 4
# The where clause is applied on the concatenated column result
SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
category title author price
CHILDREN Harry Potter J K. Rowling 29.99
WEB XQuery Kick Start James McGovern, Per Bothner, Kurt Cagle, James Linn 49.99
Warnings:
Warning 1105 Mutiple values limited to 4
DROP TABLE bookstore;
Warnings:
Warning 1105 No file name. Table will use t1.xml
#
# Testing zipped XML tables
#
CREATE TABLE t1 (
ISBN CHAR(13) NOT NULL FIELD_FORMAT='@',
LANG CHAR(2) NOT NULL FIELD_FORMAT='@',
SUBJECT CHAR(12) NOT NULL FIELD_FORMAT='@',
AUTHOR_FIRSTNAME CHAR(15) NOT NULL FIELD_FORMAT='AUTHOR/FIRSTNAME',
AUTHOR_LASTNAME CHAR(8) NOT NULL FIELD_FORMAT='AUTHOR/LASTNAME',
TRANSLATOR_PREFIX CHAR(24) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/@PREFIX',
TRANSLATOR_FIRSTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/FIRSTNAME',
TRANSLATOR_LASTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/LASTNAME',
TITLE CHAR(30) NOT NULL,
PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME',
PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE',
DATEPUB CHAR(4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=libxml2,expand=1,mulnode=AUTHOR';
SELECT * FROM t1;
ISBN 9782212090819
LANG fr
SUBJECT applications
AUTHOR_FIRSTNAME Jean-Christophe
AUTHOR_LASTNAME Bernadac
TRANSLATOR_PREFIX NULL
TRANSLATOR_FIRSTNAME NULL
TRANSLATOR_LASTNAME NULL
TITLE Construire une application XML
PUBLISHER_NAME Eyrolles
PUBLISHER_PLACE Paris
DATEPUB 1999
ISBN 9782212090819
LANG fr
SUBJECT applications
AUTHOR_FIRSTNAME Franois
AUTHOR_LASTNAME Knab
TRANSLATOR_PREFIX NULL
TRANSLATOR_FIRSTNAME NULL
TRANSLATOR_LASTNAME NULL
TITLE Construire une application XML
PUBLISHER_NAME Eyrolles
PUBLISHER_PLACE Paris
DATEPUB 1999
ISBN 9782840825685
LANG fr
SUBJECT applications
AUTHOR_FIRSTNAME William J.
AUTHOR_LASTNAME Pardi
TRANSLATOR_PREFIX adapt de l'anglais par
TRANSLATOR_FIRSTNAME James
TRANSLATOR_LASTNAME Guerin
TITLE XML en Action
PUBLISHER_NAME Microsoft Press
PUBLISHER_PLACE Paris
DATEPUB 1999
ISBN 9782212090529
LANG fr
SUBJECT gnral
AUTHOR_FIRSTNAME Alain
AUTHOR_LASTNAME Michard
TRANSLATOR_PREFIX NULL
TRANSLATOR_FIRSTNAME NULL
TRANSLATOR_LASTNAME NULL
TITLE XML, Langage et Applications
PUBLISHER_NAME Eyrolles
PUBLISHER_PLACE Paris
DATEPUB 2003
CREATE TABLE t2
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='xmlsup=libxml2';
SELECT * FROM t2;
ISBN 9782212090819
LANG fr
SUBJECT applications
AUTHOR Jean-Christophe Bernadac
TRANSLATOR NULL
TITLE Construire une application XML
PUBLISHER Eyrolles Paris
DATEPUB 1999
ISBN 9782840825685
LANG fr
SUBJECT applications
AUTHOR William J. Pardi
TRANSLATOR James Guerin
TITLE XML en Action
PUBLISHER Microsoft Press Paris
DATEPUB 1999
ISBN 9782212090529
LANG fr
SUBJECT gnral
AUTHOR Alain Michard
TRANSLATOR NULL
TITLE XML, Langage et Applications
PUBLISHER Eyrolles Paris
DATEPUB 2003
DROP TABLE t1,t2;
Warnings:
Warning 1105 No file name. Table will use t1.xml
# #
# Beginning of grant.inc # Beginning of grant.inc
# #
CREATE USER user@localhost; CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row';
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.xml Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
...@@ -32,13 +32,15 @@ SELECT * FROM v1; ...@@ -32,13 +32,15 @@ SELECT * FROM v1;
a a
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row' FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row' FILE_NAME='t1.EXT'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -61,10 +63,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ...@@ -61,10 +63,12 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
# Testing a VIEW created with FILE privileges but accessed with no FILE # Testing a VIEW created with FILE privileges but accessed with no FILE
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
...@@ -76,21 +80,25 @@ UPDATE v1 SET a=123; ...@@ -76,21 +80,25 @@ UPDATE v1 SET a=123;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1; DELETE FROM v1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user(); SELECT user();
user() user()
root@localhost root@localhost
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row';
Warnings: Warnings:
Warning 1105 No file name. Table will use t1.xml Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
connection user;
SELECT user(); SELECT user();
user() user()
user@localhost user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT'; ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1; DROP TABLE t1;
disconnect user;
DROP USER user@localhost; DROP USER user@localhost;
# #
# End of grant.inc # End of grant.inc
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8; SET NAMES utf8;
# #
# Testing HTML like XML file # Testing HTML like XML file
...@@ -9,7 +7,7 @@ CREATE TABLE beers ( ...@@ -9,7 +7,7 @@ CREATE TABLE beers (
`Origin` CHAR(16) FIELD_FORMAT='origin', `Origin` CHAR(16) FIELD_FORMAT='origin',
`Description` CHAR(32) FIELD_FORMAT='details') `Description` CHAR(32) FIELD_FORMAT='details')
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml' ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml'
TABNAME='table' OPTION_LIST='xmlsup=libxml2,rownode=tr,colnode=td'; TABNAME='table' OPTION_LIST='xmlsup=domdoc,rownode=tr,colnode=td';
SELECT * FROM beers; SELECT * FROM beers;
Name Origin Description Name Origin Description
Huntsman Bath, UK Wonderful hop, light alcohol Huntsman Bath, UK Wonderful hop, light alcohol
...@@ -24,7 +22,7 @@ CREATE TABLE coffee ( ...@@ -24,7 +22,7 @@ CREATE TABLE coffee (
`Type` CHAR(16), `Type` CHAR(16),
`Sugar` CHAR(4)) `Sugar` CHAR(4))
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm' ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm'
TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=libxml2,Coltype=HTML'; TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=domdoc,Coltype=HTML';
SELECT * FROM coffee; SELECT * FROM coffee;
Name Cups Type Sugar Name Cups Type Sugar
T. Sexton 10 Espresso No T. Sexton 10 Espresso No
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8; SET NAMES utf8;
CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N'; CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
ERROR HY000: Table type XML is not indexable ERROR HY000: Table type XML is not indexable
...@@ -19,7 +17,7 @@ SELECT * FROM t1 WHERE i = 5; ...@@ -19,7 +17,7 @@ SELECT * FROM t1 WHERE i = 5;
i i
5 5
ALTER TABLE t1 DROP INDEX i; ALTER TABLE t1 DROP INDEX i;
ERROR 42000: Can't DROP 'i'; check that column/key exists ERROR 42000: Can't DROP INDEX `i`; check that it exists
DROP INDEX i ON t1; DROP INDEX i ON t1;
ERROR 42000: Can't DROP 'i'; check that column/key exists ERROR 42000: Can't DROP INDEX `i`; check that it exists
DROP TABLE t1; DROP TABLE t1;
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8; SET NAMES utf8;
# #
# Testing expanded values # Testing expanded values
...@@ -11,7 +9,7 @@ CREATE TABLE `bookstore` ( ...@@ -11,7 +9,7 @@ CREATE TABLE `bookstore` (
`author` VARCHAR(24) NOT NULL, `author` VARCHAR(24) NOT NULL,
`year` INT(4) NOT NULL, `year` INT(4) NOT NULL,
`price` DOUBLE(8,2) NOT NULL) `price` DOUBLE(8,2) NOT NULL)
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=libxml2'; ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=domdoc';
SELECT * FROM bookstore; SELECT * FROM bookstore;
category title lang author year price category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00 COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
...@@ -41,7 +39,7 @@ WEB XQuery Kick Start 49.99 ...@@ -41,7 +39,7 @@ WEB XQuery Kick Start 49.99
# #
# Limiting expanded values # Limiting expanded values
# #
ALTER TABLE bookstore OPTION_LIST='expand=1,mulnode=author,limit=3,xmlsup=libxml2'; ALTER TABLE bookstore OPTION_LIST='expand=1,mulnode=author,limit=3,xmlsup=domdoc';
SELECT * FROM bookstore; SELECT * FROM bookstore;
category title lang author year price category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00 COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
...@@ -62,7 +60,7 @@ Warning 1105 Mutiple values limited to 3 ...@@ -62,7 +60,7 @@ Warning 1105 Mutiple values limited to 3
# #
# Testing concatenated values # Testing concatenated values
# #
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=6,xmlsup=libxml2'; ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=6,xmlsup=domdoc';
# truncated # truncated
SELECT * FROM bookstore; SELECT * FROM bookstore;
category title lang author year price category title lang author year price
...@@ -83,7 +81,7 @@ WEB Learning XML en Erik T. Ray 2003 39.95 ...@@ -83,7 +81,7 @@ WEB Learning XML en Erik T. Ray 2003 39.95
# #
# Limiting concatenated values # Limiting concatenated values
# #
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=4,xmlsup=libxml2'; ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=4,xmlsup=domdoc';
SELECT * FROM bookstore; SELECT * FROM bookstore;
category title lang author year price category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00 COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
# #
# Testing zipped XML tables # Testing zipped XML tables
# #
...@@ -17,7 +15,7 @@ PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME', ...@@ -17,7 +15,7 @@ PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME',
PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE', PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE',
DATEPUB CHAR(4) NOT NULL DATEPUB CHAR(4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=libxml2,expand=1,mulnode=AUTHOR'; OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=domdoc,expand=1,mulnode=AUTHOR';
SELECT * FROM t1; SELECT * FROM t1;
ISBN 9782212090819 ISBN 9782212090819
LANG fr LANG fr
...@@ -69,7 +67,7 @@ PUBLISHER_PLACE Paris ...@@ -69,7 +67,7 @@ PUBLISHER_PLACE Paris
DATEPUB 2003 DATEPUB 2003
CREATE TABLE t2 CREATE TABLE t2
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t2; SELECT * FROM t2;
ISBN 9782212090819 ISBN 9782212090819
LANG fr LANG fr
......
--source have_libxml2.inc --source windows.inc
--echo # --echo #
--echo # Testing changing table type (not in-place) --echo # Testing changing table type (not in-place)
...@@ -11,7 +11,7 @@ SELECT * FROM t1; ...@@ -11,7 +11,7 @@ SELECT * FROM t1;
--echo # This is because the XML top node name defaults to the table name. --echo # This is because the XML top node name defaults to the table name.
--echo # Sure enough the temporary table name begins with '#' and is rejected by XML. --echo # Sure enough the temporary table name begins with '#' and is rejected by XML.
--echo # Therefore the top node name must be specified (along with the row nodes name). --echo # Therefore the top node name must be specified (along with the row nodes name).
ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row'; ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='xmlsup=domdoc,rownode=row';
SELECT * FROM t1; SELECT * FROM t1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
......
--source have_libxml2.inc
--echo #
--echo # Testing changing table type (not in-place)
--echo #
CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1 QUOTED=1;
INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
SELECT * FROM t1;
--echo # This would fail if the top node name is not specified.
--echo # This is because the XML top node name defaults to the table name.
--echo # Sure enough the temporary table name begins with '#' and is rejected by XML.
--echo # Therefore the top node name must be specified (along with the row nodes name).
ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='xmlsup=libxml2,rownode=row';
SELECT * FROM t1;
SHOW CREATE TABLE t1;
--echo # Let us see the XML file
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
SELECT * FROM t2;
--echo # NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
--echo # Testing field option modification
ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
SELECT * FROM t1;
SHOW CREATE TABLE t1;
SELECT * FROM t2;
DROP TABLE t1, t2;
...@@ -23,9 +23,7 @@ ALTER TABLE t1 OPTION_LIST='subdir=0'; ...@@ -23,9 +23,7 @@ ALTER TABLE t1 OPTION_LIST='subdir=0';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size; SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
# TODO: add a better error message
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('','','',''); INSERT INTO t1 VALUES ('','','','');
DROP TABLE t1; DROP TABLE t1;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
# MDEV-9739 Assertion `m_status == DA_ERROR || m_status == DA_OK' failed in Diagnostics_area::message() ; connect.xml* tests fail in buildbot # MDEV-9739 Assertion `m_status == DA_ERROR || m_status == DA_OK' failed in Diagnostics_area::message() ; connect.xml* tests fail in buildbot
# #
--source have_libxml2.inc --source windows.inc
create table t1 (i int) engine=Connect table_type=XML; create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=domdoc';
select * from information_schema.tables where create_options like '%table_type=XML%'; select * from information_schema.tables where create_options like '%table_type=XML%';
drop table t1; drop table t1;
#
# MDEV-9739 Assertion `m_status == DA_ERROR || m_status == DA_OK' failed in Diagnostics_area::message() ; connect.xml* tests fail in buildbot
#
--source have_libxml2.inc
create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=libxml2';
select * from information_schema.tables where create_options like '%table_type=XML%';
drop table t1;
...@@ -161,7 +161,7 @@ DROP TABLE t1; ...@@ -161,7 +161,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a date, b datetime, c time, d timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, e year); CREATE TABLE t1 (a date, b datetime, c time, d timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, e year);
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
SELECT * FROM t1; SELECT * FROM t1;
connection master; connection master;
......
...@@ -19,7 +19,7 @@ SELECT * FROM t1 WHERE command IN ('Warning','Note', ...@@ -19,7 +19,7 @@ SELECT * FROM t1 WHERE command IN ('Warning','Note',
"insert into t1(msg) values('One'),(NULL),('Three')", "insert into t1(msg) values('One'),(NULL),('Three')",
"insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'", "insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'",
"insert into t1(message) values('Four'),('Five'),('Six')", "insert into t1(message) values('Four'),('Five'),('Six')",
'insert into t1(id) values(NULL)', 'insert ignore into t1(id) values(NULL)',
"update t1 set msg = 'Four' where id = 4", "update t1 set msg = 'Four' where id = 4",
'select * from t1'); 'select * from t1');
...@@ -31,7 +31,7 @@ CREATE PROCEDURE p1(cmd varchar(512)) ...@@ -31,7 +31,7 @@ CREATE PROCEDURE p1(cmd varchar(512))
READS SQL DATA READS SQL DATA
SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd); SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd);
CALL p1('insert into t1(id) values(NULL)'); CALL p1('insert ignore into t1(id) values(NULL)');
CALL p1('update t1 set msg = "Five" where id = 5'); CALL p1('update t1 set msg = "Five" where id = 5');
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
......
...@@ -306,7 +306,7 @@ DROP TABLE t1; ...@@ -306,7 +306,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a date, b datetime, c time, d timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, e year); CREATE TABLE t1 (a date, b datetime, c time, d timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, e year);
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23');
SELECT * FROM t1; SELECT * FROM t1;
connection master; connection master;
......
...@@ -13,9 +13,9 @@ INSERT INTO t1(a,b,c,d) VALUES(255,65535,4294967295,18446744073709551615); ...@@ -13,9 +13,9 @@ INSERT INTO t1(a,b,c,d) VALUES(255,65535,4294967295,18446744073709551615);
SELECT * FROM t1; SELECT * FROM t1;
UPDATE t1 SET e = d; UPDATE t1 SET e = d;
SELECT * FROM t1; SELECT * FROM t1;
UPDATE t1 SET c = d; UPDATE IGNORE t1 SET c = d;
SELECT * FROM t1; SELECT * FROM t1;
UPDATE t1 SET c = e; UPDATE IGNORE t1 SET c = e;
SELECT * FROM t1; SELECT * FROM t1;
UPDATE t1 SET d = e; UPDATE t1 SET d = e;
SELECT * FROM t1; SELECT * FROM t1;
......
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat --copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE TABLE employee CREATE TABLE employee
( (
serialno CHAR(5) NOT NULL, serialno CHAR(5) NOT NULL,
...@@ -150,4 +152,6 @@ CALL test.tst_up(); ...@@ -150,4 +152,6 @@ CALL test.tst_up();
DROP PROCEDURE test.tst_up; DROP PROCEDURE test.tst_up;
DROP TABLE employee; DROP TABLE employee;
SET sql_mode = DEFAULT;
--remove_file $MYSQLD_DATADIR/test/employee.dat --remove_file $MYSQLD_DATADIR/test/employee.dat
--source have_libxml2.inc --source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
...@@ -26,7 +26,7 @@ CREATE TABLE t1 ...@@ -26,7 +26,7 @@ CREATE TABLE t1
PUBLISHER CHAR(40), PUBLISHER CHAR(40),
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -42,7 +42,7 @@ CREATE TABLE t1 ...@@ -42,7 +42,7 @@ CREATE TABLE t1
PUBLISHER CHAR(40), PUBLISHER CHAR(40),
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -55,7 +55,7 @@ CREATE TABLE t1 ( ...@@ -55,7 +55,7 @@ CREATE TABLE t1 (
LANG CHAR(2), LANG CHAR(2),
SUBJECT CHAR(32) SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2'; OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -68,7 +68,7 @@ CREATE TABLE t1 ( ...@@ -68,7 +68,7 @@ CREATE TABLE t1 (
LANG CHAR(2), LANG CHAR(2),
SUBJECT CHAR(32) SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2'; OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -87,7 +87,7 @@ CREATE TABLE t1 ( ...@@ -87,7 +87,7 @@ CREATE TABLE t1 (
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK' TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -108,7 +108,7 @@ CREATE TABLE t1 ( ...@@ -108,7 +108,7 @@ CREATE TABLE t1 (
DATEPUB INT(4) DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.xml'
TABNAME='BIBLIO' TABNAME='BIBLIO'
OPTION_LIST='rownode=BOOK,xmlsup=libxml2'; OPTION_LIST='rownode=BOOK,xmlsup=domdoc';
INSERT INTO t1 (ISBN, LANG, SUBJECT, AUTHOR, TITLE, PUBLISHEr, DATEPUB) INSERT INTO t1 (ISBN, LANG, SUBJECT, AUTHOR, TITLE, PUBLISHEr, DATEPUB)
VALUES('9782212090529','fr','général','Alain Michard', VALUES('9782212090529','fr','général','Alain Michard',
'XML, Langage et Applications','Eyrolles Paris',1998); 'XML, Langage et Applications','Eyrolles Paris',1998);
...@@ -136,7 +136,7 @@ CREATE TABLE t1 ( ...@@ -136,7 +136,7 @@ CREATE TABLE t1 (
location CHAR(20) FIELD_FORMAT='PUBLISHER/PLACE', location CHAR(20) FIELD_FORMAT='PUBLISHER/PLACE',
year INT(4) FIELD_FORMAT='DATEPUB' year INT(4) FIELD_FORMAT='DATEPUB'
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=libxml2'; TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
SELECT isbn, title, translated, tranfn, tranln, location FROM t1 SELECT isbn, title, translated, tranfn, tranln, location FROM t1
WHERE translated <> ''; WHERE translated <> '';
...@@ -180,7 +180,7 @@ CREATE TABLE t1 ...@@ -180,7 +180,7 @@ CREATE TABLE t1
( (
isbn CHAR(15) FIELD_FORMAT='@isbn' isbn CHAR(15) FIELD_FORMAT='@isbn'
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=libxml2'; TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -194,14 +194,14 @@ CREATE TABLE t1 ...@@ -194,14 +194,14 @@ CREATE TABLE t1
( (
c CHAR(16) c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2' OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=latin1; DATA_CHARSET=latin1;
CREATE TABLE t1 CREATE TABLE t1
( (
c CHAR(16) c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2' OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=utf8; DATA_CHARSET=utf8;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
...@@ -211,7 +211,7 @@ CREATE TABLE t1 ...@@ -211,7 +211,7 @@ CREATE TABLE t1
( (
c CHAR(16) c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -219,7 +219,7 @@ CREATE TABLE t1 ...@@ -219,7 +219,7 @@ CREATE TABLE t1
( (
c CHAR(16) CHARACTER SET utf8 c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -232,7 +232,7 @@ CREATE TABLE t1 ...@@ -232,7 +232,7 @@ CREATE TABLE t1
( (
c CHAR(16) CHARACTER SET cp1251 c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml' ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1; SELECT c, HEX(c) FROM t1;
DROP TABLE t1; DROP TABLE t1;
...@@ -240,24 +240,24 @@ DROP TABLE t1; ...@@ -240,24 +240,24 @@ DROP TABLE t1;
--echo # --echo #
--echo # Testing Cyrillic --echo # Testing Cyrillic
--echo # --echo #
CREATE TABLE t1 #CREATE TABLE t1
( #(
c CHAR(16) CHARACTER SET utf8 # c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' #) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml'
OPTION_LIST='xmlsup=libxml2,rownode=b'; # OPTION_LIST='xmlsup=domdoc,rownode=b';
SELECT * FROM t1; #SELECT * FROM t1;
INSERT INTO t1 VALUES ('ИКЛМН'); #INSERT INTO t1 VALUES ('ИКЛМН');
SELECT c, HEX(c) FROM t1; #SELECT c, HEX(c) FROM t1;
DROP TABLE t1; #DROP TABLE t1;
CREATE TABLE t1 #CREATE TABLE t1
( #(
c CHAR(16) CHARACTER SET cp1251 # c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml' #) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml'
OPTION_LIST='xmlsup=libxml2,rownode=b'; # OPTION_LIST='xmlsup=domdoc,rownode=b';
SELECT * FROM t1; #SELECT * FROM t1;
INSERT INTO t1 VALUES ('ОПРСТ'); #INSERT INTO t1 VALUES ('ОПРСТ');
SELECT c, HEX(c) FROM t1; #SELECT c, HEX(c) FROM t1;
DROP TABLE t1; #DROP TABLE t1;
--echo # --echo #
...@@ -266,11 +266,11 @@ DROP TABLE t1; ...@@ -266,11 +266,11 @@ DROP TABLE t1;
CREATE TABLE t1 (node VARCHAR(50)) CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1 CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml' ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=utf-8'; OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=utf-8';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3); INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1; SELECT node, hex(node) FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.xml #--chmod 0777 $MYSQLD_DATADIR/test/t1.xml
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml') --eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml')
SELECT LEFT(@a,38); SELECT LEFT(@a,38);
...@@ -280,11 +280,11 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node')); ...@@ -280,11 +280,11 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
CREATE TABLE t1 (node VARCHAR(50)) CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1 CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml' ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1'; OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3); INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1; SELECT node, hex(node) FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.xml #--chmod 0777 $MYSQLD_DATADIR/test/t1.xml
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml') --eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml')
SELECT LEFT(@a,43); SELECT LEFT(@a,43);
...@@ -298,13 +298,13 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node')); ...@@ -298,13 +298,13 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
CREATE TABLE t1 (node VARCHAR(50)) CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET utf8 CHARACTER SET utf8
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml' ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1'; OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3); INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3); INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
INSERT INTO t1 VALUES ('&<>"\''); INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1; SELECT node, hex(node) FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.xml #--chmod 0777 $MYSQLD_DATADIR/test/t1.xml
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml') --eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml')
SELECT CAST(@a AS CHAR CHARACTER SET latin1); SELECT CAST(@a AS CHAR CHARACTER SET latin1);
......
--source have_libxml2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
SET NAMES utf8;
--vertical_results
--copy_file $MTR_SUITE_DIR/std_data/xsample.xml $MYSQLD_DATADIR/test/xsample.xml
--copy_file $MTR_SUITE_DIR/std_data/latin1.xml $MYSQLD_DATADIR/test/latin1.xml
--copy_file $MTR_SUITE_DIR/std_data/cp1251.xml $MYSQLD_DATADIR/test/cp1251.xml
#--echo $MYSQL_TEST_DIR
#--exec pwd
#SELECT LOAD_FILE('test/xsample.xml');
--echo #
--echo # Testing tag values
--echo #
CREATE TABLE t1
(
AUTHOR CHAR(50),
TITLE CHAR(32),
TRANSLATOR CHAR(40),
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2';
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing that tag names are case sensitive
--echo #
CREATE TABLE t1
(
author CHAR(50),
TITLE CHAR(32),
TRANSLATOR CHAR(40),
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2';
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing attribute values
--echo #
CREATE TABLE t1 (
ISBN CHAR(15),
LANG CHAR(2),
SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2';
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing that attribute names are case sensitive
--echo #
CREATE TABLE t1 (
isbn CHAR(15),
LANG CHAR(2),
SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2';
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing mixed tag and attribute values
--echo #
CREATE TABLE t1 (
ISBN CHAR(15) FIELD_FORMAT='@',
LANG CHAR(2) FIELD_FORMAT='@',
SUBJECT CHAR(32) FIELD_FORMAT='@',
AUTHOR CHAR(50),
TITLE CHAR(32),
TRANSLATOR CHAR(40),
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK'
OPTION_LIST='xmlsup=libxml2';
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing INSERT on mixed tag and attribute values
--echo #
--copy_file $MTR_SUITE_DIR/std_data/xsample.xml $MYSQLD_DATADIR/test/xsample2.xml
--chmod 0644 $MYSQLD_DATADIR/test/xsample2.xml
CREATE TABLE t1 (
ISBN CHAR(15) FIELD_FORMAT='@',
LANG CHAR(2) FIELD_FORMAT='@',
SUBJECT CHAR(32) FIELD_FORMAT='@',
AUTHOR CHAR(50),
TITLE CHAR(32),
TRANSLATOR CHAR(40),
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.xml'
TABNAME='BIBLIO'
OPTION_LIST='rownode=BOOK,xmlsup=libxml2';
INSERT INTO t1 (ISBN, LANG, SUBJECT, AUTHOR, TITLE, PUBLISHEr, DATEPUB)
VALUES('9782212090529','fr','général','Alain Michard',
'XML, Langage et Applications','Eyrolles Paris',1998);
SELECT * FROM t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval SELECT LOAD_FILE('$MYSQLD_DATADIR/test/xsample2.xml') AS xml
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/xsample2.xml
--echo #
--echo # Testing XPath
--echo #
CREATE TABLE t1 (
isbn CHAR(15) FIELD_FORMAT='@ISBN',
language CHAR(2) FIELD_FORMAT='@LANG',
subject CHAR(32) FIELD_FORMAT='@SUBJECT',
authorfn CHAR(20) FIELD_FORMAT='AUTHOR/FIRSTNAME',
authorln CHAR(20) FIELD_FORMAT='AUTHOR/LASTNAME',
title CHAR(32) FIELD_FORMAT='TITLE',
translated CHAR(32) FIELD_FORMAT='TRANSLATOR/@PREFIX',
tranfn CHAR(20) FIELD_FORMAT='TRANSLATOR/FIRSTNAME',
tranln CHAR(20) FIELD_FORMAT='TRANSLATOR/LASTNAME',
publisher CHAR(20) FIELD_FORMAT='PUBLISHER/NAME',
location CHAR(20) FIELD_FORMAT='PUBLISHER/PLACE',
year INT(4) FIELD_FORMAT='DATEPUB'
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=libxml2';
SELECT * FROM t1;
SELECT isbn, title, translated, tranfn, tranln, location FROM t1
WHERE translated <> '';
DROP TABLE t1;
#
# TODO: Connect.pdf says nodes with variable depth are not supported
#
#--echo #
#--echo # Relative paths are not supported
#--echo #
#CREATE TABLE t1 (
# authorfn CHAR(20) FIELD_FORMAT='//FIRSTNAME',
# authorln CHAR(20) FIELD_FORMAT='//LASTNAME'
#) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
# TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1';
#SELECT * FROM t1;
#DROP TABLE t1;
#
# TODO: Connect.pdf says absolute paths are not supported
#
#--echo #
#--echo # Absolute path is not supported
#--echo #
#CREATE TABLE t1 (
# authorfn CHAR(20) FIELD_FORMAT='/BIBLIO/BOOK/AUTHOR/FIRSTNAME',
# authorln CHAR(20) FIELD_FORMAT='/BIBLIO/BOOK/AUTHOR/LASTNAME'
#) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
# TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1';
#SELECT * FROM t1;
#DROP TABLE t1;
--echo #
--echo # Testing that XPath is case sensitive
--echo #
CREATE TABLE t1
(
isbn CHAR(15) FIELD_FORMAT='@isbn'
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=libxml2';
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing character sets
--echo #
--error ER_UNKNOWN_ERROR
CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'
DATA_CHARSET=latin1;
CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'
DATA_CHARSET=utf8;
SHOW CREATE TABLE t1;
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
--echo #
--echo # Conversion from latin1 to cp1251 produces a warning.
--echo # Question marks are returned.
--echo #
CREATE TABLE t1
(
c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing Cyrillic
--echo #
CREATE TABLE t1
(
c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml'
OPTION_LIST='xmlsup=libxml2,rownode=b';
SELECT * FROM t1;
INSERT INTO t1 VALUES ('ИКЛМН');
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml'
OPTION_LIST='xmlsup=libxml2,rownode=b';
SELECT * FROM t1;
INSERT INTO t1 VALUES ('ОПРСТ');
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
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/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
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml')
SELECT LEFT(@a,43);
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
--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
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--eval SET @a=LOAD_FILE('$MYSQLD_DATADIR/test/t1.xml')
SELECT CAST(@a AS CHAR CHARACTER SET latin1);
--remove_file $MYSQLD_DATADIR/test/t1.xml
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/xsample.xml
--remove_file $MYSQLD_DATADIR/test/latin1.xml
--remove_file $MYSQLD_DATADIR/test/cp1251.xml
-- source include/not_embedded.inc
-- source have_libxml2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
let $TABLE_OPTIONS=TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row';
let $FILE_EXT=XML;
--source grant.inc
--source have_libxml2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
SET NAMES utf8;
--copy_file $MTR_SUITE_DIR/std_data/beers.xml $MYSQLD_DATADIR/test/beers.xml
--copy_file $MTR_SUITE_DIR/std_data/coffee.htm $MYSQLD_DATADIR/test/coffee.htm
--echo #
--echo # Testing HTML like XML file
--echo #
CREATE TABLE beers (
`Name` CHAR(16) FIELD_FORMAT='brandName',
`Origin` CHAR(16) FIELD_FORMAT='origin',
`Description` CHAR(32) FIELD_FORMAT='details')
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml'
TABNAME='table' OPTION_LIST='xmlsup=libxml2,rownode=tr,colnode=td';
SELECT * FROM beers;
DROP TABLE beers;
--echo #
--echo # Testing HTML file
--echo #
CREATE TABLE coffee (
`Name` CHAR(16),
`Cups` INT(8),
`Type` CHAR(16),
`Sugar` CHAR(4))
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm'
TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=libxml2,Coltype=HTML';
SELECT * FROM coffee;
DROP TABLE coffee;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/beers.xml
--remove_file $MYSQLD_DATADIR/test/coffee.htm
--source have_libxml2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
SET NAMES utf8;
#
#--echo Testing indexing on not indexable table type
#
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
CREATE TABLE t1 (i INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='Rownode=N';
DESCRIBE t1;
# one could *add* an index to an existing table
--error ER_UNKNOWN_ERROR
ALTER TABLE t1 ADD UNIQUE(i);
--error ER_UNKNOWN_ERROR
CREATE UNIQUE INDEX i ON t1(i);
DESCRIBE t1;
INSERT INTO t1 VALUES(2),(5),(7);
SELECT * FROM t1 WHERE i = 5;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP INDEX i;
--error ER_CANT_DROP_FIELD_OR_KEY
DROP INDEX i ON t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/xt1.xml
--source have_libxml2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
SET NAMES utf8;
--copy_file $MTR_SUITE_DIR/std_data/bookstore.xml $MYSQLD_DATADIR/test/bookstore.xml
#--echo $MYSQL_TEST_DIR
#--exec pwd
#SELECT LOAD_FILE('test/bookstore.xml');
--echo #
--echo # Testing expanded values
--echo #
CREATE TABLE `bookstore` (
`category` CHAR(16) NOT NULL FIELD_FORMAT='@',
`title` VARCHAR(50) NOT NULL,
`lang` char(2) NOT NULL FIELD_FORMAT='title/@',
`author` VARCHAR(24) NOT NULL,
`year` INT(4) NOT NULL,
`price` DOUBLE(8,2) NOT NULL)
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=libxml2';
SELECT * FROM bookstore;
SELECT category, title, price FROM bookstore;
SELECT category, title, author, price FROM bookstore WHERE author LIKE '%K%';
SELECT category, title, price FROM bookstore WHERE author LIKE 'J%';
--echo #
--echo # Limiting expanded values
--echo #
ALTER TABLE bookstore OPTION_LIST='expand=1,mulnode=author,limit=3,xmlsup=libxml2';
SELECT * FROM bookstore;
--echo # One line lost because the where clause is applied only on the first 3 rows
SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
--echo #
--echo # Testing concatenated values
--echo #
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=6,xmlsup=libxml2';
--echo # truncated
SELECT * FROM bookstore;
--echo # increase author size
ALTER TABLE bookstore MODIFY `author` VARCHAR(128) NOT NULL;
SELECT * FROM bookstore;
--echo #
--echo # Limiting concatenated values
--echo #
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=4,xmlsup=libxml2';
SELECT * FROM bookstore;
--echo # The where clause is applied on the concatenated column result
SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
DROP TABLE bookstore;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/bookstore.xml
--source have_zip.inc
--source have_libxml2.inc
let $MYSQLD_DATADIR= `select @@datadir`;
--vertical_results
--copy_file $MTR_SUITE_DIR/std_data/xsample2.xml $MYSQLD_DATADIR/test/xsample2.xml
--echo #
--echo # Testing zipped XML tables
--echo #
CREATE TABLE t1 (
ISBN CHAR(13) NOT NULL FIELD_FORMAT='@',
LANG CHAR(2) NOT NULL FIELD_FORMAT='@',
SUBJECT CHAR(12) NOT NULL FIELD_FORMAT='@',
AUTHOR_FIRSTNAME CHAR(15) NOT NULL FIELD_FORMAT='AUTHOR/FIRSTNAME',
AUTHOR_LASTNAME CHAR(8) NOT NULL FIELD_FORMAT='AUTHOR/LASTNAME',
TRANSLATOR_PREFIX CHAR(24) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/@PREFIX',
TRANSLATOR_FIRSTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/FIRSTNAME',
TRANSLATOR_LASTNAME CHAR(6) DEFAULT NULL FIELD_FORMAT='TRANSLATOR/LASTNAME',
TITLE CHAR(30) NOT NULL,
PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME',
PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE',
DATEPUB CHAR(4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=libxml2,expand=1,mulnode=AUTHOR';
SELECT * FROM t1;
#testing discovery
CREATE TABLE t2
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='xmlsup=libxml2';
SELECT * FROM t2;
DROP TABLE t1,t2;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/xsample2.xml
--remove_file $MYSQLD_DATADIR/test/xsample2.zip
-- source include/not_embedded.inc -- source include/not_embedded.inc
-- source have_libxml2.inc -- source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
let $TABLE_OPTIONS=TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row'; let $TABLE_OPTIONS=TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row';
let $FILE_EXT=XML; let $FILE_EXT=XML;
--source grant.inc --source grant.inc
--source have_libxml2.inc --source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
...@@ -15,7 +15,7 @@ CREATE TABLE beers ( ...@@ -15,7 +15,7 @@ CREATE TABLE beers (
`Origin` CHAR(16) FIELD_FORMAT='origin', `Origin` CHAR(16) FIELD_FORMAT='origin',
`Description` CHAR(32) FIELD_FORMAT='details') `Description` CHAR(32) FIELD_FORMAT='details')
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml' ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='beers.xml'
TABNAME='table' OPTION_LIST='xmlsup=libxml2,rownode=tr,colnode=td'; TABNAME='table' OPTION_LIST='xmlsup=domdoc,rownode=tr,colnode=td';
SELECT * FROM beers; SELECT * FROM beers;
DROP TABLE beers; DROP TABLE beers;
...@@ -28,7 +28,7 @@ CREATE TABLE coffee ( ...@@ -28,7 +28,7 @@ CREATE TABLE coffee (
`Type` CHAR(16), `Type` CHAR(16),
`Sugar` CHAR(4)) `Sugar` CHAR(4))
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm' ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='coffee.htm'
TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=libxml2,Coltype=HTML'; TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=domdoc,Coltype=HTML';
SELECT * FROM coffee; SELECT * FROM coffee;
DROP TABLE coffee; DROP TABLE coffee;
......
--source have_libxml2.inc --source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
......
--source have_libxml2.inc --source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
...@@ -21,7 +21,7 @@ CREATE TABLE `bookstore` ( ...@@ -21,7 +21,7 @@ CREATE TABLE `bookstore` (
`author` VARCHAR(24) NOT NULL, `author` VARCHAR(24) NOT NULL,
`year` INT(4) NOT NULL, `year` INT(4) NOT NULL,
`price` DOUBLE(8,2) NOT NULL) `price` DOUBLE(8,2) NOT NULL)
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=libxml2'; ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=domdoc';
SELECT * FROM bookstore; SELECT * FROM bookstore;
SELECT category, title, price FROM bookstore; SELECT category, title, price FROM bookstore;
SELECT category, title, author, price FROM bookstore WHERE author LIKE '%K%'; SELECT category, title, author, price FROM bookstore WHERE author LIKE '%K%';
...@@ -31,7 +31,7 @@ SELECT category, title, price FROM bookstore WHERE author LIKE 'J%'; ...@@ -31,7 +31,7 @@ SELECT category, title, price FROM bookstore WHERE author LIKE 'J%';
--echo # --echo #
--echo # Limiting expanded values --echo # Limiting expanded values
--echo # --echo #
ALTER TABLE bookstore OPTION_LIST='expand=1,mulnode=author,limit=3,xmlsup=libxml2'; ALTER TABLE bookstore OPTION_LIST='expand=1,mulnode=author,limit=3,xmlsup=domdoc';
SELECT * FROM bookstore; SELECT * FROM bookstore;
--echo # One line lost because the where clause is applied only on the first 3 rows --echo # One line lost because the where clause is applied only on the first 3 rows
SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%'; SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
...@@ -40,7 +40,7 @@ SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%'; ...@@ -40,7 +40,7 @@ SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
--echo # --echo #
--echo # Testing concatenated values --echo # Testing concatenated values
--echo # --echo #
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=6,xmlsup=libxml2'; ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=6,xmlsup=domdoc';
--echo # truncated --echo # truncated
SELECT * FROM bookstore; SELECT * FROM bookstore;
--echo # increase author size --echo # increase author size
...@@ -51,7 +51,7 @@ SELECT * FROM bookstore; ...@@ -51,7 +51,7 @@ SELECT * FROM bookstore;
--echo # --echo #
--echo # Limiting concatenated values --echo # Limiting concatenated values
--echo # --echo #
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=4,xmlsup=libxml2'; ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=4,xmlsup=domdoc';
SELECT * FROM bookstore; SELECT * FROM bookstore;
--echo # The where clause is applied on the concatenated column result --echo # The where clause is applied on the concatenated column result
SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%'; SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
......
--source have_zip.inc --source have_zip.inc
--source have_libxml2.inc --source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
...@@ -24,13 +24,13 @@ PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME', ...@@ -24,13 +24,13 @@ PUBLISHER_NAME CHAR(15) NOT NULL FIELD_FORMAT='PUBLISHER/NAME',
PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE', PUBLISHER_PLACE CHAR(5) NOT NULL FIELD_FORMAT='PUBLISHER/PLACE',
DATEPUB CHAR(4) NOT NULL DATEPUB CHAR(4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES ) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=libxml2,expand=1,mulnode=AUTHOR'; OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=domdoc,expand=1,mulnode=AUTHOR';
SELECT * FROM t1; SELECT * FROM t1;
#testing discovery #testing discovery
CREATE TABLE t2 CREATE TABLE t2
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='xmlsup=libxml2'; OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t1,t2; DROP TABLE t1,t2;
......
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