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
This diff is collapsed.
This diff is collapsed.
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