Commit b5c5f317 authored by Sergei Golubchik's avatar Sergei Golubchik

convert files from CRLF to LF line endings

parent e774008b
This diff is collapsed.
# Use default setting for mysqld processes # Use default setting for mysqld processes
!include include/default_mysqld.cnf !include include/default_mysqld.cnf
!include include/default_client.cnf !include include/default_client.cnf
[mysqld.1] [mysqld.1]
#log-bin= master-bin #log-bin= master-bin
[mysqld.2] [mysqld.2]
[ENV] [ENV]
MASTER_MYPORT= @mysqld.1.port MASTER_MYPORT= @mysqld.1.port
MASTER_MYSOCK= @mysqld.1.socket MASTER_MYSOCK= @mysqld.1.socket
SLAVE_MYPORT= @mysqld.2.port SLAVE_MYPORT= @mysqld.2.port
SLAVE_MYSOCK= @mysqld.2.socket SLAVE_MYSOCK= @mysqld.2.socket
PGCLIENTENCODING= UTF8 PGCLIENTENCODING= UTF8
[ [
{ {
"ISBN": "9782212090819", "ISBN": "9782212090819",
"LANG": "fr", "LANG": "fr",
"SUBJECT": "applications", "SUBJECT": "applications",
"AUTHOR": [ "AUTHOR": [
{ {
"FIRSTNAME": "Jean-Christophe", "FIRSTNAME": "Jean-Christophe",
"LASTNAME": "Bernadac" "LASTNAME": "Bernadac"
}, },
{ {
"FIRSTNAME": "François", "FIRSTNAME": "François",
"LASTNAME": "Knab" "LASTNAME": "Knab"
} }
], ],
"TITLE": "Construire une application XML", "TITLE": "Construire une application XML",
"PUBLISHER": { "PUBLISHER": {
"NAME": "Eyrolles", "NAME": "Eyrolles",
"PLACE": "Paris" "PLACE": "Paris"
}, },
"DATEPUB": 1999 "DATEPUB": 1999
}, },
{ {
"ISBN": "9782840825685", "ISBN": "9782840825685",
"LANG": "fr", "LANG": "fr",
"SUBJECT": "applications", "SUBJECT": "applications",
"AUTHOR": [ "AUTHOR": [
{ {
"FIRSTNAME": "William J.", "FIRSTNAME": "William J.",
"LASTNAME": "Pardi" "LASTNAME": "Pardi"
} }
], ],
"TITLE": "XML en Action", "TITLE": "XML en Action",
"TRANSLATION": "adapté de l'anglais par", "TRANSLATION": "adapté de l'anglais par",
"TRANSLATOR": { "TRANSLATOR": {
"FIRSTNAME": "James", "FIRSTNAME": "James",
"LASTNAME": "Guerin" "LASTNAME": "Guerin"
}, },
"PUBLISHER": { "PUBLISHER": {
"NAME": "Microsoft Press", "NAME": "Microsoft Press",
"PLACE": "Paris" "PLACE": "Paris"
}, },
"DATEPUB": 1999 "DATEPUB": 1999
} }
] ]
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<bookstore> <bookstore>
<book category="COOKING"> <book category="COOKING">
<title lang="en">Everyday Italian</title> <title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author> <author>Giada De Laurentiis</author>
<year>2005</year> <year>2005</year>
<price>30.00</price> <price>30.00</price>
</book> </book>
<book category="CHILDREN"> <book category="CHILDREN">
<title lang="en">Harry Potter</title> <title lang="en">Harry Potter</title>
<author>J K. Rowling</author> <author>J K. Rowling</author>
<year>2005</year> <year>2005</year>
<price>29.99</price> <price>29.99</price>
</book> </book>
<book category="WEB"> <book category="WEB">
<title lang="en">XQuery Kick Start</title> <title lang="en">XQuery Kick Start</title>
<author>James McGovern</author> <author>James McGovern</author>
<author>Per Bothner</author> <author>Per Bothner</author>
<author>Kurt Cagle</author> <author>Kurt Cagle</author>
<author>James Linn</author> <author>James Linn</author>
<author>Vaidyanathan Nagarajan</author> <author>Vaidyanathan Nagarajan</author>
<year>2003</year> <year>2003</year>
<price>49.99</price> <price>49.99</price>
</book> </book>
<book category="WEB"> <book category="WEB">
<title lang="en">Learning XML</title> <title lang="en">Learning XML</title>
<author>Erik T. Ray</author> <author>Erik T. Ray</author>
<year>2003</year> <year>2003</year>
<price>39.95</price> <price>39.95</price>
</book> </book>
</bookstore> </bookstore>
[ [
{ {
"WHO": "Joe", "WHO": "Joe",
"WEEK": [ "WEEK": [
{ {
"NUMBER": 3, "NUMBER": 3,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 18.00 "AMOUNT": 18.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 20.00 "AMOUNT": 20.00
} }
] ]
}, },
{ {
"NUMBER": 4, "NUMBER": 4,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 16.00 "AMOUNT": 16.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 17.00 "AMOUNT": 17.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 17.00 "AMOUNT": 17.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 14.00 "AMOUNT": 14.00
} }
] ]
}, },
{ {
"NUMBER": 5, "NUMBER": 5,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 14.00 "AMOUNT": 14.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
} }
] ]
} }
] ]
}, },
{ {
"WHO": "Beth", "WHO": "Beth",
"WEEK": [ "WEEK": [
{ {
"NUMBER": 3, "NUMBER": 3,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 16.00 "AMOUNT": 16.00
} }
] ]
}, },
{ {
"NUMBER": 4, "NUMBER": 4,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 17.00 "AMOUNT": 17.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 15.00 "AMOUNT": 15.00
} }
] ]
}, },
{ {
"NUMBER": 5, "NUMBER": 5,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 20.00 "AMOUNT": 20.00
} }
] ]
} }
] ]
}, },
{ {
"WHO": "Janet", "WHO": "Janet",
"WEEK": [ "WEEK": [
{ {
"NUMBER": 3, "NUMBER": 3,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 18.00 "AMOUNT": 18.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 18.00 "AMOUNT": 18.00
} }
] ]
}, },
{ {
"NUMBER": 4, "NUMBER": 4,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 17.00 "AMOUNT": 17.00
} }
] ]
}, },
{ {
"NUMBER": 5, "NUMBER": 5,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 14.00 "AMOUNT": 14.00
}, },
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 12.00 "AMOUNT": 12.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
} }
] ]
} }
] ]
} }
] ]
[ [
{ {
"WHO": "Joe", "WHO": "Joe",
"WEEK": 3, "WEEK": 3,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 18.00 "AMOUNT": 18.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 20.00 "AMOUNT": 20.00
} }
] ]
}, },
{ {
"WHO": "Beth", "WHO": "Beth",
"WEEK": 3, "WEEK": 3,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 16.00 "AMOUNT": 16.00
} }
] ]
}, },
{ {
"WHO": "Janet", "WHO": "Janet",
"WEEK": 3, "WEEK": 3,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 18.00 "AMOUNT": 18.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 18.00 "AMOUNT": 18.00
} }
] ]
} }
] ]
[ [
{ {
"WHO": "Joe", "WHO": "Joe",
"WEEK": 4, "WEEK": 4,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 16.00 "AMOUNT": 16.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 17.00 "AMOUNT": 17.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 17.00 "AMOUNT": 17.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 14.00 "AMOUNT": 14.00
} }
] ]
}, },
{ {
"WHO": "Beth", "WHO": "Beth",
"WEEK": 4, "WEEK": 4,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 17.00 "AMOUNT": 17.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 15.00 "AMOUNT": 15.00
} }
] ]
}, },
{ {
"WHO": "Janet", "WHO": "Janet",
"WEEK": 4, "WEEK": 4,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 17.00 "AMOUNT": 17.00
} }
] ]
} }
] ]
[ [
{ {
"WHO": "Joe", "WHO": "Joe",
"WEEK": 5, "WEEK": 5,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 14.00 "AMOUNT": 14.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
} }
] ]
}, },
{ {
"WHO": "Beth", "WHO": "Beth",
"WEEK": 5, "WEEK": 5,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 20.00 "AMOUNT": 20.00
} }
] ]
}, },
{ {
"WHO": "Janet", "WHO": "Janet",
"WEEK": 5, "WEEK": 5,
"EXPENSE": [ "EXPENSE": [
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 14.00 "AMOUNT": 14.00
}, },
{ {
"WHAT": "Car", "WHAT": "Car",
"AMOUNT": 12.00 "AMOUNT": 12.00
}, },
{ {
"WHAT": "Beer", "WHAT": "Beer",
"AMOUNT": 19.00 "AMOUNT": 19.00
}, },
{ {
"WHAT": "Food", "WHAT": "Food",
"AMOUNT": 12.00 "AMOUNT": 12.00
} }
] ]
} }
] ]
0;Inconnu 0;Inconnu
1;Masculin 1;Masculin
2;Feminin 2;Feminin
.;Inconnu .;Inconnu
C;Celibataire C;Celibataire
D;Divorce D;Divorce
L;Union libre L;Union libre
M;Marie M;Marie
S;Separe S;Separe
V;Veuf V;Veuf
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--echo # --echo #
--echo # Testing indexing with ALTER on inward table (in-place) --echo # Testing indexing with ALTER on inward table (in-place)
--echo # --echo #
CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT; CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT;
INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three'); INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
SELECT * FROM t1; SELECT * FROM t1;
CREATE INDEX xc ON t1(c); CREATE INDEX xc ON t1(c);
DESCRIBE SELECT * FROM t1 WHERE c = 2; DESCRIBE SELECT * FROM t1 WHERE c = 2;
DROP INDEX xc ON t1; DROP INDEX xc ON t1;
CREATE INDEX xd ON t1(d); CREATE INDEX xd ON t1(d);
DROP INDEX xd ON t1; DROP INDEX xd ON t1;
ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d); ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd; ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
--echo # --echo #
--echo # Testing modifying columns inward table (not in-place) --echo # Testing modifying columns inward table (not in-place)
--echo # --echo #
ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL; ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL; ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL;
--echo # --echo #
--echo # Fails because indexing must be in-place --echo # Fails because indexing must be in-place
--echo # --echo #
--error ER_ALTER_OPERATION_NOT_SUPPORTED --error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t1 MODIFY COLUMN c CHAR(10) NOT NULL, ADD INDEX xd (d); ALTER TABLE t1 MODIFY COLUMN c CHAR(10) NOT NULL, ADD INDEX xd (d);
--echo # --echo #
--echo # Testing changing table type (not in-place) --echo # Testing changing table type (not in-place)
--echo # --echo #
ALTER TABLE t1 TABLE_TYPE=CSV HEADER=1 QUOTED=1; ALTER TABLE t1 TABLE_TYPE=CSV HEADER=1 QUOTED=1;
SELECT * FROM t1; SELECT * FROM t1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--echo # create an outward table used to see the t1 file --echo # create an outward table used to see the t1 file
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.csv'; CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.csv';
SELECT * FROM t2; SELECT * FROM t2;
--echo # --echo #
--echo # Testing changing engine --echo # Testing changing engine
--echo # --echo #
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT; CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT;
INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three'); INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d); ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
ALTER TABLE t1 ENGINE = MYISAM; ALTER TABLE t1 ENGINE = MYISAM;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 ENGINE = CONNECT TABLE_TYPE=DBF; ALTER TABLE t1 ENGINE = CONNECT TABLE_TYPE=DBF;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo # --echo #
--echo # Testing ALTER on outward tables --echo # Testing ALTER on outward tables
--echo # --echo #
CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='tf1.txt' ENDING=1; CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='tf1.txt' ENDING=1;
INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three'); INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
SELECT * FROM t1; SELECT * FROM t1;
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='tf1.txt'; CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='tf1.txt';
SELECT * FROM t2; SELECT * FROM t2;
--echo # --echo #
--echo # Indexing works the same --echo # Indexing works the same
--echo # --echo #
ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d); ALTER TABLE t1 ADD INDEX xc (c), ADD INDEX xd (d);
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
SELECT d FROM t1 WHERE c = 2; SELECT d FROM t1 WHERE c = 2;
ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd; ALTER TABLE t1 DROP INDEX xc, DROP INDEX xd;
SHOW INDEX FROM t1; SHOW INDEX FROM t1;
--echo # --echo #
--echo # Other alterations do not modify the file --echo # Other alterations do not modify the file
--echo # --echo #
ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL; ALTER TABLE t1 MODIFY COLUMN c CHAR(5) NOT NULL;
SELECT * FROM t2; SELECT * FROM t2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
#Wrong result #Wrong result
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL; ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL;
--echo # --echo #
--echo # Changing column order --echo # Changing column order
--echo # --echo #
ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL AFTER d; ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL AFTER d;
SELECT * FROM t2; SELECT * FROM t2;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--echo # Wrong result --echo # Wrong result
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL FIRST; ALTER TABLE t1 MODIFY COLUMN c INT NOT NULL FIRST;
--echo # What should have been done --echo # What should have been done
ALTER TABLE t1 MODIFY c INT NOT NULL FLAG=0 AFTER d, MODIFY d CHAR(10) NOT NULL FLAG=11; ALTER TABLE t1 MODIFY c INT NOT NULL FLAG=0 AFTER d, MODIFY d CHAR(10) NOT NULL FLAG=11;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
--echo # --echo #
--echo # Changing to another engine is Ok --echo # Changing to another engine is Ok
--echo # However, the data file is not deleted. --echo # However, the data file is not deleted.
--echo # --echo #
ALTER TABLE t1 ENGINE=ARIA; ALTER TABLE t1 ENGINE=ARIA;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
set @old_sql_mode=@@sql_mode; set @old_sql_mode=@@sql_mode;
set sql_mode=ignore_bad_table_options; set sql_mode=ignore_bad_table_options;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
set sql_mode=@old_sql_mode; set sql_mode=@old_sql_mode;
SELECT * from t1; SELECT * from t1;
SELECT * from t2; SELECT * from t2;
--echo # --echo #
--echo # Changing back to CONNECT fails --echo # Changing back to CONNECT fails
--echo # Sure enough, the data file was not deleted. --echo # Sure enough, the data file was not deleted.
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
ALTER TABLE t1 ENGINE=CONNECT; ALTER TABLE t1 ENGINE=CONNECT;
--echo # --echo #
--echo # But changing back to CONNECT succeed --echo # But changing back to CONNECT succeed
--echo # if the data file does not exist. --echo # if the data file does not exist.
--echo # --echo #
--remove_file $MYSQLD_DATADIR/test/tf1.txt --remove_file $MYSQLD_DATADIR/test/tf1.txt
ALTER TABLE t1 ENGINE=CONNECT; ALTER TABLE t1 ENGINE=CONNECT;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * from t1; SELECT * from t1;
SELECT * from t2; SELECT * from t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# Clean up # Clean up
# #
--remove_file $MYSQLD_DATADIR/test/tf1.txt --remove_file $MYSQLD_DATADIR/test/tf1.txt
--source have_libxml2.inc --source have_libxml2.inc
--echo # --echo #
--echo # Testing changing table type (not in-place) --echo # Testing changing table type (not in-place)
--echo # --echo #
CREATE TABLE t1 (c INT NOT NULL, d CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1 QUOTED=1; 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'); INSERT INTO t1 VALUES (1,'One'), (2,'Two'), (3,'Three');
SELECT * FROM t1; SELECT * FROM t1;
--echo # This would fail if the top node name is not specified. --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 # This is because the XML top node name defaults to the table name.
--echo # Sure enough the temporary table name begins with '#' and is rejected by XML. --echo # Sure enough the temporary table name begins with '#' and is rejected by XML.
--echo # Therefore the top node name must be specified (along with the row nodes name). --echo # Therefore the top node name must be specified (along with the row nodes name).
ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row'; ALTER TABLE t1 TABLE_TYPE=XML TABNAME=t1 OPTION_LIST='rownode=row';
SELECT * FROM t1; SELECT * FROM t1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--echo # Let us see the XML file --echo # Let us see the XML file
CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml'; CREATE TABLE t2 (line VARCHAR(100) NOT NULL) ENGINE=CONNECT FILE_NAME='t1.xml';
SELECT * FROM t2; SELECT * FROM t2;
--echo # NOTE: The first (ignored) row is due to the remaining HEADER=1 option. --echo # NOTE: The first (ignored) row is due to the remaining HEADER=1 option.
--echo # Testing field option modification --echo # Testing field option modification
ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0; ALTER TABLE t1 MODIFY d CHAR(10) NOT NULL FIELD_FORMAT='@', HEADER=0;
SELECT * FROM t1; SELECT * FROM t1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat --copy_file $MTR_SUITE_DIR/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat
--echo # --echo #
--echo # Testing errors --echo # Testing errors
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT NOT NULL ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt'; ) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/ --replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows # TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb) --replace_result Open(rt) Open(rb)
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
SET time_zone='+00:00'; SET time_zone='+00:00';
CREATE TABLE t1 CREATE TABLE t1
( (
fig INT(4) NOT NULL FIELD_FORMAT='C', fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null, name CHAR(10) not null,
birth DATE NOT NULL, birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S', id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F', salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S' dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat'; ) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
SELECT * FROM t1; SELECT * FROM t1;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES (55555,'RONALD','1980-02-26','3333',4444.44,555); INSERT INTO t1 VALUES (55555,'RONALD','1980-02-26','3333',4444.44,555);
INSERT INTO t1 VALUES (5555,'RONALD','1980-02-26','3333',4444.44,555); INSERT INTO t1 VALUES (5555,'RONALD','1980-02-26','3333',4444.44,555);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # Testing READONLY tables --echo # Testing READONLY tables
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
fig INT(4) NOT NULL FIELD_FORMAT='C', fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null, name CHAR(10) not null,
birth DATE NOT NULL, birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S', id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F', salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S' dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat'; ) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat';
--error ER_OPEN_AS_READONLY --error ER_OPEN_AS_READONLY
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ALTER TABLE t1 READONLY=NO; ALTER TABLE t1 READONLY=NO;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 READONLY=YES; ALTER TABLE t1 READONLY=YES;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--error ER_OPEN_AS_READONLY --error ER_OPEN_AS_READONLY
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # Testing that the underlying file is created --echo # Testing that the underlying file is created
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
c CHAR(4) NOT NULL FIELD_FORMAT='C' c CHAR(4) NOT NULL FIELD_FORMAT='C'
) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat'; ) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat';
INSERT INTO t1 VALUES (10),(20),(300),(4000); INSERT INTO t1 VALUES (10),(20),(300),(4000);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
# Clean up # Clean up
# #
--remove_file $MYSQLD_DATADIR/test/Testbal.dat --remove_file $MYSQLD_DATADIR/test/Testbal.dat
--remove_file $MYSQLD_DATADIR/test/bin2.dat --remove_file $MYSQLD_DATADIR/test/bin2.dat
--echo # --echo #
--echo # Testing out of range dates as (var)char --echo # Testing out of range dates as (var)char
--echo # --echo #
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT NOT NULL, id INT NOT NULL,
dat CHAR(10) NOT NULL, dat CHAR(10) NOT NULL,
tim CHAR(8) DEFAULT '09:35:08', tim CHAR(8) DEFAULT '09:35:08',
datim CHAR(19) DEFAULT '1789-08-10 14:20:30') datim CHAR(19) DEFAULT '1789-08-10 14:20:30')
ENGINE=CONNECT TABLE_TYPE=FIX; ENGINE=CONNECT TABLE_TYPE=FIX;
INSERT INTO t1(id,dat) VALUES(1,'1515-04-01'),(2,'2014-07-26'),(3,'2118-11-02'); INSERT INTO t1(id,dat) VALUES(1,'1515-04-01'),(2,'2014-07-26'),(3,'2118-11-02');
SELECT * FROM t1; SELECT * FROM t1;
SELECT id, DATE(datim) FROM t1 LIMIT 1; SELECT id, DATE(datim) FROM t1 LIMIT 1;
SELECT id, DAYNAME(dat) FROM t1; SELECT id, DAYNAME(dat) FROM t1;
SELECT id, DAYNAME(datim) FROM t1 LIMIT 1; SELECT id, DAYNAME(datim) FROM t1 LIMIT 1;
SELECT id, TIME(tim) FROM t1 LIMIT 1; SELECT id, TIME(tim) FROM t1 LIMIT 1;
DROP TABLE t1; DROP TABLE t1;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/funny.txt $MYSQLD_DATADIR/test/funny.txt --copy_file $MTR_SUITE_DIR/std_data/funny.txt $MYSQLD_DATADIR/test/funny.txt
--copy_file $MTR_SUITE_DIR/std_data/funny2.txt $MYSQLD_DATADIR/test/funny2.txt --copy_file $MTR_SUITE_DIR/std_data/funny2.txt $MYSQLD_DATADIR/test/funny2.txt
--echo # --echo #
--echo # Testing errors --echo # Testing errors
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT NOT NULL field_format=' %n%d%n' ID INT NOT NULL field_format=' %n%d%n'
) Engine=CONNECT table_type=FMT file_name='nonexistent.txt'; ) Engine=CONNECT table_type=FMT file_name='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/ --replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows # TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb) --replace_result Open(rt) Open(rb)
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # Testing update on FMT tables --echo # Testing update on FMT tables
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT NOT NULL field_format=' %n%d%n' id INT NOT NULL field_format=' %n%d%n'
) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt'; ) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt';
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES (10),(20); INSERT INTO t1 VALUES (10),(20);
# TODO: # TODO:
#--error ER_GET_ERRMSG #--error ER_GET_ERRMSG
#UPDATE t1 SET id=20; #UPDATE t1 SET id=20;
#TRUNCATE TABLE t1; #TRUNCATE TABLE t1;
#DELETE FROM t1 WHERE id=10; #DELETE FROM t1 WHERE id=10;
#SELECT * FROM t1; #SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#--remove_file $MYSQLD_DATADIR/test/t1.txt #--remove_file $MYSQLD_DATADIR/test/t1.txt
--echo # --echo #
--echo # Testing manual examples --echo # Testing manual examples
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
ID Integer(5) not null field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=" , '%n%[^']%n'", NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) not null field_format=' , #%n%d%n', DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) not null field_format=' ; %n%f%n' SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny.txt'; ) Engine=CONNECT table_type=FMT file_name='funny.txt';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
# TODO: shoudn't a warning instead of error be returned on bad format? # TODO: shoudn't a warning instead of error be returned on bad format?
# #
CREATE TABLE t1 CREATE TABLE t1
( (
ID Integer(5) not null field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=" , '%n%[^']%n'", NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) not null field_format=' , #%n%d%n', DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) not null field_format=' ; %n%f%n' SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt'; ) Engine=CONNECT table_type=FMT file_name='funny2.txt';
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
ID Integer(5) not null field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=' , ''%n%[^'']%m', NAME Char(16) not null field_format=' , ''%n%[^'']%m',
DEPNO Integer(4) not null field_format=''' , #%n%d%m', DEPNO Integer(4) not null field_format=''' , #%n%d%m',
SALARY Double(12,2) not null field_format=' ; %n%f%n' SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt'; ) Engine=CONNECT table_type=FMT file_name='funny2.txt';
SELECT * FROM t1; SELECT * FROM t1;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
UPDATE t1 SET SALARY=1234; UPDATE t1 SET SALARY=1234;
# TODO: this query crashes # TODO: this query crashes
# UPDATE t1 SET SALARY=1234 WHERE ID=56; # UPDATE t1 SET SALARY=1234 WHERE ID=56;
DELETE FROM t1 WHERE ID=56; DELETE FROM t1 WHERE ID=56;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
# Clean up # Clean up
# #
--remove_file $MYSQLD_DATADIR/test/funny.txt --remove_file $MYSQLD_DATADIR/test/funny.txt
--remove_file $MYSQLD_DATADIR/test/funny2.txt --remove_file $MYSQLD_DATADIR/test/funny2.txt
--echo # --echo #
--echo # Testing features not specific to any TABLE_TYPE --echo # Testing features not specific to any TABLE_TYPE
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
#SHOW CREATE TABLE t1; #SHOW CREATE TABLE t1;
#DROP TABLE t1; #DROP TABLE t1;
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX;
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
SELECT * FROM t1; SELECT * FROM t1;
#--error ER_GET_ERRMSG #--error ER_GET_ERRMSG
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
ALTER TABLE t1 TABLE_TYPE=NON_EXISTING; ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--source json_udf.inc --source json_udf.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/biblio.json $MYSQLD_DATADIR/test/biblio.json --copy_file $MTR_SUITE_DIR/std_data/biblio.json $MYSQLD_DATADIR/test/biblio.json
--copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat --copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
--echo # --echo #
--echo # Test UDF's with constant arguments --echo # Test UDF's with constant arguments
--echo # --echo #
SELECT Json_Array(); SELECT Json_Array();
SELECT Json_Object(56,3.1416,'foo',NULL); SELECT Json_Object(56,3.1416,'foo',NULL);
SELECT Json_Object(56 qty,3.1416 price,'foo' truc, NULL garanty); SELECT Json_Object(56 qty,3.1416 price,'foo' truc, NULL garanty);
SELECT Json_Array(56,3.1416,'My name is "Foo"',NULL); SELECT Json_Array(56,3.1416,'My name is "Foo"',NULL);
--error ER_CANT_INITIALIZE_UDF --error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL)) Array; SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL)) Array;
SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL),'One more') Array; SELECT Json_Array_Add(Json_Array(56,3.1416,'foo',NULL),'One more') Array;
SELECT Json_Array_Add(Json_Value('one value'),'One more'); SELECT Json_Array_Add(Json_Value('one value'),'One more');
--error ER_CANT_INITIALIZE_UDF --error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Add('one value','One more'); SELECT Json_Array_Add('one value','One more');
SELECT Json_Array_Add('one value' json_,'One more'); SELECT Json_Array_Add('one value' json_,'One more');
--error ER_CANT_INITIALIZE_UDF --error ER_CANT_INITIALIZE_UDF
SELECT Json_Value(56,3.1416,'foo',NULL); SELECT Json_Value(56,3.1416,'foo',NULL);
SELECT Json_Value(3.1416); SELECT Json_Value(3.1416);
SELECT Json_Value('foo'); SELECT Json_Value('foo');
SELECT Json_Value(NULL); SELECT Json_Value(NULL);
SELECT Json_Value(); SELECT Json_Value();
SELECT Json_Object(); SELECT Json_Object();
SELECT Json_Object(Json_Array(56,3.1416,'foo'),NULL); SELECT Json_Object(Json_Array(56,3.1416,'foo'),NULL);
SELECT Json_Array(Json_Array(56,3.1416,'foo'),NULL); SELECT Json_Array(Json_Array(56,3.1416,'foo'),NULL);
SELECT Json_Array(Json_Object(56 "qty",3.1416 "price",'foo'),NULL); SELECT Json_Array(Json_Object(56 "qty",3.1416 "price",'foo'),NULL);
--echo # --echo #
--echo # Test UDF's with column arguments --echo # Test UDF's with column arguments
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
ISBN CHAR(15), ISBN CHAR(15),
LANG CHAR(2), LANG CHAR(2),
SUBJECT CHAR(32), SUBJECT CHAR(32),
AUTHOR CHAR(64), AUTHOR CHAR(64),
TITLE CHAR(32), TITLE CHAR(32),
TRANSLATION CHAR(32), TRANSLATION CHAR(32),
TRANSLATOR CHAR(80), TRANSLATOR CHAR(80),
PUBLISHER CHAR(32), PUBLISHER CHAR(32),
DATEPUB int(4) DATEPUB int(4)
) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json'; ) ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='biblio.json';
SELECT Json_Array(AUTHOR, TITLE, DATEPUB) FROM t1; SELECT Json_Array(AUTHOR, TITLE, DATEPUB) FROM t1;
SELECT Json_Object(AUTHOR, TITLE, DATEPUB) FROM t1; SELECT Json_Object(AUTHOR, TITLE, DATEPUB) FROM t1;
--error ER_CANT_INITIALIZE_UDF --error ER_CANT_INITIALIZE_UDF
SELECT Json_Array_Grp(TITLE, DATEPUB) FROM t1; SELECT Json_Array_Grp(TITLE, DATEPUB) FROM t1;
SELECT Json_Array_Grp(TITLE) FROM t1; SELECT Json_Array_Grp(TITLE) FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
SERIALNO CHAR(5) NOT NULL, SERIALNO CHAR(5) NOT NULL,
NAME VARCHAR(12) NOT NULL FLAG=6, NAME VARCHAR(12) NOT NULL FLAG=6,
SEX SMALLINT(1) NOT NULL, SEX SMALLINT(1) NOT NULL,
TITLE VARCHAR(15) NOT NULL FLAG=20, TITLE VARCHAR(15) NOT NULL FLAG=20,
MANAGER CHAR(5) DEFAULT NULL, MANAGER CHAR(5) DEFAULT NULL,
DEPARTMENT CHAr(4) NOT NULL FLAG=41, DEPARTMENT CHAr(4) NOT NULL FLAG=41,
SECRETARY CHAR(5) DEFAULT NULL FLAG=46, SECRETARY CHAR(5) DEFAULT NULL FLAG=46,
SALARY DOUBLE(8,2) NOT NULL FLAG=52 SALARY DOUBLE(8,2) NOT NULL FLAG=52
) ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=8 FILE_NAME='employee.dat' ENDING=1; ) ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=8 FILE_NAME='employee.dat' ENDING=1;
SELECT Json_Object(SERIALNO, NAME, TITLE, SALARY) FROM t1 WHERE NAME = 'MERCHANT'; SELECT Json_Object(SERIALNO, NAME, TITLE, SALARY) FROM t1 WHERE NAME = 'MERCHANT';
SELECT DEPARTMENT, Json_Array_Grp(NAME) FROM t1 GROUP BY DEPARTMENT; SELECT DEPARTMENT, Json_Array_Grp(NAME) FROM t1 GROUP BY DEPARTMENT;
set connect_json_grp_size=30; set connect_json_grp_size=30;
SELECT Json_Array(DEPARTMENT, Json_Array_Grp(NAME)) FROM t1 GROUP BY DEPARTMENT; SELECT Json_Array(DEPARTMENT, Json_Array_Grp(NAME)) FROM t1 GROUP BY DEPARTMENT;
SELECT Json_Object(DEPARTMENT, Json_Array_Grp(NAME) json_NAMES) FROM t1 GROUP BY DEPARTMENT; SELECT Json_Object(DEPARTMENT, Json_Array_Grp(NAME) json_NAMES) FROM t1 GROUP BY DEPARTMENT;
SELECT Json_Object(DEPARTMENT, Json_Array_Grp(Json_Object(SERIALNO, NAME, TITLE, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT; SELECT Json_Object(DEPARTMENT, Json_Array_Grp(Json_Object(SERIALNO, NAME, TITLE, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT;
SELECT Json_Object(DEPARTMENT, TITLE, Json_Array_Grp(Json_Object(SERIALNO, NAME, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT, TITLE; SELECT Json_Object(DEPARTMENT, TITLE, Json_Array_Grp(Json_Object(SERIALNO, NAME, SALARY)) json_EMPLOYES) FROM t1 GROUP BY DEPARTMENT, TITLE;
--error ER_CANT_INITIALIZE_UDF --error ER_CANT_INITIALIZE_UDF
SELECT Json_Object_Grp(SALARY) FROM t1; SELECT Json_Object_Grp(SALARY) FROM t1;
SELECT Json_Object_Grp(SALARY, NAME) FROM t1; SELECT Json_Object_Grp(SALARY, NAME) FROM t1;
SELECT Json_Object(DEPARTMENT, Json_Object_Grp(SALARY, NAME) "Json_SALARIES") FROM t1 GROUP BY DEPARTMENT; SELECT Json_Object(DEPARTMENT, Json_Object_Grp(SALARY, NAME) "Json_SALARIES") FROM t1 GROUP BY DEPARTMENT;
SELECT Json_Array_Grp(NAME) from t1; SELECT Json_Array_Grp(NAME) from t1;
DROP TABLE t1; DROP TABLE t1;
DROP FUNCTION Json_Array; DROP FUNCTION Json_Array;
DROP FUNCTION Json_Array_Add; DROP FUNCTION Json_Array_Add;
DROP FUNCTION Json_Object; DROP FUNCTION Json_Object;
DROP FUNCTION Json_Object_Nonull; DROP FUNCTION Json_Object_Nonull;
DROP FUNCTION Json_Value; DROP FUNCTION Json_Value;
DROP FUNCTION Json_Array_Grp; DROP FUNCTION Json_Array_Grp;
DROP FUNCTION Json_Object_Grp; DROP FUNCTION Json_Object_Grp;
# #
# Clean up # Clean up
# #
--remove_file $MYSQLD_DATADIR/test/biblio.json --remove_file $MYSQLD_DATADIR/test/biblio.json
--remove_file $MYSQLD_DATADIR/test/employee.dat --remove_file $MYSQLD_DATADIR/test/employee.dat
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MTR_SUITE_DIR/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt --copy_file $MTR_SUITE_DIR/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt
--echo # --echo #
--echo # Show MRR setting. The way it is done is because the t3 table cannot be directly based on --echo # Show MRR setting. The way it is done is because the t3 table cannot be directly based on
--echo # the information_schema.session_variables table. Not being a CONNECT table, it would be --echo # the information_schema.session_variables table. Not being a CONNECT table, it would be
--echo # read using an intermediate MYSQL table using the MySQL API and could not reflect the --echo # read using an intermediate MYSQL table using the MySQL API and could not reflect the
--echo # current session variable change (the call would create another session) This would be --echo # current session variable change (the call would create another session) This would be
--echo # correct only for querying GLOBAL variables but is not what we want to do here. --echo # correct only for querying GLOBAL variables but is not what we want to do here.
--echo # --echo #
CREATE TABLE t2 ( CREATE TABLE t2 (
name VARCHAR(64) NOT NULL, name VARCHAR(64) NOT NULL,
value VARCHAR(1024) NOT NULL value VARCHAR(1024) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DOS; ) ENGINE=CONNECT TABLE_TYPE=DOS;
INSERT INTO t2 SELECT * FROM information_schema.session_variables WHERE variable_name = 'OPTIMIZER_SWITCH'; INSERT INTO t2 SELECT * FROM information_schema.session_variables WHERE variable_name = 'OPTIMIZER_SWITCH';
# Check that MRR is OFF by default # Check that MRR is OFF by default
create table t3 ( create table t3 (
name CHAR(32) NOT NULL, name CHAR(32) NOT NULL,
value CHAR(64) NOT NULL value CHAR(64) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=t2 OPTION_LIST='Colname=value'; ) ENGINE=CONNECT TABLE_TYPE=XCOL TABNAME=t2 OPTION_LIST='Colname=value';
SELECT value FROM t3 WHERE value LIKE 'mrr%'; SELECT value FROM t3 WHERE value LIKE 'mrr%';
--echo # --echo #
--echo # Testing indexing with MRR OFF --echo # Testing indexing with MRR OFF
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
matricule INT(4) KEY NOT NULL field_format='Z', matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL, nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL, prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F', sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL, aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL, mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM', ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM', ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL, brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL, net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL, service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL, sitmat CHAR(1) NOT NULL,
formation CHAR(5) NOT NULL, formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom) INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
SELECT * FROM t1 LIMIT 10; SELECT * FROM t1 LIMIT 10;
--echo # Without MRR, the rows are retrieved sorted by name --echo # Without MRR, the rows are retrieved sorted by name
SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI'); SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI');
--echo # --echo #
--echo # Testing indexing with MRR ON --echo # Testing indexing with MRR ON
--echo # --echo #
SET @@LOCAL.OPTIMIZER_SWITCH='mrr=on'; SET @@LOCAL.OPTIMIZER_SWITCH='mrr=on';
--echo # Refresh the t2 table to reflect the change --echo # Refresh the t2 table to reflect the change
UPDATE t2, information_schema.session_variables SET value = variable_value WHERE variable_name = 'OPTIMIZER_SWITCH'; UPDATE t2, information_schema.session_variables SET value = variable_value WHERE variable_name = 'OPTIMIZER_SWITCH';
--echo # Check that MRR is ON for the session --echo # Check that MRR is ON for the session
SELECT value FROM t3 WHERE value LIKE 'mrr%'; SELECT value FROM t3 WHERE value LIKE 'mrr%';
--echo # With MRR, the rows are retrieved sorted by their position in the table --echo # With MRR, the rows are retrieved sorted by their position in the table
SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI'); SELECT matricule, nom, prenom, sitmat, net FROM t1 WHERE nom IN ('ETANG','FOCH','CERF','ITALIE','ROI');
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t3; DROP TABLE t3;
# #
# Clean up # Clean up
# #
SET @@LOCAL.OPTIMIZER_SWITCH='mrr=off'; SET @@LOCAL.OPTIMIZER_SWITCH='mrr=off';
--remove_file $MYSQLD_DATADIR/test/emp.txt --remove_file $MYSQLD_DATADIR/test/emp.txt
--echo # --echo #
--echo # Testing multiple 1 --echo # Testing multiple 1
--echo # --echo #
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`a` char(10) DEFAULT NULL, `a` char(10) DEFAULT NULL,
`b` char(10) DEFAULT NULL `b` char(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';'; ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';';
INSERT INTO t1 VALUES('test1','bla'); INSERT INTO t1 VALUES('test1','bla');
SELECT * FROM t1; SELECT * FROM t1;
CREATE TABLE `t2` ( CREATE TABLE `t2` (
`a` char(10) DEFAULT NULL, `a` char(10) DEFAULT NULL,
`b` char(10) DEFAULT NULL `b` char(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';'; ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `sep_char`=';';
INSERT INTO t2 VALUES('test2','blub'); INSERT INTO t2 VALUES('test2','blub');
SELECT * FROM t2; SELECT * FROM t2;
CREATE TABLE `t_all` ( CREATE TABLE `t_all` (
`a` char(10) DEFAULT NULL, `a` char(10) DEFAULT NULL,
`b` char(10) DEFAULT NULL `b` char(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='t*.csv' `sep_char`=';' `multiple`=1; ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='t*.csv' `sep_char`=';' `multiple`=1;
SELECT * FROM t_all order by `a`; SELECT * FROM t_all order by `a`;
--echo # --echo #
--echo # Testing multiple 2 --echo # Testing multiple 2
--echo # --echo #
CREATE table fnlist ( CREATE table fnlist (
fn char(8) not null fn char(8) not null
) ENGINE=CONNECT DEFAULT CHARSET=latin1 table_type=DOS; ) ENGINE=CONNECT DEFAULT CHARSET=latin1 table_type=DOS;
INSERT INTO fnlist VALUES('t1.csv'),('t2.csv'); INSERT INTO fnlist VALUES('t1.csv'),('t2.csv');
SELECT fn FROM fnlist; SELECT fn FROM fnlist;
CREATE TABLE `tblist` ( CREATE TABLE `tblist` (
`a` char(10) DEFAULT NULL, `a` char(10) DEFAULT NULL,
`b` char(10) DEFAULT NULL `b` char(10) DEFAULT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='fnlist.dos' `sep_char`=';' `multiple`=2; ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=CSV `file_name`='fnlist.dos' `sep_char`=';' `multiple`=2;
SELECT * FROM tblist; SELECT * FROM tblist;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t_all; DROP TABLE t_all;
DROP TABLE fnlist; DROP TABLE fnlist;
DROP TABLE tblist; DROP TABLE tblist;
--source include/not_embedded.inc --source include/not_embedded.inc
let $PORT= `select @@port`; let $PORT= `select @@port`;
--disable_query_log --disable_query_log
--replace_result $PORT PORT --replace_result $PORT PORT
--error 0,ER_UNKNOWN_ERROR --error 0,ER_UNKNOWN_ERROR
eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/tx1'; CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/tx1';
if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
AND ENGINE='CONNECT' AND ENGINE='CONNECT'
AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`) AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
{ {
Skip Need MySQL support; Skip Need MySQL support;
} }
DROP TABLE t1; DROP TABLE t1;
--enable_query_log --enable_query_log
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connection master; connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave; connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
connection master; connection master;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave; connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
--enable_warnings --enable_warnings
-- source myconn.inc -- source myconn.inc
connection slave; connection slave;
CREATE TABLE t1 ( CREATE TABLE t1 (
`id` int(20) primary key, `id` int(20) primary key,
`group` int NOT NULL default 1, `group` int NOT NULL default 1,
`a\\b` int NOT NULL default 2, `a\\b` int NOT NULL default 2,
`a\\` int unsigned, `a\\` int unsigned,
`name` varchar(32) default 'name') `name` varchar(32) default 'name')
DEFAULT CHARSET=latin1; DEFAULT CHARSET=latin1;
connection master; connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'; CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 (id, name) VALUES (1, 'foo'); INSERT INTO t1 (id, name) VALUES (1, 'foo');
INSERT INTO t1 (id, name) VALUES (2, 'fee'); INSERT INTO t1 (id, name) VALUES (2, 'fee');
--sorted_result --sorted_result
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
connection slave; connection slave;
--sorted_result --sorted_result
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
-- source myconn_cleanup.inc -- source myconn_cleanup.inc
-- source myconn.inc -- source myconn.inc
--echo # --echo #
--echo # Checking Sending Commands --echo # Checking Sending Commands
--echo # --echo #
connection master; connection master;
--replace_result $SLAVE_MYPORT SLAVE_PORT --replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
command VARCHAR(128) NOT NULL, command VARCHAR(128) NOT NULL,
warnings INT(4) NOT NULL FLAG=3, warnings INT(4) NOT NULL FLAG=3,
number INT(5) NOT NULL FLAG=1, number INT(5) NOT NULL FLAG=1,
message VARCHAR(255) FLAG=2) message VARCHAR(255) FLAG=2)
ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test' OPTION_LIST='Execsrc=1,maxerr=2'; ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test' OPTION_LIST='Execsrc=1,maxerr=2';
SELECT * FROM t1 WHERE command IN ('Warning','Note', SELECT * FROM t1 WHERE command IN ('Warning','Note',
'drop table if exists t1', 'drop table if exists t1',
'create table t1 (id int key auto_increment, msg varchar(32) not null)', 'create table t1 (id int key auto_increment, msg varchar(32) not null)',
"insert into t1(msg) values('One'),(NULL),('Three')", "insert into t1(msg) values('One'),(NULL),('Three')",
"insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'", "insert into t1 values(2,'Deux') on duplicate key update msg = 'Two'",
"insert into t1(message) values('Four'),('Five'),('Six')", "insert into t1(message) values('Four'),('Five'),('Six')",
'insert into t1(id) values(NULL)', 'insert into t1(id) values(NULL)',
"update t1 set msg = 'Four' where id = 4", "update t1 set msg = 'Four' where id = 4",
'select * from t1'); 'select * from t1');
--echo # --echo #
--echo # Checking Using Procedure --echo # Checking Using Procedure
--echo # --echo #
DROP PROCEDURE IF EXISTS p1; DROP PROCEDURE IF EXISTS p1;
CREATE PROCEDURE p1(cmd varchar(512)) CREATE PROCEDURE p1(cmd varchar(512))
READS SQL DATA READS SQL DATA
SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd); SELECT * FROM t1 WHERE command IN ('Warning','Note',cmd);
CALL p1('insert into t1(id) values(NULL)'); CALL p1('insert into t1(id) values(NULL)');
CALL p1('update t1 set msg = "Five" where id = 5'); CALL p1('update t1 set msg = "Five" where id = 5');
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP TABLE t1; DROP TABLE t1;
connection slave; connection slave;
--sorted_result --sorted_result
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
-- source myconn_cleanup.inc -- source myconn_cleanup.inc
-- source include/not_embedded.inc -- source include/not_embedded.inc
let $PORT= `select @@port`; let $PORT= `select @@port`;
--disable_query_log --disable_query_log
--replace_result $PORT PORT --replace_result $PORT PORT
--error 0,ER_UNKNOWN_ERROR --error 0,ER_UNKNOWN_ERROR
--eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='tx1' OPTION_LIST='host=localhost,user=root,port=$PORT' --eval CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='tx1' OPTION_LIST='host=localhost,user=root,port=$PORT'
if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1' WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
AND ENGINE='CONNECT' AND ENGINE='CONNECT'
AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`) AND CREATE_OPTIONS LIKE '%`table_type`=MySQL%'`)
{ {
Skip Need MySQL support; Skip Need MySQL support;
} }
DROP TABLE t1; DROP TABLE t1;
--enable_query_log --enable_query_log
--echo # --echo #
--echo # Testing FILE privilege --echo # Testing FILE privilege
--echo # --echo #
GRANT ALL PRIVILEGES ON *.* TO user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost;
REVOKE FILE ON *.* FROM user@localhost; REVOKE FILE ON *.* FROM user@localhost;
--connect(user,localhost,user,,) --connect(user,localhost,user,,)
--connection user --connection user
SELECT user(); SELECT user();
--replace_result $PORT PORT --replace_result $PORT PORT
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
--eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=$PORT' --eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=$PORT'
--connection default --connection default
SELECT user(); SELECT user();
CREATE TABLE t1remote (a INT NOT NULL); CREATE TABLE t1remote (a INT NOT NULL);
INSERT INTO t1remote VALUES (10),(20),(30); INSERT INTO t1remote VALUES (10),(20),(30);
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL TABNAME=t1remote OPTION_LIST='host=localhost,user=root,port=$PORT' --eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL TABNAME=t1remote OPTION_LIST='host=localhost,user=root,port=$PORT'
SELECT * FROM t1; SELECT * FROM t1;
--connection user --connection user
SELECT user(); SELECT user();
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
SELECT * FROM t1; SELECT * FROM t1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
INSERT INTO t1 VALUES ('xxx'); INSERT INTO t1 VALUES ('xxx');
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
DELETE FROM t1 WHERE a='xxx'; DELETE FROM t1 WHERE a='xxx';
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
UPDATE t1 SET a='yyy' WHERE a='xxx'; UPDATE t1 SET a='yyy' WHERE a='xxx';
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
--echo # Testing a VIEW created with FILE privileges but accessed with no FILE --echo # Testing a VIEW created with FILE privileges but accessed with no FILE
--connection default --connection default
SELECT user(); SELECT user();
CREATE VIEW v1 AS SELECT * FROM t1; CREATE VIEW v1 AS SELECT * FROM t1;
--connection user --connection user
SELECT user(); SELECT user();
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
SELECT * FROM v1; SELECT * FROM v1;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
INSERT INTO v1 VALUES (2); INSERT INTO v1 VALUES (2);
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
UPDATE v1 SET a=123; UPDATE v1 SET a=123;
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
DELETE FROM v1; DELETE FROM v1;
--disconnect user --disconnect user
--connection default --connection default
SELECT user(); SELECT user();
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t1remote; DROP TABLE t1, t1remote;
DROP USER user@localhost; DROP USER user@localhost;
--echo # --echo #
--echo # Testing FILE privileges done --echo # Testing FILE privileges done
--echo # --echo #
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--echo # --echo #
--echo # Testing FIX null columns --echo # Testing FIX null columns
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT NOT NULL, id INT NOT NULL,
nb INT, nb INT,
msg VARCHAR(12) msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=FIX; ) ENGINE=CONNECT TABLE_TYPE=FIX;
--error ER_BAD_NULL_ERROR --error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello'); INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero'); INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1; SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL; SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL; SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL; SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # Testing CSV null columns --echo # Testing CSV null columns
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT NOT NULL, id INT NOT NULL,
nb INT, nb INT,
msg VARCHAR(12) msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1; ) ENGINE=CONNECT TABLE_TYPE=CSV HEADER=1;
--error ER_BAD_NULL_ERROR --error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello'); INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero'); INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1; SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL; SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL; SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL; SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # Testing BIN null columns --echo # Testing BIN null columns
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT NOT NULL, id INT NOT NULL,
nb INT, nb INT,
msg VARCHAR(12) msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=BIN; ) ENGINE=CONNECT TABLE_TYPE=BIN;
--error ER_BAD_NULL_ERROR --error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello'); INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero'); INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1; SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL; SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL; SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL; SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # Testing DBF null columns --echo # Testing DBF null columns
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT NOT NULL, id INT NOT NULL,
nb INT, nb INT,
msg VARCHAR(12) msg VARCHAR(12)
) ENGINE=CONNECT TABLE_TYPE=DBF; ) ENGINE=CONNECT TABLE_TYPE=DBF;
--error ER_BAD_NULL_ERROR --error ER_BAD_NULL_ERROR
INSERT INTO t1 values(NULL,1,'Hello'); INSERT INTO t1 values(NULL,1,'Hello');
INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero'); INSERT INTO t1 values(10,4,NULL),(20,2,'Hello'),(0,0,'Zero');
SELECT * FROM t1; SELECT * FROM t1;
SELECT* FROM t1 WHERE id IS NULL; SELECT* FROM t1 WHERE id IS NULL;
SELECT * FROM t1 WHERE nb IS NULL; SELECT * FROM t1 WHERE nb IS NULL;
SELECT * FROM t1 WHERE msg IS NOT NULL; SELECT * FROM t1 WHERE msg IS NOT NULL;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # Testing INI null columns --echo # Testing INI null columns
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
`sec` char(8) NOT NULL flag=1, `sec` char(8) NOT NULL flag=1,
`key` char(12) `key` char(12)
) ENGINE=CONNECT TABLE_TYPE=INI; ) ENGINE=CONNECT TABLE_TYPE=INI;
INSERT INTO t1(sec) values('S1'); INSERT INTO t1(sec) values('S1');
SELECT * FROM t1; SELECT * FROM t1;
INSERT INTO t1 values('S1','Newval'); INSERT INTO t1 values('S1','Newval');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
-- source include/not_embedded.inc -- source include/not_embedded.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
let $PORT= `select @@port`; let $PORT= `select @@port`;
--copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat --copy_file $MTR_SUITE_DIR/std_data/employee.dat $MYSQLD_DATADIR/test/employee.dat
CREATE TABLE employee ( CREATE TABLE employee (
serialno CHAR(5) NOT NULL, serialno CHAR(5) NOT NULL,
name VARCHAR(12) NOT NULL FLAG=6, name VARCHAR(12) NOT NULL FLAG=6,
sex TINYINT(1) NOT NULL, sex TINYINT(1) NOT NULL,
title VARCHAR(15) NOT NULL FLAG=20, title VARCHAR(15) NOT NULL FLAG=20,
manager CHAR(5) DEFAULT NULL, manager CHAR(5) DEFAULT NULL,
department CHAR(4) NOT NULL FLAG=41, department CHAR(4) NOT NULL FLAG=41,
secretary CHAR(5) DEFAULT NULL FLAG=46, secretary CHAR(5) DEFAULT NULL FLAG=46,
salary DOUBLE(8,2) NOT NULL FLAG=52 salary DOUBLE(8,2) NOT NULL FLAG=52
) ENGINE=connect TABLE_TYPE=fix FILE_NAME='employee.dat' ENDING=1; ) ENGINE=connect TABLE_TYPE=fix FILE_NAME='employee.dat' ENDING=1;
SELECT * FROM employee; SELECT * FROM employee;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE occurs (name CHAR(12), sex CHAR(1), title CHAR(15), department CHAR(4), salary DOUBLE(8,2), id_of CHAR(12), id CHAR(5) NOT NULL) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=employee OPTION_LIST='OccurCol=ID,RankCol=ID_OF,Colist=serialno;manager;secretary,port=$PORT'; --eval CREATE TABLE occurs (name CHAR(12), sex CHAR(1), title CHAR(15), department CHAR(4), salary DOUBLE(8,2), id_of CHAR(12), id CHAR(5) NOT NULL) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=employee OPTION_LIST='OccurCol=ID,RankCol=ID_OF,Colist=serialno;manager;secretary,port=$PORT';
SELECT * FROM occurs; SELECT * FROM occurs;
DROP TABLE occurs; DROP TABLE occurs;
DROP TABLE employee; DROP TABLE employee;
CREATE TABLE pets ( CREATE TABLE pets (
name VARCHAR(12) NOT NULL, name VARCHAR(12) NOT NULL,
dog INT NOT NULL DEFAULT 0, dog INT NOT NULL DEFAULT 0,
cat INT NOT NULL DEFAULT 0, cat INT NOT NULL DEFAULT 0,
rabbit INT NOT NULL DEFAULT 0, rabbit INT NOT NULL DEFAULT 0,
bird INT NOT NULL DEFAULT 0, bird INT NOT NULL DEFAULT 0,
fish INT NOT NULL DEFAULT 0) ENGINE=MYISAM; fish INT NOT NULL DEFAULT 0) ENGINE=MYISAM;
INSERT INTO pets(name,dog) VALUES('John',2); INSERT INTO pets(name,dog) VALUES('John',2);
INSERT INTO pets(name,cat) VALUES('Bill',1); INSERT INTO pets(name,cat) VALUES('Bill',1);
INSERT INTO pets(name,dog,cat) VALUES('Mary',1,1); INSERT INTO pets(name,dog,cat) VALUES('Mary',1,1);
INSERT INTO pets(name,rabbit) VALUES('Lisbeth',2); INSERT INTO pets(name,rabbit) VALUES('Lisbeth',2);
INSERT INTO pets(name,cat,bird) VALUES('Kevin',2,6); INSERT INTO pets(name,cat,bird) VALUES('Kevin',2,6);
INSERT INTO pets(name,dog,fish) VALUES('Donald',1,3); INSERT INTO pets(name,dog,fish) VALUES('Donald',1,3);
SELECT * FROM pets; SELECT * FROM pets;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE xpet (name VARCHAR(12) NOT NULL, race CHAR(6) NOT NULL, number INT) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=pets OPTION_LIST='OccurCol=number,RankCol=race,Colist=dog;cat;rabbit;bird;fish,port=$PORT' --eval CREATE TABLE xpet (name VARCHAR(12) NOT NULL, race CHAR(6) NOT NULL, number INT) ENGINE=CONNECT TABLE_TYPE=OCCUR TABNAME=pets OPTION_LIST='OccurCol=number,RankCol=race,Colist=dog;cat;rabbit;bird;fish,port=$PORT'
SELECT * FROM xpet; SELECT * FROM xpet;
SELECT name FROM xpet; SELECT name FROM xpet;
SELECT name FROM xpet WHERE race = 'cat' AND number = 0; SELECT name FROM xpet WHERE race = 'cat' AND number = 0;
SELECT name, SUM(number) pets FROM xpet GROUP BY name; SELECT name, SUM(number) pets FROM xpet GROUP BY name;
ALTER TABLE xpet MODIFY number INT NOT NULL; ALTER TABLE xpet MODIFY number INT NOT NULL;
SELECT * FROM xpet; SELECT * FROM xpet;
SELECT * FROM xpet WHERE number > 1; SELECT * FROM xpet WHERE number > 1;
SELECT DISTINCT name FROM xpet WHERE number > 1; SELECT DISTINCT name FROM xpet WHERE number > 1;
SELECT name FROM xpet; SELECT name FROM xpet;
SELECT name, race FROM xpet; SELECT name, race FROM xpet;
SELECT name, count(*) FROM xpet GROUP BY name, LEAST(number,1); SELECT name, count(*) FROM xpet GROUP BY name, LEAST(number,1);
SELECT name, number, count(*) FROM xpet GROUP BY name, number; SELECT name, number, count(*) FROM xpet GROUP BY name, number;
DROP TABLE xpet; DROP TABLE xpet;
DROP TABLE pets; DROP TABLE pets;
--remove_file $MYSQLD_DATADIR/test/employee.dat --remove_file $MYSQLD_DATADIR/test/employee.dat
-- source include/not_embedded.inc -- source include/not_embedded.inc
--echo # --echo #
--echo # Testing multiple indexed UPDATE and DELETE --echo # Testing multiple indexed UPDATE and DELETE
--echo # --echo #
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT(4) NOT NULL, id INT(4) NOT NULL,
msg VARCHAR(16) NOT NULL, msg VARCHAR(16) NOT NULL,
INDEX IDM(id,msg)) INDEX IDM(id,msg))
ENGINE=CONNECT TABLE_TYPE=DOS; ENGINE=CONNECT TABLE_TYPE=DOS;
INSERT INTO t1 VALUES(1,'one'),(4, 'four'),(7,'seven'),(8,'eight'),(10,'ten'),(11,'eleven'),(40,'forty'),(35,'thirty five'),(60,'sixty'),(72,'seventy two'),(81,'eighty one'); INSERT INTO t1 VALUES(1,'one'),(4, 'four'),(7,'seven'),(8,'eight'),(10,'ten'),(11,'eleven'),(40,'forty'),(35,'thirty five'),(60,'sixty'),(72,'seventy two'),(81,'eighty one');
INSERT INTO t1 VALUES(1,'un'),(4, 'quatre'),(7,'sept'),(8,'huit'),(10,'dix'),(11,'onze'),(40,'quarante'),(35,'trente cinq'),(60,'soixante'),(72,'soixante douze'),(81,'quatrevingt un'); INSERT INTO t1 VALUES(1,'un'),(4, 'quatre'),(7,'sept'),(8,'huit'),(10,'dix'),(11,'onze'),(40,'quarante'),(35,'trente cinq'),(60,'soixante'),(72,'soixante douze'),(81,'quatrevingt un');
SELECT * FROM t1 IGNORE INDEX (IDM); SELECT * FROM t1 IGNORE INDEX (IDM);
UPDATE t1 SET msg = 'dieci' WHERE id = 10; UPDATE t1 SET msg = 'dieci' WHERE id = 10;
SELECT * FROM t1 IGNORE INDEX (IDM); SELECT * FROM t1 IGNORE INDEX (IDM);
UPDATE t1 SET msg = 'septante deux' WHERE id = 72; UPDATE t1 SET msg = 'septante deux' WHERE id = 72;
SELECT * FROM t1 IGNORE INDEX (IDM); SELECT * FROM t1 IGNORE INDEX (IDM);
UPDATE t1 SET id=2, msg='deux' WHERE id=4 AND msg='quatre'; UPDATE t1 SET id=2, msg='deux' WHERE id=4 AND msg='quatre';
SELECT * FROM t1 IGNORE INDEX (IDM); SELECT * FROM t1 IGNORE INDEX (IDM);
DELETE FROM t1 WHERE id IN (8,40); DELETE FROM t1 WHERE id IN (8,40);
SELECT * FROM t1 IGNORE INDEX (IDM); SELECT * FROM t1 IGNORE INDEX (IDM);
DROP TABLE t1; DROP TABLE t1;
This diff is collapsed.
This diff is collapsed.
--source ../../include/deinit_spider.inc --source ../../include/deinit_spider.inc
--source ../../include/deinit_spider.inc --source ../../include/deinit_spider.inc
--source ../../include/deinit_spider.inc --source ../../include/deinit_spider.inc
--source ../../include/deinit_spider.inc --source ../../include/deinit_spider.inc
This diff is collapsed.
This diff is collapsed.
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