Commit f81c60a4 authored by Olivier Bertrand's avatar Olivier Bertrand

- Update tests that failed because of NULL columns

modified:
  mysql-test/suite/connect/r/bin.result
  mysql-test/suite/connect/r/csv.result
  mysql-test/suite/connect/r/dbf.result
  mysql-test/suite/connect/r/dir.result
  mysql-test/suite/connect/r/fix.result
  mysql-test/suite/connect/r/fmt.result
  mysql-test/suite/connect/r/general.result
  mysql-test/suite/connect/r/index.result
  mysql-test/suite/connect/r/vec.result
  mysql-test/suite/connect/t/bin.test
  mysql-test/suite/connect/t/csv.test
  mysql-test/suite/connect/t/dbf.test
  mysql-test/suite/connect/t/dir.test
  mysql-test/suite/connect/t/fix.test
  mysql-test/suite/connect/t/fmt.test
  mysql-test/suite/connect/t/general.test
  mysql-test/suite/connect/t/index.test
  mysql-test/suite/connect/t/vec.test
parent 5008a3e8
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt'; ) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
SELECT * FROM t1; SELECT * FROM t1;
ID ID
......
...@@ -4,7 +4,7 @@ SET NAMES utf8; ...@@ -4,7 +4,7 @@ SET NAMES utf8;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=CSV FILE_NAME='nonexistent.txt'; ) Engine=CONNECT TABLE_TYPE=CSV FILE_NAME='nonexistent.txt';
SELECT * FROM t1; SELECT * FROM t1;
ID ID
...@@ -14,11 +14,11 @@ DROP TABLE t1; ...@@ -14,11 +14,11 @@ DROP TABLE t1;
# #
# Testing examples from the manual # Testing examples from the manual
# #
CREATE TABLE t1 CREATE TABLE t1
( (
name CHAR(12), name CHAR(12) NOT NULL,
birth DATE DATE_FORMAT='DD/MM/YY', birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
children SMALLINT(2) children SMALLINT(2) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1; HEADER=1 SEP_CHAR=';' QUOTED=1;
SELECT * FROM t1; SELECT * FROM t1;
...@@ -42,11 +42,11 @@ Name;birth;children ...@@ -42,11 +42,11 @@ Name;birth;children
# #
# Testing READONLY tables # Testing READONLY tables
# #
CREATE TABLE t1 CREATE TABLE t1
( (
name CHAR(12), name CHAR(12) NOT NULL,
birth DATE DATE_FORMAT='DD/MM/YY', birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
children SMALLINT(2) children SMALLINT(2) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes; HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes;
INSERT INTO t1 VALUES ('BILL','1973-06-30',5); INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
...@@ -68,9 +68,9 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -68,9 +68,9 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`name` char(12) DEFAULT NULL, `name` char(12) NOT NULL,
`birth` date DEFAULT NULL `DATE_FORMAT`='DD/MM/YY', `birth` date NOT NULL `DATE_FORMAT`='DD/MM/YY',
`children` smallint(2) DEFAULT NULL `children` smallint(2) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=no ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=no
INSERT INTO t1 VALUES ('BILL','1973-06-30',5); INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -85,9 +85,9 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -85,9 +85,9 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`name` char(12) DEFAULT NULL, `name` char(12) NOT NULL,
`birth` date DEFAULT NULL `DATE_FORMAT`='DD/MM/YY', `birth` date NOT NULL `DATE_FORMAT`='DD/MM/YY',
`children` smallint(2) DEFAULT NULL `children` smallint(2) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=1 ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=CSV `FILE_NAME`='people.csv' `HEADER`=1 `SEP_CHAR`=';' `QUOTED`=1 `READONLY`=1
INSERT INTO t1 VALUES ('BILL','1973-06-30',5); INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
...@@ -128,7 +128,7 @@ REPLACE(LOAD_FILE('DATADIR/test/tmp.csv'),'\r\n','\n') ...@@ -128,7 +128,7 @@ REPLACE(LOAD_FILE('DATADIR/test/tmp.csv'),'\r\n','\n')
# #
# Creating a CSV table from a MyISAM table # Creating a CSV table from a MyISAM table
# #
CREATE TABLE t1 (a VARCHAR(10), b INT) ENGINE=MyISAM; CREATE TABLE t1 (a VARCHAR(10) NOT NULL, b INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('test1',1), ('test2',2); INSERT INTO t1 VALUES ('test1',1), ('test2',2);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t2.csv' CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t2.csv'
AS SELECT * FROM t1; AS SELECT * FROM t1;
...@@ -148,7 +148,7 @@ test2,2 ...@@ -148,7 +148,7 @@ test2,2
# #
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=utf8; CHARSET=utf8;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
...@@ -161,7 +161,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) ...@@ -161,7 +161,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
C3A10A C3A10A
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=utf8 DATA_CHARSET=latin1; CHARSET=utf8 DATA_CHARSET=latin1;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
...@@ -174,7 +174,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) ...@@ -174,7 +174,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
E10A E10A
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
SELECT * FROM t1; SELECT * FROM t1;
...@@ -186,7 +186,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) ...@@ -186,7 +186,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
E10A E10A
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=latin1; CHARSET=latin1;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
...@@ -199,7 +199,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) ...@@ -199,7 +199,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
E10A E10A
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=latin1 DATA_CHARSET=utf8; CHARSET=latin1 DATA_CHARSET=utf8;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
...@@ -212,8 +212,8 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n')) ...@@ -212,8 +212,8 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
C3A10A C3A10A
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) CHARACTER SET latin1, c1 CHAR(12) CHARACTER SET latin1 NOT NULL,
c2 CHAR(12) CHARACTER SET utf8 c2 CHAR(12) CHARACTER SET utf8 NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
INSERT INTO t1 VALUES ('á','á'); INSERT INTO t1 VALUES ('á','á');
SELECT * FROM t1; SELECT * FROM t1;
......
# #
# Testing errors # Testing errors
# #
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf'
SELECT * FROM t1; SELECT * FROM t1;
a a
...@@ -56,11 +56,11 @@ END// ...@@ -56,11 +56,11 @@ END//
# #
# Testing READONLY tables # Testing READONLY tables
# #
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf'
INSERT INTO t1 VALUES (10),(20); INSERT INTO t1 VALUES (10),(20);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -73,7 +73,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -73,7 +73,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=Yes ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=Yes
INSERT INTO t1 VALUES (30); INSERT INTO t1 VALUES (30);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
...@@ -89,7 +89,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -89,7 +89,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=NO ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf' `READONLY`=NO
INSERT INTO t1 VALUES (30); INSERT INTO t1 VALUES (30);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -103,9 +103,9 @@ DROP TABLE t1; ...@@ -103,9 +103,9 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a int(11) DEFAULT NULL, a int(11) NOT NULL,
b char(10) DEFAULT NULL, b char(10) NOT NULL,
c varchar(10) DEFAULT NULL c varchar(10) NOT NULL
) ENGINE=CONNECT table_type=DBF file_name='t1.dbf'; ) ENGINE=CONNECT table_type=DBF file_name='t1.dbf';
INSERT INTO t1 VALUES (1,'1','1'); INSERT INTO t1 VALUES (1,'1','1');
INSERT INTO t1 VALUES (2,'2','2'); INSERT INTO t1 VALUES (2,'2','2');
...@@ -117,22 +117,22 @@ DROP TABLE t1; ...@@ -117,22 +117,22 @@ DROP TABLE t1;
# #
# Testing that table options in lower case and mixed case are understood: # Testing that table options in lower case and mixed case are understood:
# #
CREATE TABLE t1 (a INT) ENGINE=CONNECT table_type=dbf file_name='t1.dbf'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT table_type=dbf file_name='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=dbf `file_name`='t1.dbf' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=dbf `file_name`='t1.dbf'
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
SELECT * FROM t1; SELECT * FROM t1;
a a
10 10
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a CHAR(10)) ENGINE=CONNECT Table_Type=dbf File_Name='t1.dbf'; CREATE TABLE t1 (a CHAR(10) NOT NULL) ENGINE=CONNECT Table_Type=dbf File_Name='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` char(10) DEFAULT NULL `a` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `Table_Type`=dbf `File_Name`='t1.dbf' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `Table_Type`=dbf `File_Name`='t1.dbf'
INSERT INTO t1 VALUES ('test'); INSERT INTO t1 VALUES ('test');
SELECT * FROM t1; SELECT * FROM t1;
...@@ -162,9 +162,9 @@ DROP TABLE t1; ...@@ -162,9 +162,9 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a INT DEFAULT NULL, a INT NOT NULL,
b CHAR(10) DEFAULT NULL, b CHAR(10) NOT NULL,
c VARCHAR(10) DEFAULT NULL c VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (1,'1','1'); INSERT INTO t1 VALUES (1,'1','1');
INSERT INTO t1 VALUES (2,'2','2'); INSERT INTO t1 VALUES (2,'2','2');
...@@ -212,7 +212,7 @@ DROP TABLE t1; ...@@ -212,7 +212,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a012345678901234567890123456789 INT DEFAULT NULL a012345678901234567890123456789 INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
ERROR HY000: DBF: Column name 'a012345678901234567890123456789' is too long (max=10) ERROR HY000: DBF: Column name 'a012345678901234567890123456789' is too long (max=10)
# #
...@@ -220,8 +220,8 @@ ERROR HY000: DBF: Column name 'a012345678901234567890123456789' is too long (max ...@@ -220,8 +220,8 @@ ERROR HY000: DBF: Column name 'a012345678901234567890123456789' is too long (max
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a0123456789a INT DEFAULT NULL, a0123456789a INT NOT NULL,
b0123456789b INT DEFAULT NULL b0123456789b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x11.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x11.dbf';
ERROR HY000: DBF: Column name 'a0123456789a' is too long (max=10) ERROR HY000: DBF: Column name 'a0123456789a' is too long (max=10)
# #
...@@ -229,8 +229,8 @@ ERROR HY000: DBF: Column name 'a0123456789a' is too long (max=10) ...@@ -229,8 +229,8 @@ ERROR HY000: DBF: Column name 'a0123456789a' is too long (max=10)
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a012345678a INT DEFAULT NULL, a012345678a INT NOT NULL,
b012345678b INT DEFAULT NULL b012345678b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x12.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x12.dbf';
ERROR HY000: DBF: Column name 'a012345678a' is too long (max=10) ERROR HY000: DBF: Column name 'a012345678a' is too long (max=10)
# #
...@@ -238,14 +238,14 @@ ERROR HY000: DBF: Column name 'a012345678a' is too long (max=10) ...@@ -238,14 +238,14 @@ ERROR HY000: DBF: Column name 'a012345678a' is too long (max=10)
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a01234567a INT DEFAULT NULL, a01234567a INT NOT NULL,
b01234567b INT DEFAULT NULL b01234567b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x13.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x13.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a01234567a` int(11) DEFAULT NULL, `a01234567a` int(11) NOT NULL,
`b01234567b` int(11) DEFAULT NULL `b01234567b` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t02x13.dbf' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t02x13.dbf'
INSERT INTO t1 VALUES (1,2); INSERT INTO t1 VALUES (1,2);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -257,7 +257,7 @@ DROP TABLE t1; ...@@ -257,7 +257,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a bigint DEFAULT NULL a bigint NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF); INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
INSERT INTO t1 VALUES (-0x8000000000000000); INSERT INTO t1 VALUES (-0x8000000000000000);
...@@ -289,7 +289,7 @@ DROP TABLE t1; ...@@ -289,7 +289,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a TINYINT DEFAULT NULL a TINYINT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (123);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -301,7 +301,7 @@ DROP TABLE t1; ...@@ -301,7 +301,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a SMALLINT DEFAULT NULL a SMALLINT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (0x7FFF); INSERT INTO t1 VALUES (0x7FFF);
INSERT INTO t1 VALUES (-0x8000); INSERT INTO t1 VALUES (-0x8000);
...@@ -333,7 +333,7 @@ DROP TABLE t1; ...@@ -333,7 +333,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(255) a VARCHAR(255) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (REPEAT('a',255)); INSERT INTO t1 VALUES (REPEAT('a',255));
SELECT LENGTH(a) FROM t1; SELECT LENGTH(a) FROM t1;
...@@ -364,7 +364,7 @@ DROP TABLE t1; ...@@ -364,7 +364,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a CHAR(86) CHARACTER SET utf8 a CHAR(86) CHARACTER SET utf8 NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
ERROR HY000: DBF: Column length too big for 'a' (max=255) ERROR HY000: DBF: Column length too big for 'a' (max=255)
# #
...@@ -373,17 +373,17 @@ ERROR HY000: DBF: Column length too big for 'a' (max=255) ...@@ -373,17 +373,17 @@ ERROR HY000: DBF: Column length too big for 'a' (max=255)
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(256) a VARCHAR(256) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
ERROR HY000: DBF: Column length too big for 'a' (max=255) ERROR HY000: DBF: Column length too big for 'a' (max=255)
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(86) CHARACTER SET utf8 a VARCHAR(86) CHARACTER SET utf8 NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
ERROR HY000: DBF: Column length too big for 'a' (max=255) ERROR HY000: DBF: Column length too big for 'a' (max=255)
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(64000) a VARCHAR(64000) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
ERROR HY000: DBF: Column length too big for 'a' (max=255) ERROR HY000: DBF: Column length too big for 'a' (max=255)
# #
...@@ -414,7 +414,7 @@ ERROR HY000: Unsupported type for column 'a' ...@@ -414,7 +414,7 @@ ERROR HY000: Unsupported type for column 'a'
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a DATE a DATE NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('2001-01-01'); INSERT INTO t1 VALUES ('2001-01-01');
SELECT * FROM t1; SELECT * FROM t1;
...@@ -444,7 +444,7 @@ DROP TABLE t1; ...@@ -444,7 +444,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a FLOAT(12,4) a FLOAT(12,4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (123);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -474,7 +474,7 @@ DROP TABLE t1; ...@@ -474,7 +474,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a DOUBLE(20,5) a DOUBLE(20,5) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (123);
INSERT INTO t1 VALUES (123456789.12345); INSERT INTO t1 VALUES (123456789.12345);
...@@ -506,7 +506,7 @@ DROP TABLE IF EXISTS t1; ...@@ -506,7 +506,7 @@ DROP TABLE IF EXISTS t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(10) a VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('10'); INSERT INTO t1 VALUES ('10');
SELECT * FROM t1; SELECT * FROM t1;
...@@ -532,7 +532,7 @@ Flags 00 ...@@ -532,7 +532,7 @@ Flags 00
-------- -------- -------- --------
ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL; ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL;
Warnings: Warnings:
Warning 1265 Data truncated for column 'a' at row 1 Warning 1105 The current version of CONNECT did not check what you changed in ALTER. Use on your own risk
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -594,22 +594,24 @@ DROP TABLE IF EXISTS t1; ...@@ -594,22 +594,24 @@ DROP TABLE IF EXISTS t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
c1 VARCHAR(10), c1 VARCHAR(10) NOT NULL,
c2 VARCHAR(10) DEFAULT 'def', c2 VARCHAR(10) NOT NULL DEFAULT 'def',
i1 INT, i1 INT NOT NULL,
i2 INT DEFAULT 123 i2 INT NOT NULL DEFAULT 123
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('10','10',10,10); INSERT INTO t1 VALUES ('10','10',10,10);
INSERT INTO t1 VALUES (NULL,NULL,NULL,NULL); INSERT INTO t1(c1,i1) VALUES ('20',20);
INSERT INTO t1 VALUES ('30',DEFAULT,30,DEFAULT);
SELECT * FROM t1; SELECT * FROM t1;
c1 c2 i1 i2 c1 c2 i1 i2
10 10 10 10 10 10 10 10
0 0 20 20 0
30 def 30 123
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf'); CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
-------- -------- -------- --------
FileSize 248 FileSize 291
DBF_Version 03 DBF_Version 03
NRecords 2 NRecords 3
FirstRecPos 162 FirstRecPos 162
RecLength 43 RecLength 43
TableFlags 0000 TableFlags 0000
......
CREATE TABLE t1 ( CREATE TABLE t1 (
path VARCHAR(256) flag=1, path VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256), fname VARCHAR(256) NOT NULL,
ftype CHAR(4), ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) flag=5 size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt' ) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'
OPTION_LIST='subdir=1'; OPTION_LIST='subdir=1';
SELECT * FROM t1; SELECT * FROM t1;
...@@ -18,10 +18,10 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -18,10 +18,10 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`path` varchar(256) DEFAULT NULL `flag`=1, `path` varchar(256) NOT NULL `flag`=1,
`fname` varchar(256) DEFAULT NULL, `fname` varchar(256) NOT NULL,
`ftype` char(4) DEFAULT NULL, `ftype` char(4) NOT NULL,
`size` double(12,0) DEFAULT NULL `flag`=5 `size` double(12,0) NOT NULL `flag`=5
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DIR `FILE_NAME`='*.txt' `OPTION_LIST`='subdir=0' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DIR `FILE_NAME`='*.txt' `OPTION_LIST`='subdir=0'
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size; SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
fname ftype size fname ftype size
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=DOS FILE_NAME='nonexistent.txt'; ) Engine=CONNECT TABLE_TYPE=DOS FILE_NAME='nonexistent.txt';
SELECT * FROM t1; SELECT * FROM t1;
ID ID
...@@ -15,7 +15,7 @@ DROP TABLE t1; ...@@ -15,7 +15,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT id INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt'; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -27,7 +27,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -27,7 +27,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL `id` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=1 ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=1
INSERT INTO t1 VALUES (20); INSERT INTO t1 VALUES (20);
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
...@@ -43,7 +43,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -43,7 +43,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL `id` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=0 ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=FIX `FILE_NAME`='t1.txt' `READONLY`=0
INSERT INTO t1 VALUES (20); INSERT INTO t1 VALUES (20);
SELECT * FROM t1; SELECT * FROM t1;
...@@ -57,10 +57,10 @@ DROP TABLE t1; ...@@ -57,10 +57,10 @@ DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
number CHAR(4) not null, number CHAR(4) not null,
location CHAR(15) flag=5, location CHAR(15) NOT NULL flag=5,
director CHAR(5) flag=20, director CHAR(5) NOT NULL flag=20,
function CHAR(12) flag=26, function CHAR(12) NOT NULL flag=26,
name CHAR(22) flag=38 name CHAR(22) NOT NULL flag=38
) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='dept.dat'; ) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='dept.dat';
SELECT * FROM t1; SELECT * FROM t1;
number location director function name number location director function name
...@@ -71,10 +71,10 @@ number location director function name ...@@ -71,10 +71,10 @@ number location director function name
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' ENDING=1; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' ENDING=1;
SELECT * FROM t1; SELECT * FROM t1;
name city birth hired name city birth hired
...@@ -87,10 +87,10 @@ Bill Boston 1 1986-09-01 2008-02-10 ...@@ -87,10 +87,10 @@ Bill Boston 1 1986-09-01 2008-02-10
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1;
SELECT * FROM t1; SELECT * FROM t1;
name city birth hired name city birth hired
...@@ -103,10 +103,10 @@ Bill Boston 1 1986-09-01 2008-02-10 ...@@ -103,10 +103,10 @@ Bill Boston 1 1986-09-01 2008-02-10
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2;
SELECT * FROM t1; SELECT * FROM t1;
name city birth hired name city birth hired
...@@ -119,10 +119,10 @@ Bill Boston 1 1986-09-01 2008-02-10 ...@@ -119,10 +119,10 @@ Bill Boston 1 1986-09-01 2008-02-10
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2;
SELECT * FROM t1; SELECT * FROM t1;
name city birth hired name city birth hired
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT 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';
SELECT * FROM t1; SELECT * FROM t1;
ID ID
...@@ -15,7 +15,7 @@ DROP TABLE t1; ...@@ -15,7 +15,7 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT 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';
INSERT INTO t1 VALUES (10),(20); INSERT INTO t1 VALUES (10),(20);
ERROR HY000: Got error 122 'Writing FMT files is not implemented yet' from CONNECT ERROR HY000: Got error 122 'Writing FMT files is not implemented yet' from CONNECT
...@@ -25,10 +25,10 @@ DROP TABLE t1; ...@@ -25,10 +25,10 @@ DROP TABLE t1;
# #
CREATE TABLE t1 CREATE TABLE t1
( (
ID Integer(5) field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'", NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n', DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) 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;
ID NAME DEPNO SALARY ID NAME DEPNO SALARY
...@@ -38,20 +38,20 @@ ID NAME DEPNO SALARY ...@@ -38,20 +38,20 @@ ID NAME DEPNO SALARY
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
ID Integer(5) field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'", NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n', DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) 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 HY000: Got error 122 'Bad format line 2 field 3 of t1' from CONNECT ERROR HY000: Got error 122 'Bad format line 2 field 3 of t1' from CONNECT
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
ID Integer(5) field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) field_format=' , ''%n%[^'']%m', NAME Char(16) not null field_format=' , ''%n%[^'']%m',
DEPNO Integer(4) field_format=''' , #%n%d%m', DEPNO Integer(4) not null field_format=''' , #%n%d%m',
SALARY Double(12,2) 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;
ID NAME DEPNO SALARY ID NAME DEPNO SALARY
......
# #
# Testing features not specific to any TABLE_TYPE # Testing features not specific to any TABLE_TYPE
# #
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
Warnings: Warnings:
Warning 1105 No table_type. Was set to DOS Warning 1105 No table_type. Was set to DOS
Warning 1105 No file name. Table will use t1.DOS Warning 1105 No file name. Table will use t1.DOS
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL `a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=DOS ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=DOS
DROP TABLE t1; DROP TABLE t1;
...@@ -15,7 +15,7 @@ brut INT(5) NOT NULL, ...@@ -15,7 +15,7 @@ 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), 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;
......
CREATE TABLE dir1 ( CREATE TABLE dir1 (
spath VARCHAR(256) flag=1, spath VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256), fname VARCHAR(256) NOT NULL,
ftype CHAR(4), ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) flag=5 size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*'; ) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*';
CREATE TABLE t1 CREATE TABLE t1
( (
a INT, a INT NOT NULL,
b CHAR(10) b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec'; ) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) NOT NULL,
`b` char(10) DEFAULT NULL `b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec'
SELECT * FROM t1; SELECT * FROM t1;
a b a b
...@@ -46,14 +46,14 @@ t1vec2 40 ...@@ -46,14 +46,14 @@ t1vec2 40
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
a INT, a INT NOT NULL,
b CHAR(10) b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10; ) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) NOT NULL,
`b` char(10) DEFAULT NULL `b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec'
SELECT * FROM t1; SELECT * FROM t1;
a b a b
...@@ -99,8 +99,8 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -99,8 +99,8 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) NOT NULL,
`b` char(10) DEFAULT NULL `b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=yes ) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=yes
INSERT INTO t1 VALUES (4,'test04'); INSERT INTO t1 VALUES (4,'test04');
ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT ERROR HY000: Got error 174 'Cannot modify this read/only protected table' from CONNECT
...@@ -116,8 +116,8 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL ...@@ -116,8 +116,8 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL, `a` int(11) NOT NULL,
`b` char(10) DEFAULT NULL `b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=no ) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=no
INSERT INTO t1 VALUES (4,'test04'); INSERT INTO t1 VALUES (4,'test04');
UPDATE t1 SET b='test04a' WHERE a=4; UPDATE t1 SET b='test04a' WHERE a=4;
......
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat --copy_file $MYSQL_TEST_DIR/suite/connect/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 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;
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_GET_ERRMSG --error ER_GET_ERRMSG
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_GET_ERRMSG --error ER_GET_ERRMSG
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
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/people.csv $MYSQLD_DATADIR/test/people.csv --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/people.csv $MYSQLD_DATADIR/test/people.csv
SET NAMES utf8; SET NAMES utf8;
--echo # --echo #
--echo # Testing errors --echo # Testing errors
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=CSV FILE_NAME='nonexistent.txt'; ) Engine=CONNECT TABLE_TYPE=CSV 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 examples from the manual --echo # Testing examples from the manual
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
name CHAR(12), name CHAR(12) NOT NULL,
birth DATE DATE_FORMAT='DD/MM/YY', birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
children SMALLINT(2) children SMALLINT(2) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1; HEADER=1 SEP_CHAR=';' QUOTED=1;
SELECT * FROM t1; SELECT * FROM t1;
INSERT INTO t1 VALUES ('RONALD','1980-02-26',4); INSERT INTO t1 VALUES ('RONALD','1980-02-26',4);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/people.csv --chmod 0777 $MYSQLD_DATADIR/test/people.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/people.csv'),'\r\n','\n'); --eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/people.csv'),'\r\n','\n');
--echo # --echo #
--echo # Testing READONLY tables --echo # Testing READONLY tables
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
name CHAR(12), name CHAR(12) NOT NULL,
birth DATE DATE_FORMAT='DD/MM/YY', birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
children SMALLINT(2) children SMALLINT(2) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes; HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('BILL','1973-06-30',5); INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
UPDATE t1 SET children=6 WHERE name='BILL'; UPDATE t1 SET children=6 WHERE name='BILL';
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
DELETE FROM t1 WHERE name='BILL'; DELETE FROM t1 WHERE name='BILL';
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 READONLY=no; ALTER TABLE t1 READONLY=no;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('BILL','1973-06-30',5); INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('BILL','1973-06-30',5); INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
SELECT * FROM t1; SELECT * FROM t1;
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
( (
c1 CHAR(12) NOT NULL, c1 CHAR(12) NOT NULL,
c2 CHAR(12) NOT NULL c2 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='tmp.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='tmp.csv'
HEADER=1 SEP_CHAR=',' QUOTED=1; HEADER=1 SEP_CHAR=',' QUOTED=1;
INSERT INTO t1 VALUES (10,10),(20,20),(300,300),(4000,4000), ('a b','c d'); INSERT INTO t1 VALUES (10,10),(20,20),(300,300),(4000,4000), ('a b','c d');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/tmp.csv --chmod 0777 $MYSQLD_DATADIR/test/tmp.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/tmp.csv'),'\r\n','\n'); --eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/tmp.csv'),'\r\n','\n');
--echo # --echo #
--echo # Creating a CSV table from a MyISAM table --echo # Creating a CSV table from a MyISAM table
--echo # --echo #
CREATE TABLE t1 (a VARCHAR(10), b INT) ENGINE=MyISAM; CREATE TABLE t1 (a VARCHAR(10) NOT NULL, b INT NOT NULL) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('test1',1), ('test2',2); INSERT INTO t1 VALUES ('test1',1), ('test2',2);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t2.csv' CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t2.csv'
AS SELECT * FROM t1; AS SELECT * FROM t1;
SELECT * FROM t2; SELECT * FROM t2;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t2.csv --chmod 0777 $MYSQLD_DATADIR/test/t2.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t2.csv'),'\r\n','\n'); --eval SELECT REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t2.csv'),'\r\n','\n');
--remove_file $MYSQLD_DATADIR/test/t2.csv --remove_file $MYSQLD_DATADIR/test/t2.csv
--echo # --echo #
--echo # Testing international data --echo # Testing international data
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=utf8; CHARSET=utf8;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.csv --chmod 0777 $MYSQLD_DATADIR/test/t1.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); --eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
--remove_file $MYSQLD_DATADIR/test/t1.csv --remove_file $MYSQLD_DATADIR/test/t1.csv
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=utf8 DATA_CHARSET=latin1; CHARSET=utf8 DATA_CHARSET=latin1;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.csv --chmod 0777 $MYSQLD_DATADIR/test/t1.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); --eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
--remove_file $MYSQLD_DATADIR/test/t1.csv --remove_file $MYSQLD_DATADIR/test/t1.csv
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.csv --chmod 0777 $MYSQLD_DATADIR/test/t1.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); --eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
--remove_file $MYSQLD_DATADIR/test/t1.csv --remove_file $MYSQLD_DATADIR/test/t1.csv
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=latin1; CHARSET=latin1;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.csv --chmod 0777 $MYSQLD_DATADIR/test/t1.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); --eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
--remove_file $MYSQLD_DATADIR/test/t1.csv --remove_file $MYSQLD_DATADIR/test/t1.csv
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv' ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=latin1 DATA_CHARSET=utf8; CHARSET=latin1 DATA_CHARSET=utf8;
INSERT INTO t1 VALUES ('á'); INSERT INTO t1 VALUES ('á');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.csv --chmod 0777 $MYSQLD_DATADIR/test/t1.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); --eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
--remove_file $MYSQLD_DATADIR/test/t1.csv --remove_file $MYSQLD_DATADIR/test/t1.csv
CREATE TABLE t1 CREATE TABLE t1
( (
c1 CHAR(12) CHARACTER SET latin1, c1 CHAR(12) CHARACTER SET latin1 NOT NULL,
c2 CHAR(12) CHARACTER SET utf8 c2 CHAR(12) CHARACTER SET utf8 NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'; ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
INSERT INTO t1 VALUES ('á','á'); INSERT INTO t1 VALUES ('á','á');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.csv --chmod 0777 $MYSQLD_DATADIR/test/t1.csv
--replace_result $MYSQLD_DATADIR DATADIR --replace_result $MYSQLD_DATADIR DATADIR
--eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n')); --eval SELECT HEX(REPLACE(LOAD_FILE('$MYSQLD_DATADIR/test/t1.csv'),'\r\n','\n'));
--remove_file $MYSQLD_DATADIR/test/t1.csv --remove_file $MYSQLD_DATADIR/test/t1.csv
# #
# Clean up # Clean up
# #
--remove_file $MYSQLD_DATADIR/test/people.csv --remove_file $MYSQLD_DATADIR/test/people.csv
--remove_file $MYSQLD_DATADIR/test/tmp.csv --remove_file $MYSQLD_DATADIR/test/tmp.csv
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--echo # --echo #
--echo # Testing errors --echo # Testing errors
--echo # --echo #
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_regex /on .*test.t1.dbf/on DATADIR\/test\/t1.dbf/ --replace_regex /on .*test.t1.dbf/on DATADIR\/test\/t1.dbf/
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--replace_regex /Cannot open .*test.t1.dbf/Cannot open DATADIR\/test\/t1.dbf/ --replace_regex /Cannot open .*test.t1.dbf/Cannot open DATADIR\/test\/t1.dbf/
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--replace_regex /Cannot open .*test.t1.dbf/Cannot open DATADIR\/test\/t1.dbf/ --replace_regex /Cannot open .*test.t1.dbf/Cannot open DATADIR\/test\/t1.dbf/
SHOW WARNINGS; SHOW WARNINGS;
DELIMITER //; DELIMITER //;
CREATE PROCEDURE test.dbf_field(in fieldno INT, in content BLOB) DETERMINISTIC CREATE PROCEDURE test.dbf_field(in fieldno INT, in content BLOB) DETERMINISTIC
BEGIN BEGIN
SELECT '---'; SELECT '---';
SELECT fieldno AS `FieldN`; SELECT fieldno AS `FieldN`;
SELECT TRIM(TRAILING 0x00 FROM LEFT(content, 10)) AS `Name`; SELECT TRIM(TRAILING 0x00 FROM LEFT(content, 10)) AS `Name`;
SELECT SUBSTRING(content, 12, 1) AS `Type`; SELECT SUBSTRING(content, 12, 1) AS `Type`;
SELECT CONV(HEX(REVERSE(SUBSTRING(content,13,4))),16,10) AS `Offset`; SELECT CONV(HEX(REVERSE(SUBSTRING(content,13,4))),16,10) AS `Offset`;
SELECT CONV(HEX(REVERSE(SUBSTRING(content,17,1))),16,10) AS `Length`; SELECT CONV(HEX(REVERSE(SUBSTRING(content,17,1))),16,10) AS `Length`;
SELECT CONV(HEX(REVERSE(SUBSTRING(content,18,1))),16,10) AS `Dec`; SELECT CONV(HEX(REVERSE(SUBSTRING(content,18,1))),16,10) AS `Dec`;
SELECT HEX(REVERSE(SUBSTRING(content,19,1))) AS `Flags`; SELECT HEX(REVERSE(SUBSTRING(content,19,1))) AS `Flags`;
-- SELECT CONV(HEX(REVERSE(SUBSTRING(content,20,4))),16,10) AS `Next`; -- SELECT CONV(HEX(REVERSE(SUBSTRING(content,20,4))),16,10) AS `Next`;
-- SELECT CONV(HEX(REVERSE(SUBSTRING(content,24,4))),16,10) AS `Step`; -- SELECT CONV(HEX(REVERSE(SUBSTRING(content,24,4))),16,10) AS `Step`;
END// END//
CREATE PROCEDURE test.dbf_header(in fname VARCHAR(1024)) DETERMINISTIC CREATE PROCEDURE test.dbf_header(in fname VARCHAR(1024)) DETERMINISTIC
BEGIN BEGIN
DECLARE content BLOB; DECLARE content BLOB;
DECLARE offset INT; DECLARE offset INT;
DECLARE fieldno INT; DECLARE fieldno INT;
SELECT '--------'; SELECT '--------';
SELECT LOAD_FILE(fname) INTO content; SELECT LOAD_FILE(fname) INTO content;
SELECT LENGTH(content) AS FileSize; SELECT LENGTH(content) AS FileSize;
SELECT HEX(LEFT(content, 1)) AS DBF_Version; SELECT HEX(LEFT(content, 1)) AS DBF_Version;
SELECT CONV(HEX(REVERSE(SUBSTRING(content,5,4))),16,10) AS NRecords; SELECT CONV(HEX(REVERSE(SUBSTRING(content,5,4))),16,10) AS NRecords;
SELECT CONV(HEX(REVERSE(SUBSTRING(content,9,2))),16,10) AS FirstRecPos; SELECT CONV(HEX(REVERSE(SUBSTRING(content,9,2))),16,10) AS FirstRecPos;
SELECT CONV(HEX(REVERSE(SUBSTRING(content,11,2))),16,10) AS RecLength; SELECT CONV(HEX(REVERSE(SUBSTRING(content,11,2))),16,10) AS RecLength;
SELECT HEX(REVERSE(SUBSTRING(content,29,2))) AS TableFlags; SELECT HEX(REVERSE(SUBSTRING(content,29,2))) AS TableFlags;
SELECT HEX(REVERSE(SUBSTRING(content,30,1))) AS CodePageMark; SELECT HEX(REVERSE(SUBSTRING(content,30,1))) AS CodePageMark;
SET offset=33; SET offset=33;
SET fieldno=0; SET fieldno=0;
WHILE SUBSTR(content, offset, 1) <> 0x0D AND offset + 32 < LENGTH(content) DO WHILE SUBSTR(content, offset, 1) <> 0x0D AND offset + 32 < LENGTH(content) DO
CALL dbf_field(fieldno, SUBSTRING(content, offset, 32)); CALL dbf_field(fieldno, SUBSTRING(content, offset, 32));
SET offset=offset + 32; SET offset=offset + 32;
SET fieldno=fieldno + 1; SET fieldno=fieldno + 1;
END WHILE; END WHILE;
SELECT '--------'; SELECT '--------';
END// END//
DELIMITER ;// DELIMITER ;//
--echo # --echo #
--echo # Testing READONLY tables --echo # Testing READONLY tables
--echo # --echo #
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (10),(20); INSERT INTO t1 VALUES (10),(20);
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_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES (30); INSERT INTO t1 VALUES (30);
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
UPDATE t1 SET a=30 WHERE a=10; UPDATE t1 SET a=30 WHERE a=10;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
DELETE FROM t1 WHERE a=10; DELETE FROM t1 WHERE a=10;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=NO; ALTER TABLE t1 READONLY=NO;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (30); INSERT INTO t1 VALUES (30);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # This SQL script crashed (dbf01.sql) --echo # This SQL script crashed (dbf01.sql)
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a int(11) DEFAULT NULL, a int(11) NOT NULL,
b char(10) DEFAULT NULL, b char(10) NOT NULL,
c varchar(10) DEFAULT NULL c varchar(10) NOT NULL
) ENGINE=CONNECT table_type=DBF file_name='t1.dbf'; ) ENGINE=CONNECT table_type=DBF file_name='t1.dbf';
INSERT INTO t1 VALUES (1,'1','1'); INSERT INTO t1 VALUES (1,'1','1');
INSERT INTO t1 VALUES (2,'2','2'); INSERT INTO t1 VALUES (2,'2','2');
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing that table options in lower case and mixed case are understood: --echo # Testing that table options in lower case and mixed case are understood:
--echo # --echo #
CREATE TABLE t1 (a INT) ENGINE=CONNECT table_type=dbf file_name='t1.dbf'; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT table_type=dbf file_name='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
CREATE TABLE t1 (a CHAR(10)) ENGINE=CONNECT Table_Type=dbf File_Name='t1.dbf'; CREATE TABLE t1 (a CHAR(10) NOT NULL) ENGINE=CONNECT Table_Type=dbf File_Name='t1.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('test'); INSERT INTO t1 VALUES ('test');
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
# #
# TODO: this creates DBF record with length=32, which looks wrong # TODO: this creates DBF record with length=32, which looks wrong
# #
--echo # --echo #
--echo # Testing multiple columns --echo # Testing multiple columns
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a INT DEFAULT NULL, a INT NOT NULL,
b CHAR(10) DEFAULT NULL, b CHAR(10) NOT NULL,
c VARCHAR(10) DEFAULT NULL c VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (1,'1','1'); INSERT INTO t1 VALUES (1,'1','1');
INSERT INTO t1 VALUES (2,'2','2'); INSERT INTO t1 VALUES (2,'2','2');
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing long column name --echo # Testing long column name
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a012345678901234567890123456789 INT DEFAULT NULL a012345678901234567890123456789 INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--echo # --echo #
--echo # Testing 2 columns with long names (12) --echo # Testing 2 columns with long names (12)
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a0123456789a INT DEFAULT NULL, a0123456789a INT NOT NULL,
b0123456789b INT DEFAULT NULL b0123456789b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x11.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x11.dbf';
--echo # --echo #
--echo # Testing 2 columns with long names (11) --echo # Testing 2 columns with long names (11)
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a012345678a INT DEFAULT NULL, a012345678a INT NOT NULL,
b012345678b INT DEFAULT NULL b012345678b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x12.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x12.dbf';
--echo # --echo #
--echo # Testing 2 columns name length 10 (maximum possible length) --echo # Testing 2 columns name length 10 (maximum possible length)
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a01234567a INT DEFAULT NULL, a01234567a INT NOT NULL,
b01234567b INT DEFAULT NULL b01234567b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x13.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x13.dbf';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (1,2); INSERT INTO t1 VALUES (1,2);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t02x13.dbf --remove_file $MYSQLD_DATADIR/test/t02x13.dbf
--echo # --echo #
--echo # Testing BIGINT --echo # Testing BIGINT
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a bigint DEFAULT NULL a bigint NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF); INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
INSERT INTO t1 VALUES (-0x8000000000000000); INSERT INTO t1 VALUES (-0x8000000000000000);
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing TINYINT --echo # Testing TINYINT
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a TINYINT DEFAULT NULL a TINYINT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (123);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing SMALLINT --echo # Testing SMALLINT
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a SMALLINT DEFAULT NULL a SMALLINT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (0x7FFF); INSERT INTO t1 VALUES (0x7FFF);
INSERT INTO t1 VALUES (-0x8000); INSERT INTO t1 VALUES (-0x8000);
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing VARCHAR --echo # Testing VARCHAR
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(255) a VARCHAR(255) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (REPEAT('a',255)); INSERT INTO t1 VALUES (REPEAT('a',255));
SELECT LENGTH(a) FROM t1; SELECT LENGTH(a) FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing too long CHAR --echo # Testing too long CHAR
--echo # All columns longer than 255 bytes should be rejected --echo # All columns longer than 255 bytes should be rejected
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a CHAR(86) CHARACTER SET utf8 a CHAR(86) CHARACTER SET utf8 NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
--echo # --echo #
--echo # Testing too long VARCHAR --echo # Testing too long VARCHAR
--echo # All columns longer than 255 bytes should be rejected --echo # All columns longer than 255 bytes should be rejected
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(256) a VARCHAR(256) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(86) CHARACTER SET utf8 a VARCHAR(86) CHARACTER SET utf8 NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(64000) a VARCHAR(64000) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--echo # --echo #
--echo # Testing BLOB --echo # Testing BLOB
--echo # --echo #
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a BLOB a BLOB
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a TINYBLOB a TINYBLOB
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a MEDIUMBLOB a MEDIUMBLOB
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 CREATE TABLE t1
( (
a LONGBLOB a LONGBLOB
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
# TODO: utf8 does not work # TODO: utf8 does not work
#--echo # #--echo #
#--echo # Testing varchar with utf8 #--echo # Testing varchar with utf8
#--echo # #--echo #
#SET NAMES utf8; #SET NAMES utf8;
#CREATE TABLE t1 #CREATE TABLE t1
#( #(
# a VARCHAR(10) CHARACTER SET utf8 # a VARCHAR(10) CHARACTER SET utf8
#) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; #) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
#INSERT INTO t1 VALUES (REPEAT(_ucs2 0x00DF,10)); #INSERT INTO t1 VALUES (REPEAT(_ucs2 0x00DF,10));
#SELECT * FROM t1; #SELECT * FROM t1;
#DROP TABLE IF EXISTS t1; #DROP TABLE IF EXISTS t1;
#--remove_file $MYSQLD_DATADIR/test/t1.dbf #--remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing DATE --echo # Testing DATE
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a DATE a DATE NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('2001-01-01'); INSERT INTO t1 VALUES ('2001-01-01');
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing FLOAT --echo # Testing FLOAT
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a FLOAT(12,4) a FLOAT(12,4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (123);
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
# #
# TODO: this return error: # TODO: this return error:
# Got error 122 'Value 123.0000000000 too long for column a of length 12' # Got error 122 'Value 123.0000000000 too long for column a of length 12'
# from CONNECT # from CONNECT
# #
#CREATE TABLE t1 #CREATE TABLE t1
#( #(
# a FLOAT # a FLOAT NOT NULL
#) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; #) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
#--error ER_GET_ERRMSG - why this error? #--error ER_GET_ERRMSG - why this error?
#INSERT INTO t1 VALUES (123); #INSERT INTO t1 VALUES (123);
#SELECT * FROM t1; #SELECT * FROM t1;
#DROP TABLE IF EXISTS t1; #DROP TABLE IF EXISTS t1;
#--remove_file $MYSQLD_DATADIR/test/t1.dbf #--remove_file $MYSQLD_DATADIR/test/t1.dbf
# #
# TODO: this creates a column of type 'D' (date), which is wrong # TODO: this creates a column of type 'D' (date), which is wrong
# #
#--echo # #--echo #
#--echo # Testing DATETIME #--echo # Testing DATETIME
#--echo # #--echo #
#CREATE TABLE t1 #CREATE TABLE t1
#( #(
# a DATETIME # a DATETIME NOT NULL
#) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; #) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
#INSERT INTO t1 VALUES ('2013-02-01'); #INSERT INTO t1 VALUES ('2013-02-01');
#SELECT * FROM t1; #SELECT * FROM t1;
#DROP TABLE t1; #DROP TABLE t1;
#--remove_file $MYSQLD_DATADIR/test/t1.dbf #--remove_file $MYSQLD_DATADIR/test/t1.dbf
# #
# TODO: this creates a column of type 'D' (date), which is wrong # TODO: this creates a column of type 'D' (date), which is wrong
# #
#--echo # #--echo #
#--echo # Testing TIMESTAMP #--echo # Testing TIMESTAMP
#--echo # #--echo #
#CREATE TABLE t1 #CREATE TABLE t1
#( #(
# a TIMESTAMP # a TIMESTAMP
#) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; #) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
#INSERT INTO t1 VALUES ('2013-02-01'); #INSERT INTO t1 VALUES ('2013-02-01');
#SELECT * FROM t1; #SELECT * FROM t1;
#DROP TABLE t1; #DROP TABLE t1;
#--remove_file $MYSQLD_DATADIR/test/t1.dbf #--remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing double --echo # Testing double
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a DOUBLE(20,5) a DOUBLE(20,5) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123); INSERT INTO t1 VALUES (123);
INSERT INTO t1 VALUES (123456789.12345); INSERT INTO t1 VALUES (123456789.12345);
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
# TODO: # TODO:
# Testing with no FILE_NAME specified # Testing with no FILE_NAME specified
# Currently it returns: # Currently it returns:
# ERROR 1296 (HY000): Got error 174 'Open(a+) error 21 # ERROR 1296 (HY000): Got error 174 'Open(a+) error 21
# on /opt/mariadb-5.5/data/: Is a directory' from CONNECT # on /opt/mariadb-5.5/data/: Is a directory' from CONNECT
#CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF; #CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF;
--echo # --echo #
--echo # Testing ALTER --echo # Testing ALTER
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
a VARCHAR(10) a VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('10'); INSERT INTO t1 VALUES ('10');
SELECT * FROM t1; SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL; ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
ALTER TABLE t1 MODIFY a INT(10) NOT NULL; ALTER TABLE t1 MODIFY a INT(10) NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
SELECT * FROM t1; SELECT * FROM t1;
--vertical_results --vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results --horizontal_results
# TODO: this does not work on Windows # TODO: this does not work on Windows
#ALTER TABLE t1 MODIFY a INT(8) NOT NULL; #ALTER TABLE t1 MODIFY a INT(8) NOT NULL;
#SHOW CREATE TABLE t1; #SHOW CREATE TABLE t1;
#--error ER_GET_ERRMSG #--error ER_GET_ERRMSG
#SELECT * FROM t1; #SELECT * FROM t1;
#--vertical_results #--vertical_results
#--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR #--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
#eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); #eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
#--horizontal_results #--horizontal_results
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf --remove_file $MYSQLD_DATADIR/test/t1.dbf
--echo # --echo #
--echo # Testing NULL --echo # Testing NULL
--echo # --echo #
# TODO: NULLs should probably change to DEFAULT and produce a warning # TODO: NULLs should probably change to DEFAULT and produce a warning
CREATE TABLE t1 CREATE TABLE t1
( (
c1 VARCHAR(10), c1 VARCHAR(10) NOT NULL,
c2 VARCHAR(10) DEFAULT 'def', c2 VARCHAR(10) NOT NULL DEFAULT 'def',
i1 INT, i1 INT NOT NULL,
i2 INT DEFAULT 123 i2 INT NOT NULL DEFAULT 123
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf'; ) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('10','10',10,10); INSERT INTO t1 VALUES ('10','10',10,10);
INSERT INTO t1 VALUES (NULL,NULL,NULL,NULL); #INSERT INTO t1 VALUES (NULL,NULL,NULL,NULL);
SELECT * FROM t1; INSERT INTO t1(c1,i1) VALUES ('20',20);
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf INSERT INTO t1 VALUES ('30',DEFAULT,30,DEFAULT);
--vertical_results SELECT * FROM t1;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR --chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf'); --vertical_results
--horizontal_results --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
DROP TABLE IF EXISTS t1; eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--remove_file $MYSQLD_DATADIR/test/t1.dbf --horizontal_results
DROP TABLE IF EXISTS t1;
DROP PROCEDURE test.dbf_field; --remove_file $MYSQLD_DATADIR/test/t1.dbf
DROP PROCEDURE test.dbf_header;
DROP PROCEDURE test.dbf_field;
DROP PROCEDURE test.dbf_header;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE t1 ( CREATE TABLE t1 (
path VARCHAR(256) flag=1, path VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256), fname VARCHAR(256) NOT NULL,
ftype CHAR(4), ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) flag=5 size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt' ) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'
OPTION_LIST='subdir=1'; OPTION_LIST='subdir=1';
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT * FROM t1; SELECT * FROM t1;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boys.txt $MYSQLD_DATADIR/test/boys.txt --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boys.txt $MYSQLD_DATADIR/test/boys.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt
--mkdir $MYSQLD_DATADIR/test/subdir/ --mkdir $MYSQLD_DATADIR/test/subdir/
--copy_file $MYSQLD_DATADIR/test/boys.txt $MYSQLD_DATADIR/test/subdir/boys2.txt --copy_file $MYSQLD_DATADIR/test/boys.txt $MYSQLD_DATADIR/test/subdir/boys2.txt
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size; SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
ALTER TABLE t1 OPTION_LIST='subdir=0'; ALTER TABLE t1 OPTION_LIST='subdir=0';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size; SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
# TODO: add a better error message # TODO: add a better error message
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('','','',''); INSERT INTO t1 VALUES ('','','','');
DROP TABLE t1; DROP TABLE t1;
# TODO: automatically add columns # TODO: automatically add columns
--error ER_UNKNOWN_ERROR --error ER_UNKNOWN_ERROR
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
# #
# TODO: this fails on Linux # TODO: this fails on Linux
# #
#CREATE TABLE t1 t1 ( #CREATE TABLE t1 t1 (
# DRIVE CHAR(2), # DRIVE CHAR(2),
# PATH VARCHAR(256), # PATH VARCHAR(256),
# FNAME VARCHAR(256), # FNAME VARCHAR(256),
# FTYPE CHAR(4), # FTYPE CHAR(4),
# SIZE DOUBLE(12,0) flag=5, # SIZE DOUBLE(12,0) flag=5,
# MODIFIED datetime # MODIFIED datetime
#) engine=CONNECT table_type=DIR file_name='*.txt'; #) engine=CONNECT table_type=DIR file_name='*.txt';
#SELECT * FROM t1; #SELECT * FROM t1;
#DROP TABLE t1; #DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/subdir/boys2.txt --remove_file $MYSQLD_DATADIR/test/subdir/boys2.txt
--rmdir $MYSQLD_DATADIR/test/subdir/ --rmdir $MYSQLD_DATADIR/test/subdir/
--remove_file $MYSQLD_DATADIR/test/boys.txt --remove_file $MYSQLD_DATADIR/test/boys.txt
--remove_file $MYSQLD_DATADIR/test/boyswin.txt --remove_file $MYSQLD_DATADIR/test/boyswin.txt
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/dept.dat $MYSQLD_DATADIR/test/dept.dat --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/dept.dat $MYSQLD_DATADIR/test/dept.dat
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boys.txt $MYSQLD_DATADIR/test/boys.txt --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boys.txt $MYSQLD_DATADIR/test/boys.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt
--echo # --echo #
--echo # Testing errors --echo # Testing errors
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
ID INT ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=DOS FILE_NAME='nonexistent.txt'; ) Engine=CONNECT TABLE_TYPE=DOS 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 READONLY tables --echo # Testing READONLY tables
--echo # --echo #
CREATE TABLE t1 CREATE TABLE t1
( (
id INT id INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt'; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (10);
SELECT * FROM t1; SELECT * FROM t1;
ALTER TABLE t1 READONLY=1; ALTER TABLE t1 READONLY=1;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES (20); INSERT INTO t1 VALUES (20);
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
UPDATE t1 SET id=20 WHERE id=10; UPDATE t1 SET id=20 WHERE id=10;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
DELETE FROM t1 WHERE id=10; DELETE FROM t1 WHERE id=10;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=0; ALTER TABLE t1 READONLY=0;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (20); INSERT INTO t1 VALUES (20);
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
( (
number CHAR(4) not null, number CHAR(4) not null,
location CHAR(15) flag=5, location CHAR(15) NOT NULL flag=5,
director CHAR(5) flag=20, director CHAR(5) NOT NULL flag=20,
function CHAR(12) flag=26, function CHAR(12) NOT NULL flag=26,
name CHAR(22) flag=38 name CHAR(22) NOT NULL flag=38
) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='dept.dat'; ) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='dept.dat';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' ENDING=1; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' ENDING=1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 CREATE TABLE t1
( (
name char(12), name char(12) not null,
city char(12), city char(12) not null,
birth date date_format='DD/MM/YYYY', birth date not null date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36 hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2; ) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
# Clean up # Clean up
# #
--remove_file $MYSQLD_DATADIR/test/dept.dat --remove_file $MYSQLD_DATADIR/test/dept.dat
--remove_file $MYSQLD_DATADIR/test/boys.txt --remove_file $MYSQLD_DATADIR/test/boys.txt
--remove_file $MYSQLD_DATADIR/test/boyswin.txt --remove_file $MYSQLD_DATADIR/test/boyswin.txt
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/funny.txt $MYSQLD_DATADIR/test/funny.txt --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/funny.txt $MYSQLD_DATADIR/test/funny.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/funny2.txt $MYSQLD_DATADIR/test/funny2.txt --copy_file $MYSQL_TEST_DIR/suite/connect/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 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 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) field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'", NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n', DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) 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) field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'", NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n', DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) 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) field_format=' %n%d%n', ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) field_format=' , ''%n%[^'']%m', NAME Char(16) not null field_format=' , ''%n%[^'']%m',
DEPNO Integer(4) field_format=''' , #%n%d%m', DEPNO Integer(4) not null field_format=''' , #%n%d%m',
SALARY Double(12,2) 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 #
CREATE TABLE t1 (a INT) 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) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt'; #CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
#INSERT INTO t1 VALUES (10); #INSERT INTO t1 VALUES (10);
#SELECT * FROM t1; #SELECT * FROM t1;
#--error ER_GET_ERRMSG #--error ER_GET_ERRMSG
#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;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/emp.txt $MYSQLD_DATADIR/test/emp.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sexe.csv $MYSQLD_DATADIR/test/sexe.csv --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sexe.csv $MYSQLD_DATADIR/test/sexe.csv
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sitmat.csv $MYSQLD_DATADIR/test/sitmat.csv --copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sitmat.csv $MYSQLD_DATADIR/test/sitmat.csv
--echo # --echo #
--echo # Testing indexing --echo # Testing indexing
--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), 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;
SELECT SUM(brut) from t1; SELECT SUM(brut) from t1;
--echo # --echo #
--echo # Testing file mapping --echo # Testing file mapping
--echo # --echo #
ALTER TABLE t1 MAPPED=yes; ALTER TABLE t1 MAPPED=yes;
SELECT * FROM t1 LIMIT 10; SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) FROM t1; SELECT SUM(brut) FROM t1;
--echo # --echo #
--echo # Test the indexes (made when creating the table) --echo # Test the indexes (made when creating the table)
--echo # --echo #
SELECT * FROM t1 WHERE matricule = '0091'; SELECT * FROM t1 WHERE matricule = '0091';
SELECT * FROM t1 WHERE nom = 'FOCH'; SELECT * FROM t1 WHERE nom = 'FOCH';
SELECT * FROM t1 WHERE nom = 'FOCH' and prenom = 'DENIS'; SELECT * FROM t1 WHERE nom = 'FOCH' and prenom = 'DENIS';
--echo # --echo #
--echo # Testing UPDATE --echo # Testing UPDATE
--echo # --echo #
UPDATE t1 SET aanais = aanais + 16; UPDATE t1 SET aanais = aanais + 16;
UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year); UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year);
UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year); UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year);
SELECT * FROM t1 WHERE nom = 'FOCH'; SELECT * FROM t1 WHERE nom = 'FOCH';
--echo # --echo #
--echo # Testing JOIN --echo # Testing JOIN
--echo # --echo #
create table t2 create table t2
( (
sexe INT(1) KEY, sexe INT(1) KEY,
genre CHAR(8) NOT NULL genre CHAR(8) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sexe.csv' SEP_CHAR=';' ENDING=2; ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sexe.csv' SEP_CHAR=';' ENDING=2;
SELECT * FROM t2; SELECT * FROM t2;
SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10; SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10;
--echo # --echo #
--echo # Another table --echo # Another table
--echo # --echo #
CREATE TABLE t3 ( CREATE TABLE t3 (
sitmat CHAR(1) KEY, sitmat CHAR(1) KEY,
situation CHAR(12) NOT NULL situation CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sitmat.csv' SEP_CHAR=';' ENDING=2; ) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sitmat.csv' SEP_CHAR=';' ENDING=2;
SELECT * FROM t3; SELECT * FROM t3;
SELECT nom, prenom, genre, situation FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 WHERE nom = 'FOCH'; SELECT nom, prenom, genre, situation FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 WHERE nom = 'FOCH';
--echo # --echo #
--echo # Testing DELETE --echo # Testing DELETE
--echo # --echo #
DELETE FROM t1; DELETE FROM t1;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
DROP TABLE t3; DROP TABLE t3;
# #
# Clean up # Clean up
# #
--remove_file $MYSQLD_DATADIR/test/emp.txt --remove_file $MYSQLD_DATADIR/test/emp.txt
--remove_file $MYSQLD_DATADIR/test/sexe.csv --remove_file $MYSQLD_DATADIR/test/sexe.csv
--remove_file $MYSQLD_DATADIR/test/sitmat.csv --remove_file $MYSQLD_DATADIR/test/sitmat.csv
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE dir1 ( CREATE TABLE dir1 (
spath VARCHAR(256) flag=1, spath VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256), fname VARCHAR(256) NOT NULL,
ftype CHAR(4), ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) flag=5 size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*'; ) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*';
CREATE TABLE t1 CREATE TABLE t1
( (
a INT, a INT NOT NULL,
b CHAR(10) b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec'; ) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec';
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
# Testing SELECT on empty file # Testing SELECT on empty file
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ --replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT * FROM t1; SELECT * FROM t1;
INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03'); INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
SELECT * FROM t1; SELECT * FROM t1;
SELECT a FROM t1; SELECT a FROM t1;
SELECT b FROM t1; SELECT b FROM t1;
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1vec1 --remove_file $MYSQLD_DATADIR/test/t1vec1
--remove_file $MYSQLD_DATADIR/test/t1vec2 --remove_file $MYSQLD_DATADIR/test/t1vec2
CREATE TABLE t1 CREATE TABLE t1
( (
a INT, a INT NOT NULL,
b CHAR(10) b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10; ) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
# Testing SELECTs on empty file # Testing SELECTs on empty file
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ --replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT * FROM t1; SELECT * FROM t1;
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ --replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT a FROM t1; SELECT a FROM t1;
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/ --replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT b FROM t1; SELECT b FROM t1;
INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03'); INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
SELECT * FROM t1; SELECT * FROM t1;
SELECT a FROM t1; SELECT a FROM t1;
SELECT b FROM t1; SELECT b FROM t1;
--replace_result $MYSQLD_DATADIR DATADIR/ --replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
--echo # --echo #
--echo # Testing READONLY --echo # Testing READONLY
--echo # --echo #
ALTER TABLE t1 READONLY=yes; ALTER TABLE t1 READONLY=yes;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
INSERT INTO t1 VALUES (4,'test04'); INSERT INTO t1 VALUES (4,'test04');
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
UPDATE t1 SET b='test04' WHERE a=3; UPDATE t1 SET b='test04' WHERE a=3;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
DELETE FROM t1 WHERE a=3; DELETE FROM t1 WHERE a=3;
--error ER_GET_ERRMSG --error ER_GET_ERRMSG
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=no; ALTER TABLE t1 READONLY=no;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (4,'test04'); INSERT INTO t1 VALUES (4,'test04');
UPDATE t1 SET b='test04a' WHERE a=4; UPDATE t1 SET b='test04a' WHERE a=4;
DELETE FROM t1 WHERE a=0; DELETE FROM t1 WHERE a=0;
SELECT * FROM t1; SELECT * FROM t1;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype; SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1vec --remove_file $MYSQLD_DATADIR/test/t1vec
--remove_file $MYSQLD_DATADIR/test/t1vec.blk --remove_file $MYSQLD_DATADIR/test/t1vec.blk
--echo # --echo #
--echo # Clean up --echo # Clean up
--echo # --echo #
DROP TABLE dir1; DROP TABLE dir1;
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