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,
// Note that if no support is specified, the default is MS-DOM
// on Windows and libxml2 otherwise
switch (*xsup) {
switch (toupper(*xsup)) {
case '*':
#if defined(__WIN__)
dom= true;
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
#
# Testing changing table type (not in-place)
#
......@@ -16,7 +14,7 @@ c d
# 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='rownode=row';
ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='xmlsup=domdoc,rownode=row';
SELECT * FROM t1;
c d
1 One
......@@ -27,7 +25,7 @@ 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`='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
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
Warnings:
......@@ -67,7 +65,7 @@ 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`='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;
line
<?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` (
`name` char(10) NOT NULL,
`birth` date NOT NULL,
`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'
) 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);
......@@ -76,7 +76,7 @@ t1 CREATE TABLE `t1` (
`name` char(10) NOT NULL,
`birth` date NOT NULL,
`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'
) 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);
......
......@@ -26,7 +26,7 @@ fname ftype size
boys .txt 282
boyswin .txt 288
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;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
ERROR HY000: Cannot get column info for table type DIR
......@@ -4,6 +4,8 @@ set sql_mode="";
#
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
......@@ -14,6 +16,7 @@ ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user();
user()
root@localhost
......@@ -26,6 +29,7 @@ size DOUBLE(12,0) NOT NULL flag=5
SELECT fname, ftype, size FROM t1 WHERE size>0;
fname ftype size
t1 .frm 1081
connection user;
SELECT user();
user()
user@localhost
......@@ -44,10 +48,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -59,6 +65,8 @@ UPDATE v1 SET path=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)
disconnect user;
connection default;
SELECT user();
user()
root@localhost
......@@ -74,6 +82,8 @@ DROP USER user@localhost;
CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
......@@ -102,11 +112,13 @@ DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user();
user()
root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
......@@ -129,10 +141,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -144,6 +158,7 @@ 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)
connection default;
SELECT user();
user()
root@localhost
......@@ -153,12 +168,15 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN;
Warnings:
Warning 1105 No file name. Table will use t1.bin
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
disconnect user;
DROP USER user@localhost;
#
# End of grant.inc
......@@ -169,6 +187,8 @@ DROP USER user@localhost;
CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
......@@ -197,11 +217,13 @@ DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user();
user()
root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
......@@ -224,10 +246,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -239,6 +263,7 @@ 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)
connection default;
SELECT user();
user()
root@localhost
......@@ -248,12 +273,15 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV;
Warnings:
Warning 1105 No file name. Table will use t1.csv
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
disconnect user;
DROP USER user@localhost;
#
# End of grant.inc
......@@ -264,6 +292,8 @@ DROP USER user@localhost;
CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
......@@ -292,11 +322,13 @@ DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user();
user()
root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
......@@ -319,10 +351,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -334,6 +368,7 @@ 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)
connection default;
SELECT user();
user()
root@localhost
......@@ -343,12 +378,15 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF;
Warnings:
Warning 1105 No file name. Table will use t1.dbf
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
disconnect user;
DROP USER user@localhost;
#
# End of grant.inc
......@@ -359,6 +397,8 @@ DROP USER user@localhost;
CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
......@@ -387,11 +427,13 @@ DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user();
user()
root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
......@@ -414,10 +456,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -429,6 +473,7 @@ 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)
connection default;
SELECT user();
user()
root@localhost
......@@ -438,12 +483,15 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
Warnings:
Warning 1105 No file name. Table will use t1.fix
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
disconnect user;
DROP USER user@localhost;
#
# End of grant.inc
......@@ -454,6 +502,8 @@ DROP USER user@localhost;
CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
......@@ -482,11 +532,13 @@ DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user();
user()
root@localhost
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 FILE_NAME='t1.EXT';
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
......@@ -509,10 +561,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -524,6 +578,7 @@ 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)
connection default;
SELECT user();
user()
root@localhost
......@@ -533,12 +588,15 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100;
Warnings:
Warning 1105 No file name. Table will use t1.vec
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
disconnect user;
DROP USER user@localhost;
#
# End of grant.inc
......
......@@ -5,6 +5,7 @@ CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
# Testing SQLCOM_SELECT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -21,6 +22,7 @@ a
10
SELECT * FROM v1_baddefiner;
ERROR 28000: Access denied for user 'root'@'localhost' (using password: NO)
connect user,localhost,user,,;
SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT * FROM v1_invoker;
......@@ -28,9 +30,11 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
SELECT * FROM v1_definer;
a
10
connection default;
DROP VIEW v1_invoker, v1_definer, v1_baddefiner;
DROP TABLE t1;
# Testing SQLCOM_UPDATE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -38,14 +42,17 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
UPDATE t1 SET a=11;
UPDATE v1_invoker SET a=12;
UPDATE v1_definer SET a=13;
connection user;
UPDATE t1 SET a=21;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v1_invoker SET a=22;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v1_definer SET a=23;
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_INSERT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -53,14 +60,17 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
INSERT INTO t1 VALUES (11);
INSERT INTO v1_invoker VALUES (12);
INSERT INTO v1_definer VALUES (13);
connection user;
INSERT INTO t1 VALUES (21);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_invoker VALUES (22);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_definer VALUES (23);
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_REPLACE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -71,15 +81,18 @@ REPLACE INTO v1_invoker VALUES (12);
ERROR 42000: CONNECT Unsupported command
REPLACE INTO v1_definer VALUES (13);
ERROR 42000: CONNECT Unsupported command
connection user;
REPLACE INTO t1 VALUES (21);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
REPLACE INTO v1_invoker VALUES (22);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
REPLACE INTO v1_definer VALUES (23);
ERROR 42000: CONNECT Unsupported command
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_DELETE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -87,14 +100,17 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
DELETE FROM t1 WHERE a=11;
DELETE FROM v1_invoker WHERE a=12;
DELETE FROM v1_definer WHERE a=13;
connection user;
DELETE FROM t1 WHERE a=21;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1_invoker WHERE a=22;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE FROM v1_definer WHERE a=23;
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_LOAD
connection default;
CREATE TABLE t1 (a VARCHAR(128)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -102,29 +118,38 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
connection user;
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer;
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_TRUNCATE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (11);
connection user;
TRUNCATE TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_DROP_TABLE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
connection user;
DROP TABLE t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_DROP_VIEW
# DROP VIEW does not need FILE_ACL.
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -132,13 +157,18 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
DROP VIEW v1_invoker, v1_definer;
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1;
connection user;
DROP VIEW v1_invoker;
DROP VIEW v1_definer;
connection default;
DROP TABLE t1;
# Testing SQLCOM_CREATE_TABLE
connection user;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
# Testing SQLCOM_LOCK_TABLES
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -155,6 +185,7 @@ LOCK TABLE v1_definer READ;
UNLOCK TABLES;
LOCK TABLE v1_definer WRITE;
UNLOCK TABLES;
connection user;
LOCK TABLE t1 READ;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
LOCK TABLE t1 WRITE;
......@@ -167,9 +198,11 @@ LOCK TABLE v1_definer READ;
UNLOCK TABLES;
LOCK TABLE v1_definer WRITE;
UNLOCK TABLES;
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_UPDATE_MULTI
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
CREATE TABLE t3 (a INT);
......@@ -229,6 +262,7 @@ UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
connection user;
UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a;
......@@ -318,9 +352,11 @@ UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a;
connection default;
DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
DROP TABLE t1, t2, t3;
# Testing SQLCOM_DELETE_MULTI
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix';
CREATE TABLE t3 (a INT);
......@@ -380,6 +416,7 @@ DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
connection user;
DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a;
......@@ -469,9 +506,11 @@ DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a;
DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a;
connection default;
DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer;
DROP TABLE t1, t2, t3;
# Testing SQLCOM_CREATE_VIEW
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -480,15 +519,18 @@ CREATE VIEW v2 AS SELECT * FROM v1_invoker;
DROP VIEW v2;
CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2;
connection user;
CREATE VIEW v2 AS SELECT * FROM t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v2 AS SELECT * FROM v1_invoker;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CREATE VIEW v2 AS SELECT * FROM v1_definer;
DROP VIEW v2;
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_INSERT_SELECT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -502,6 +544,7 @@ INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20;
INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20;
INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
connection user;
INSERT INTO t1 SELECT * FROM t1 WHERE a=20;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20;
......@@ -519,9 +562,11 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_REPLACE_SELECT
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1;
......@@ -544,6 +589,7 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
ERROR 42000: CONNECT Unsupported command
REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
ERROR 42000: CONNECT Unsupported command
connection user;
REPLACE INTO t1 SELECT * FROM t1 WHERE a=20;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20;
......@@ -562,9 +608,11 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20;
ERROR 42000: CONNECT Unsupported command
REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20;
ERROR 42000: CONNECT Unsupported command
connection default;
DROP VIEW v1_invoker, v1_definer;
DROP TABLE t1;
# Testing SQLCOM_RENAME_TABLE
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
RENAME TABLE t1 TO t2;
......@@ -574,10 +622,13 @@ t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix'
RENAME TABLE t2 TO t1;
connection user;
RENAME TABLE t1 TO t2;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME)
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 RENAME TO t2;
......@@ -587,20 +638,26 @@ t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix'
ALTER TABLE t2 RENAME TO t1;
connection user;
ALTER TABLE t1 RENAME TO t2;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT)
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 ENGINE=MyISAM;
DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
connection user;
ALTER TABLE t1 ENGINE=MyISAM;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT)
connection default;
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
......@@ -610,63 +667,83 @@ ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
DROP TABLE t1;
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (10);
connection user;
ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_OPTIMIZE
connection default;
CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
connection user;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize Error Access denied for user 'user'@'localhost' (using password: NO)
test.t1 optimize Error Got error 122 'This operation requires the FILE privilege' from CONNECT
test.t1 optimize error Corrupt
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (adding columns)
connection default;
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10);
ALTER TABLE t1 ADD b INT;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
connection user;
ALTER TABLE t1 ADD c INT;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (removing columns)
connection default;
CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10,10);
ALTER TABLE t1 DROP b;
Warnings:
Warning 1105 This is an outward table, table data were not modified.
connection user;
ALTER TABLE t1 DROP c;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (adding keys)
connection default;
CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 ADD KEY(a);
connection user;
ALTER TABLE t1 ADD KEY(b);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_ALTER_TABLE (removing keys)
connection default;
CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10);
ALTER TABLE t1 DROP KEY a;
connection user;
ALTER TABLE t1 DROP KEY b;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX
connection default;
CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix';
INSERT INTO t1 VALUES (10,10);
CREATE INDEX a ON t1 (a);
DROP INDEX a ON t1;
CREATE INDEX a ON t1 (a);
connection user;
CREATE INDEX b ON t1 (b);
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
DROP INDEX a ON t1;
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
# Testing stored procedures
CREATE PROCEDURE p_definer() SQL SECURITY DEFINER
......@@ -681,9 +758,11 @@ CALL p_invoker();
DROP TABLE t1;
CALL p_baddefiner();
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection user;
CALL p_invoker();
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
CALL p_definer();
connection default;
DROP TABLE t1;
DROP PROCEDURE p_definer;
DROP PROCEDURE p_invoker;
......
Warnings:
Warning 1105 No file name. Table will use t1.xml
create table t1 (i int) engine=Connect table_type=XML;
create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=domdoc';
Warnings:
Warning 1105 No file name. Table will use t1.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="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
set sql_mode=default;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
......@@ -33,11 +35,13 @@ DROP VIEW v1;
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';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
SELECT user();
user()
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';
INSERT INTO t1 VALUES ('sec1','val1');
connection user;
SELECT user();
user()
user@localhost
......@@ -58,10 +62,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -73,6 +79,8 @@ UPDATE v1 SET val='val11';
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)
disconnect user;
connection default;
DROP VIEW v1;
DROP TABLE t1;
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';
CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
......@@ -11,6 +15,7 @@ NULL NULL
#
# Testing errors
#
connection master;
SET GLOBAL time_zone='+1:00';
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
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
DROP TABLE t1;
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 slave;
ALTER TABLE t1 RENAME t1backup;
connection master;
SELECT * FROM t1;
ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT
connection slave;
ALTER TABLE t1backup RENAME t1;
connection master;
DROP TABLE t1;
#
# Testing SELECT, etc.
......@@ -108,6 +117,7 @@ NULL NULL
2 0
3 0
DROP TABLE t1;
connection slave;
DROP TABLE t1;
#
# Testing numeric data types
......@@ -126,6 +136,7 @@ t1 CREATE TABLE `t1` (
`h` decimal(20,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1;
......@@ -144,6 +155,7 @@ SELECT * FROM t1;
a b c d e f g h
100 3333 41235 1234567890 235000000000 3 3 3141.59265
DROP TABLE t1;
connection slave;
DROP TABLE t1;
#
# Testing character data types
......@@ -159,6 +171,7 @@ INSERT INTO t1 VALUES('Welcome','Hello, World');
SELECT * FROM t1;
a b
Welcome Hello, World
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1;
......@@ -171,6 +184,7 @@ SELECT * FROM t1;
a b
Welcome Hello, World
DROP TABLE t1;
connection slave;
DROP TABLE t1;
#
# Testing temporal data types
......@@ -182,10 +196,10 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL,
`b` datetime 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
) 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:
Note 1265 Data truncated for column 'a' 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
SELECT * FROM t1;
a b c d e
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
CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root';
SHOW CREATE TABLE t1;
......@@ -201,13 +216,15 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL,
`b` datetime 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
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`='JDBC'
SELECT * FROM t1;
a b c d e
2003-05-27 2003-05-27 11:45:23 10:45:23 2003-05-27 10:45:23 2003
DROP TABLE t1;
connection slave;
DROP TABLE t1;
SET GLOBAL time_zone=SYSTEM;
connection master;
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;
connection slave;
CREATE DATABASE connect;
connection slave;
CREATE TABLE t1 (
`id` int(20) primary key,
`group` int NOT NULL default 1,
......@@ -7,14 +12,15 @@ CREATE TABLE t1 (
`a\\` int unsigned,
`name` varchar(32) default 'name')
DEFAULT CHARSET=latin1;
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(20) NOT NULL,
`group` int(11) NOT NULL DEFAULT '1',
`a\\b` int(11) NOT NULL DEFAULT '2',
`group` int(11) NOT NULL DEFAULT 1,
`a\\b` int(11) NOT NULL DEFAULT 2,
`a\\` int(10) unsigned DEFAULT NULL,
`name` varchar(32) DEFAULT 'name'
) 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
1 1 2 NULL foo
2 1 2 NULL fee
DROP TABLE t1;
connection slave;
SELECT * FROM t1;
id group a\\b a\\ name
1 1 2 NULL foo
2 1 2 NULL fee
DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1;
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;
connection slave;
CREATE DATABASE connect;
#
# Checking Sending Commands
#
connection master;
CREATE TABLE t1 (
command VARCHAR(128) NOT NULL,
warnings INT(4) NOT NULL FLAG=3,
......@@ -15,7 +20,7 @@ SELECT * FROM t1 WHERE command IN ('Warning','Note',
"insert into t1(msg) values('One'),(NULL),('Three')",
"insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'",
"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",
'select * from t1');
command warnings number message
......@@ -26,7 +31,7 @@ insert into t1(msg) values('One'),(NULL),('Three') 1 3 Affected rows
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(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
update t1 set msg = 'Four' where id = 4 0 1 Affected rows
select * from t1 0 2 Result set columns
......@@ -39,15 +44,16 @@ Note 1305 PROCEDURE test.p1 does not exist
CREATE PROCEDURE p1(cmd varchar(512))
READS SQL DATA
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
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
CALL p1('update t1 set msg = "Five" where id = 5');
command warnings number message
update t1 set msg = "Five" where id = 5 0 1 Affected rows
DROP PROCEDURE p1;
DROP TABLE t1;
connection slave;
SELECT * FROM t1;
id msg
1 One
......@@ -56,7 +62,9 @@ id msg
4 Four
5 Five
DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
......@@ -5,11 +5,14 @@ set sql_mode="";
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
set sql_mode=default;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
user@localhost
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)
connection default;
SELECT user();
user()
root@localhost
......@@ -21,6 +24,7 @@ a
10
20
30
connection user;
SELECT user();
user()
user@localhost
......@@ -39,10 +43,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -54,6 +60,8 @@ 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)
disconnect user;
connection default;
SELECT user();
user()
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;
connection slave;
CREATE DATABASE connect;
connection slave;
CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
SELECT * FROM t1;
......@@ -12,6 +17,7 @@ NULL NULL
#
# Testing errors
#
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://unknown@127.0.0.1:SLAVE_PORT/test/t1';
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
DROP TABLE t1;
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 slave;
ALTER TABLE t1 RENAME t1backup;
connection master;
SELECT * FROM t1;
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;
connection master;
DROP TABLE t1;
#
# Testing SELECT, etc.
......@@ -111,6 +121,7 @@ NULL NULL
2 0
3 0
DROP TABLE t1;
connection slave;
DROP TABLE t1;
#
# Testing numeric data types
......@@ -129,6 +140,7 @@ t1 CREATE TABLE `t1` (
`h` decimal(20,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
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
OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT';
SHOW CREATE TABLE t1;
......@@ -147,6 +159,7 @@ SELECT * FROM t1;
a b c d e f g h
100 3333 41235 1234567890 235000000000 3.14159 3.14159265 3141.59265
DROP TABLE t1;
connection slave;
DROP TABLE t1;
#
# Testing character data types
......@@ -162,6 +175,7 @@ INSERT INTO t1 VALUES('Welcome','Hello, World');
SELECT * FROM t1;
a b
Welcome Hello, World
connection master;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT';
SHOW CREATE TABLE t1;
......@@ -174,6 +188,7 @@ SELECT * FROM t1;
a b
Welcome Hello, World
DROP TABLE t1;
connection slave;
DROP TABLE t1;
#
# Testing temporal data types
......@@ -185,10 +200,10 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL,
`b` datetime 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
) 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:
Note 1265 Data truncated for column 'a' 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
SELECT * FROM t1;
a b c d e
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
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT';
SHOW CREATE TABLE t1;
......@@ -204,15 +220,18 @@ t1 CREATE TABLE `t1` (
`a` date DEFAULT NULL,
`b` datetime 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
) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL'
SELECT * FROM t1;
a b c d e
2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003
DROP TABLE t1;
connection slave;
DROP TABLE t1;
connection master;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
......@@ -27,13 +27,13 @@ UPDATE t1 SET e = d;
SELECT * FROM t1;
a b c d e
255 65535 4294967295 18446744073709551615 18446744073709551615
UPDATE t1 SET c = d;
UPDATE IGNORE t1 SET c = d;
Warnings:
Warning 1264 Out of range value for column 'c' at row 1
SELECT * FROM t1;
a b c d e
255 65535 4294967295 18446744073709551615 18446744073709551615
UPDATE t1 SET c = e;
UPDATE IGNORE t1 SET c = e;
Warnings:
Warning 1264 Out of range value for column 'c' at row 1
SELECT * FROM t1;
......
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE TABLE employee
(
serialno CHAR(5) NOT NULL,
......@@ -1625,3 +1626,4 @@ serialno name sex title manager department secretary salary
#
DROP PROCEDURE test.tst_up;
DROP TABLE employee;
SET sql_mode = DEFAULT;
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing tag values
......@@ -12,7 +10,7 @@ TRANSLATOR CHAR(40),
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1;
AUTHOR Jean-Christophe Bernadac
TITLE Construire une application XML
......@@ -36,7 +34,7 @@ TRANSLATOR CHAR(40),
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1;
author NULL
TITLE Construire une application XML
......@@ -57,7 +55,7 @@ ISBN CHAR(15),
LANG CHAR(2),
SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2';
OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1;
ISBN 9782212090819
LANG fr
......@@ -74,7 +72,7 @@ isbn CHAR(15),
LANG CHAR(2),
SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2';
OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1;
isbn NULL
LANG fr
......@@ -97,7 +95,7 @@ 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';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1;
ISBN 9782212090819
LANG fr
......@@ -130,7 +128,7 @@ PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.xml'
TABNAME='BIBLIO'
OPTION_LIST='rownode=BOOK,xmlsup=libxml2';
OPTION_LIST='rownode=BOOK,xmlsup=domdoc';
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);
......@@ -160,47 +158,47 @@ TRANSLATOR NULL
PUBLISHER Eyrolles Paris
DATEPUB 1998
SELECT LOAD_FILE('MYSQLD_DATADIR/test/xsample2.xml') AS xml;
xml <?xml version="1.0" encoding="UTF-8"?>
<BIBLIO SUBJECT="XML">
<BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications">
<AUTHOR>
<FIRSTNAME>Jean-Christophe</FIRSTNAME>
<LASTNAME>Bernadac</LASTNAME>
</AUTHOR>
<AUTHOR>
<FIRSTNAME>François</FIRSTNAME>
<LASTNAME>Knab</LASTNAME>
</AUTHOR>
<TITLE>Construire une application XML</TITLE>
<PUBLISHER>
<NAME>Eyrolles</NAME>
<PLACE>Paris</PLACE>
</PUBLISHER>
<DATEPUB>1999</DATEPUB>
</BOOK>
<BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications">
<AUTHOR>
<FIRSTNAME>William J.</FIRSTNAME>
<LASTNAME>Pardi</LASTNAME>
</AUTHOR>
<TRANSLATOR PREFIX="adapté de l'anglais par">
<FIRSTNAME>James</FIRSTNAME>
<LASTNAME>Guerin</LASTNAME>
</TRANSLATOR>
<TITLE>XML en Action</TITLE>
<PUBLISHER>
<NAME>Microsoft Press</NAME>
<PLACE>Paris</PLACE>
</PUBLISHER>
<DATEPUB>1999</DATEPUB>
</BOOK>
<BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général">
<AUTHOR>Alain Michard</AUTHOR>
<TITLE>XML, Langage et Applications</TITLE>
<PUBLISHER>Eyrolles Paris</PUBLISHER>
<DATEPUB>1998</DATEPUB>
</BOOK>
</BIBLIO>
xml <?xml version="1.0" encoding="UTF-8"?>
<BIBLIO SUBJECT="XML">
<BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications">
<AUTHOR>
<FIRSTNAME>Jean-Christophe</FIRSTNAME>
<LASTNAME>Bernadac</LASTNAME>
</AUTHOR>
<AUTHOR>
<FIRSTNAME>François</FIRSTNAME>
<LASTNAME>Knab</LASTNAME>
</AUTHOR>
<TITLE>Construire une application XML</TITLE>
<PUBLISHER>
<NAME>Eyrolles</NAME>
<PLACE>Paris</PLACE>
</PUBLISHER>
<DATEPUB>1999</DATEPUB>
</BOOK>
<BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications">
<AUTHOR>
<FIRSTNAME>William J.</FIRSTNAME>
<LASTNAME>Pardi</LASTNAME>
</AUTHOR>
<TRANSLATOR PREFIX="adapté de l'anglais par">
<FIRSTNAME>James</FIRSTNAME>
<LASTNAME>Guerin</LASTNAME>
</TRANSLATOR>
<TITLE>XML en Action</TITLE>
<PUBLISHER>
<NAME>Microsoft Press</NAME>
<PLACE>Paris</PLACE>
</PUBLISHER>
<DATEPUB>1999</DATEPUB>
</BOOK>
<BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général">
<AUTHOR>Alain Michard</AUTHOR>
<TITLE>XML, Langage et Applications</TITLE>
<PUBLISHER>Eyrolles Paris</PUBLISHER>
<DATEPUB>1998</DATEPUB>
</BOOK>
</BIBLIO>
DROP TABLE t1;
#
......@@ -220,7 +218,7 @@ 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';
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1;
isbn 9782212090819
language fr
......@@ -262,7 +260,7 @@ 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';
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1;
isbn NULL
isbn NULL
......@@ -274,20 +272,20 @@ CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'
OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=latin1;
ERROR HY000: DATA_CHARSET='latin1' is not supported for TABLE_TYPE=XML
CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'
OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=utf8;
SHOW CREATE TABLE t1;
Table t1
Create Table CREATE TABLE `t1` (
`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;
c ÁÂÃÄÅÆÇ
HEX(c) C1C2C3C4C5C6C7
......@@ -296,7 +294,7 @@ CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1;
c ÁÂÃÄÅÆÇ
HEX(c) C1C2C3C4C5C6C7
......@@ -305,7 +303,7 @@ CREATE TABLE t1
(
c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1;
c ÁÂÃÄÅÆÇ
HEX(c) C381C382C383C384C385C386C387
......@@ -318,7 +316,7 @@ CREATE TABLE t1
(
c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1;
c ???????
HEX(c) 3F3F3F3F3F3F3F
......@@ -333,44 +331,13 @@ DROP TABLE t1;
#
# 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
#
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';
OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=utf-8';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
......@@ -384,7 +351,7 @@ HEX(EXTRACTVALUE(@a,'/t1/line/node')) C380C381C382C383
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1';
OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
......@@ -401,31 +368,26 @@ HEX(EXTRACTVALUE(@a,'/t1/line/node')) C0C1C2C3
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';
OPTION_LIST='xmlsup=domdoc,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 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 ('&<>"\'');
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C380C381C382C383
node АБВГ
hex(node) D090D091D092D093
node &<>"'
hex(node) 263C3E2227
DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1);
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by the MariaDB CONNECT Storage Engine-->
<t1>
<line>
<node>ÀÁÂÃ</node>
</line>
<line>
<node>&#1040;&#1041;&#1042;&#1043;</node>
</line>
<line>
<node>&amp;&lt;&gt;"'</node>
</line>
</t1>
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by the MariaDB CONNECT Storage Engine-->
<t1>
<line>
<node>&amp;&lt;&gt;"'</node>
</line>
</t1>
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing tag values
#
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;
AUTHOR Jean-Christophe Bernadac
TITLE Construire une application XML
TRANSLATOR NULL
PUBLISHER Eyrolles Paris
DATEPUB 1999
AUTHOR William J. Pardi
TITLE XML en Action
TRANSLATOR James Guerin
PUBLISHER Microsoft Press Paris
DATEPUB 1999
DROP TABLE t1;
#
# Testing that tag names are case sensitive
#
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;
author NULL
TITLE Construire une application XML
TRANSLATOR NULL
PUBLISHER Eyrolles Paris
DATEPUB 1999
author NULL
TITLE XML en Action
TRANSLATOR James Guerin
PUBLISHER Microsoft Press Paris
DATEPUB 1999
DROP TABLE t1;
#
# Testing attribute values
#
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;
ISBN 9782212090819
LANG fr
SUBJECT applications
ISBN 9782840825685
LANG fr
SUBJECT applications
DROP TABLE t1;
#
# Testing that attribute names are case sensitive
#
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;
isbn NULL
LANG fr
SUBJECT applications
isbn NULL
LANG fr
SUBJECT applications
DROP TABLE t1;
#
# Testing mixed tag and attribute values
#
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;
ISBN 9782212090819
LANG fr
SUBJECT applications
AUTHOR Jean-Christophe Bernadac
TITLE Construire une application XML
TRANSLATOR NULL
PUBLISHER Eyrolles Paris
DATEPUB 1999
ISBN 9782840825685
LANG fr
SUBJECT applications
AUTHOR William J. Pardi
TITLE XML en Action
TRANSLATOR James Guerin
PUBLISHER Microsoft Press Paris
DATEPUB 1999
DROP TABLE t1;
#
# Testing INSERT on mixed tag and attribute values
#
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;
ISBN 9782212090819
LANG fr
SUBJECT applications
AUTHOR Jean-Christophe Bernadac
TITLE Construire une application XML
TRANSLATOR NULL
PUBLISHER Eyrolles Paris
DATEPUB 1999
ISBN 9782840825685
LANG fr
SUBJECT applications
AUTHOR William J. Pardi
TITLE XML en Action
TRANSLATOR James Guerin
PUBLISHER Microsoft Press Paris
DATEPUB 1999
ISBN 9782212090529
LANG fr
SUBJECT général
AUTHOR Alain Michard
TITLE XML, Langage et Applications
TRANSLATOR NULL
PUBLISHER Eyrolles Paris
DATEPUB 1998
SELECT LOAD_FILE('MYSQLD_DATADIR/test/xsample2.xml') AS xml;
xml <?xml version="1.0" encoding="UTF-8"?>
<BIBLIO SUBJECT="XML">
<BOOK ISBN="9782212090819" LANG="fr" SUBJECT="applications">
<AUTHOR>
<FIRSTNAME>Jean-Christophe</FIRSTNAME>
<LASTNAME>Bernadac</LASTNAME>
</AUTHOR>
<AUTHOR>
<FIRSTNAME>François</FIRSTNAME>
<LASTNAME>Knab</LASTNAME>
</AUTHOR>
<TITLE>Construire une application XML</TITLE>
<PUBLISHER>
<NAME>Eyrolles</NAME>
<PLACE>Paris</PLACE>
</PUBLISHER>
<DATEPUB>1999</DATEPUB>
</BOOK>
<BOOK ISBN="9782840825685" LANG="fr" SUBJECT="applications">
<AUTHOR>
<FIRSTNAME>William J.</FIRSTNAME>
<LASTNAME>Pardi</LASTNAME>
</AUTHOR>
<TRANSLATOR PREFIX="adapté de l'anglais par">
<FIRSTNAME>James</FIRSTNAME>
<LASTNAME>Guerin</LASTNAME>
</TRANSLATOR>
<TITLE>XML en Action</TITLE>
<PUBLISHER>
<NAME>Microsoft Press</NAME>
<PLACE>Paris</PLACE>
</PUBLISHER>
<DATEPUB>1999</DATEPUB>
</BOOK>
<BOOK ISBN="9782212090529" LANG="fr" SUBJECT="général">
<AUTHOR>Alain Michard</AUTHOR>
<TITLE>XML, Langage et Applications</TITLE>
<PUBLISHER>Eyrolles Paris</PUBLISHER>
<DATEPUB>1998</DATEPUB>
</BOOK>
</BIBLIO>
DROP TABLE t1;
#
# Testing XPath
#
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;
isbn 9782212090819
language fr
subject applications
authorfn Jean-Christophe
authorln Bernadac
title Construire une application XML
translated NULL
tranfn NULL
tranln NULL
publisher Eyrolles
location Paris
year 1999
isbn 9782840825685
language fr
subject applications
authorfn William J.
authorln Pardi
title XML en Action
translated adapté de l'anglais par
tranfn James
tranln Guerin
publisher Microsoft Press
location Paris
year 1999
SELECT isbn, title, translated, tranfn, tranln, location FROM t1
WHERE translated <> '';
isbn 9782840825685
title XML en Action
translated adapté de l'anglais par
tranfn James
tranln Guerin
location Paris
DROP TABLE t1;
#
# Testing that XPath is case sensitive
#
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;
isbn NULL
isbn NULL
DROP TABLE t1;
#
# Testing character sets
#
CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'
DATA_CHARSET=latin1;
ERROR HY000: DATA_CHARSET='latin1' is not supported for TABLE_TYPE=XML
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;
Table t1
Create Table CREATE TABLE `t1` (
`c` char(16) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=XML `FILE_NAME`='latin1.xml' `OPTION_LIST`='xmlsup=libxml2' `DATA_CHARSET`=utf8
SELECT c, HEX(c) FROM t1;
c ÁÂÃÄÅÆÇ
HEX(c) C1C2C3C4C5C6C7
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;
c ÁÂÃÄÅÆÇ
HEX(c) C1C2C3C4C5C6C7
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;
c ÁÂÃÄÅÆÇ
HEX(c) C381C382C383C384C385C386C387
DROP TABLE t1;
#
# Conversion from latin1 to cp1251 produces a warning.
# Question marks are returned.
#
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;
c ???????
HEX(c) 3F3F3F3F3F3F3F
Warnings:
Level Warning
Code 1366
Message Incorrect string value: '\xC3\x81\xC3\x82\xC3\x83...' for column 'c' at row 1
Level Warning
Code 1105
Message Out of range value ÁÂÃÄÅÆÇ for column 'c' at row 1
DROP TABLE t1;
#
# 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
#
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=utf-8';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C0C1C2C3
DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT LEFT(@a,38);
LEFT(@a,38) <?xml version="1.0" encoding="utf-8"?>
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
HEX(EXTRACTVALUE(@a,'/t1/line/node')) C380C381C382C383
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET latin1
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C0C1C2C3
DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT LEFT(@a,43);
LEFT(@a,43) <?xml version="1.0" encoding="iso-8859-1"?>
SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
HEX(EXTRACTVALUE(@a,'/t1/line/node')) C0C1C2C3
#
# Testing XML entities
#
CREATE TABLE t1 (node VARCHAR(50))
CHARACTER SET utf8
ENGINE=connect TABLE_TYPE=xml FILE_NAME='t1.xml'
OPTION_LIST='xmlsup=libxml2,rownode=line,encoding=iso-8859-1';
INSERT INTO t1 VALUES (_latin1 0xC0C1C2C3);
INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3);
INSERT INTO t1 VALUES ('&<>"\'');
SELECT node, hex(node) FROM t1;
node ÀÁÂÃ
hex(node) C380C381C382C383
node АБВГ
hex(node) D090D091D092D093
node &<>"'
hex(node) 263C3E2227
DROP TABLE t1;
SET @a=LOAD_FILE('MYSQLD_DATADIR/test/t1.xml');
SELECT CAST(@a AS CHAR CHARACTER SET latin1);
CAST(@a AS CHAR CHARACTER SET latin1) <?xml version="1.0" encoding="iso-8859-1"?>
<!-- Created by the MariaDB CONNECT Storage Engine-->
<t1>
<line>
<node>ÀÁÂÃ</node>
</line>
<line>
<node>&#1040;&#1041;&#1042;&#1043;</node>
</line>
<line>
<node>&amp;&lt;&gt;"'</node>
</line>
</t1>
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
#
CREATE USER user@localhost;
GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost;
connect user,localhost,user,,;
connection user;
SELECT user();
user()
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:
Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10);
......@@ -32,13 +32,15 @@ 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';
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)
connection default;
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';
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);
connection user;
SELECT user();
user()
user@localhost
......@@ -61,10 +63,12 @@ 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
connection default;
SELECT user();
user()
root@localhost
CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1;
connection user;
SELECT user();
user()
user@localhost
......@@ -76,21 +80,25 @@ 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)
connection default;
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';
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row';
Warnings:
Warning 1105 No file name. Table will use t1.xml
INSERT INTO t1 VALUES (10);
connection user;
SELECT user();
user()
user@localhost
ALTER TABLE t1 FILE_NAME='t1.EXT';
ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO)
connection default;
DROP TABLE t1;
disconnect user;
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
......@@ -9,7 +7,7 @@ CREATE TABLE beers (
`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';
TABNAME='table' OPTION_LIST='xmlsup=domdoc,rownode=tr,colnode=td';
SELECT * FROM beers;
Name Origin Description
Huntsman Bath, UK Wonderful hop, light alcohol
......@@ -24,7 +22,7 @@ CREATE TABLE coffee (
`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';
TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=domdoc,Coltype=HTML';
SELECT * FROM coffee;
Name Cups Type Sugar
T. Sexton 10 Espresso No
......
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
......@@ -19,7 +17,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
ERROR 42000: Can't DROP INDEX `i`; check that it exists
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;
Warnings:
Warning 1105 No file name. Table will use t1.xml
SET NAMES utf8;
#
# Testing expanded values
......@@ -11,7 +9,7 @@ CREATE TABLE `bookstore` (
`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';
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=domdoc';
SELECT * FROM bookstore;
category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
......@@ -41,7 +39,7 @@ WEB XQuery Kick Start 49.99
#
# 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;
category title lang author year price
COOKING Everyday Italian en Giada De Laurentiis 2005 30.00
......@@ -62,7 +60,7 @@ Warning 1105 Mutiple values limited to 3
#
# 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
SELECT * FROM bookstore;
category title lang author year price
......@@ -83,7 +81,7 @@ WEB Learning XML en Erik T. Ray 2003 39.95
#
# 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;
category title lang author year price
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
#
......@@ -17,7 +15,7 @@ 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';
OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=domdoc,expand=1,mulnode=AUTHOR';
SELECT * FROM t1;
ISBN 9782212090819
LANG fr
......@@ -69,7 +67,7 @@ PUBLISHER_PLACE Paris
DATEPUB 2003
CREATE TABLE t2
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.zip' ZIPPED=YES
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t2;
ISBN 9782212090819
LANG fr
......
--source have_libxml2.inc
--source windows.inc
--echo #
--echo # Testing changing table type (not in-place)
......@@ -11,7 +11,7 @@ SELECT * FROM t1;
--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='rownode=row';
ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='xmlsup=domdoc,rownode=row';
SELECT * FROM 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';
SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
# TODO: add a better error message
--error ER_GET_ERRMSG
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
INSERT INTO t1 VALUES ('','','','');
DROP TABLE t1;
......
......@@ -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
#
--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%';
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;
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;
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;
connection master;
......
......@@ -19,7 +19,7 @@ SELECT * FROM t1 WHERE command IN ('Warning','Note',
"insert into t1(msg) values('One'),(NULL),('Three')",
"insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'",
"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",
'select * from t1');
......@@ -31,7 +31,7 @@ CREATE PROCEDURE p1(cmd varchar(512))
READS SQL DATA
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');
DROP PROCEDURE p1;
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);
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;
connection master;
......
......@@ -13,9 +13,9 @@ INSERT INTO t1(a,b,c,d) VALUES(255,65535,4294967295,18446744073709551615);
SELECT * FROM t1;
UPDATE t1 SET e = d;
SELECT * FROM t1;
UPDATE t1 SET c = d;
UPDATE IGNORE t1 SET c = d;
SELECT * FROM t1;
UPDATE t1 SET c = e;
UPDATE IGNORE t1 SET c = e;
SELECT * FROM t1;
UPDATE t1 SET d = e;
SELECT * FROM t1;
......
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
CREATE TABLE employee
(
serialno CHAR(5) NOT NULL,
......@@ -150,4 +152,6 @@ CALL test.tst_up();
DROP PROCEDURE test.tst_up;
DROP TABLE employee;
SET sql_mode = DEFAULT;
--remove_file $MYSQLD_DATADIR/test/employee.dat
--source have_libxml2.inc
--source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`;
......@@ -26,7 +26,7 @@ CREATE TABLE t1
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1;
DROP TABLE t1;
......@@ -42,7 +42,7 @@ CREATE TABLE t1
PUBLISHER CHAR(40),
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1;
DROP TABLE t1;
......@@ -55,7 +55,7 @@ CREATE TABLE t1 (
LANG CHAR(2),
SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2';
OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1;
DROP TABLE t1;
......@@ -68,7 +68,7 @@ CREATE TABLE t1 (
LANG CHAR(2),
SUBJECT CHAR(32)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
OPTION_LIST='Coltype=@,xmlsup=libxml2';
OPTION_LIST='Coltype=@,xmlsup=domdoc';
SELECT * FROM t1;
DROP TABLE t1;
......@@ -87,7 +87,7 @@ CREATE TABLE t1 (
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample.xml'
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM t1;
DROP TABLE t1;
......@@ -108,7 +108,7 @@ CREATE TABLE t1 (
DATEPUB INT(4)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xsample2.xml'
TABNAME='BIBLIO'
OPTION_LIST='rownode=BOOK,xmlsup=libxml2';
OPTION_LIST='rownode=BOOK,xmlsup=domdoc';
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);
......@@ -136,7 +136,7 @@ CREATE TABLE t1 (
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';
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1;
SELECT isbn, title, translated, tranfn, tranln, location FROM t1
WHERE translated <> '';
......@@ -180,7 +180,7 @@ 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';
TABNAME='BIBLIO' OPTION_LIST='rownode=BOOK,skipnull=1,xmlsup=domdoc';
SELECT * FROM t1;
DROP TABLE t1;
......@@ -194,14 +194,14 @@ CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'
OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=latin1;
CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2'
OPTION_LIST='xmlsup=domdoc'
DATA_CHARSET=utf8;
SHOW CREATE TABLE t1;
SELECT c, HEX(c) FROM t1;
......@@ -211,7 +211,7 @@ CREATE TABLE t1
(
c CHAR(16)
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
......@@ -219,7 +219,7 @@ CREATE TABLE t1
(
c CHAR(16) CHARACTER SET utf8
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
......@@ -232,7 +232,7 @@ CREATE TABLE t1
(
c CHAR(16) CHARACTER SET cp1251
) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='latin1.xml'
OPTION_LIST='xmlsup=libxml2';
OPTION_LIST='xmlsup=domdoc';
SELECT c, HEX(c) FROM t1;
DROP TABLE t1;
......@@ -240,24 +240,24 @@ 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;
#CREATE TABLE t1
#(
# c CHAR(16) CHARACTER SET utf8
#) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='cp1251.xml'
# OPTION_LIST='xmlsup=domdoc,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=domdoc,rownode=b';
#SELECT * FROM t1;
#INSERT INTO t1 VALUES ('ОПРСТ');
#SELECT c, HEX(c) FROM t1;
#DROP TABLE t1;
--echo #
......@@ -266,11 +266,11 @@ DROP TABLE t1;
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';
OPTION_LIST='xmlsup=domdoc,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
#--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);
......@@ -280,11 +280,11 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
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';
OPTION_LIST='xmlsup=domdoc,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
#--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);
......@@ -298,13 +298,13 @@ SELECT HEX(EXTRACTVALUE(@a,'/t1/line/node'));
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';
OPTION_LIST='xmlsup=domdoc,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
#--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);
......
--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 have_libxml2.inc
-- source windows.inc
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;
--source grant.inc
--source have_libxml2.inc
--source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`;
......@@ -15,7 +15,7 @@ CREATE TABLE beers (
`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';
TABNAME='table' OPTION_LIST='xmlsup=domdoc,rownode=tr,colnode=td';
SELECT * FROM beers;
DROP TABLE beers;
......@@ -28,7 +28,7 @@ CREATE TABLE coffee (
`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';
TABNAME='TABLE' HEADER=1 OPTION_LIST='xmlsup=domdoc,Coltype=HTML';
SELECT * FROM coffee;
DROP TABLE coffee;
......
--source have_libxml2.inc
--source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`;
......
--source have_libxml2.inc
--source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`;
......@@ -21,7 +21,7 @@ CREATE TABLE `bookstore` (
`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';
ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='bookstore.xml' OPTION_LIST='expand=1,mulnode=author,limit=6,xmlsup=domdoc';
SELECT * FROM bookstore;
SELECT category, title, price FROM bookstore;
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%';
--echo #
--echo # Limiting expanded values
--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;
--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%';
......@@ -40,7 +40,7 @@ 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';
ALTER TABLE bookstore OPTION_LIST='mulnode=author,limit=6,xmlsup=domdoc';
--echo # truncated
SELECT * FROM bookstore;
--echo # increase author size
......@@ -51,7 +51,7 @@ SELECT * FROM bookstore;
--echo #
--echo # Limiting concatenated values
--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;
--echo # The where clause is applied on the concatenated column result
SELECT category, title, author, price FROM bookstore WHERE author LIKE 'J%';
......
--source have_zip.inc
--source have_libxml2.inc
--source windows.inc
let $MYSQLD_DATADIR= `select @@datadir`;
......@@ -24,13 +24,13 @@ 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';
OPTION_LIST='entry=xsample2.xml,load=xsample2.xml,rownode=BOOK,xmlsup=domdoc,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';
OPTION_LIST='xmlsup=domdoc';
SELECT * FROM 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