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 @@
#
CREATE TABLE t1
(
ID INT
ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
SELECT * FROM t1;
ID
......
......@@ -4,7 +4,7 @@ SET NAMES utf8;
#
CREATE TABLE t1
(
ID INT
ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=CSV FILE_NAME='nonexistent.txt';
SELECT * FROM t1;
ID
......@@ -14,11 +14,11 @@ DROP TABLE t1;
#
# Testing examples from the manual
#
CREATE TABLE t1
CREATE TABLE t1
(
name CHAR(12),
birth DATE DATE_FORMAT='DD/MM/YY',
children SMALLINT(2)
name CHAR(12) NOT NULL,
birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
children SMALLINT(2) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1;
SELECT * FROM t1;
......@@ -42,11 +42,11 @@ Name;birth;children
#
# Testing READONLY tables
#
CREATE TABLE t1
CREATE TABLE t1
(
name CHAR(12),
birth DATE DATE_FORMAT='DD/MM/YY',
children SMALLINT(2)
name CHAR(12) NOT NULL,
birth DATE NOT NULL DATE_FORMAT='DD/MM/YY',
children SMALLINT(2) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='people.csv'
HEADER=1 SEP_CHAR=';' QUOTED=1 READONLY=yes;
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
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` char(12) DEFAULT NULL,
`birth` date DEFAULT NULL `DATE_FORMAT`='DD/MM/YY',
`children` smallint(2) DEFAULT NULL
`name` char(12) NOT NULL,
`birth` date NOT NULL `DATE_FORMAT`='DD/MM/YY',
`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
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
SELECT * FROM t1;
......@@ -85,9 +85,9 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`name` char(12) DEFAULT NULL,
`birth` date DEFAULT NULL `DATE_FORMAT`='DD/MM/YY',
`children` smallint(2) DEFAULT NULL
`name` char(12) NOT NULL,
`birth` date NOT NULL `DATE_FORMAT`='DD/MM/YY',
`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
INSERT INTO t1 VALUES ('BILL','1973-06-30',5);
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')
#
# 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);
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t2.csv'
AS SELECT * FROM t1;
......@@ -148,7 +148,7 @@ test2,2
#
CREATE TABLE t1
(
c1 CHAR(12)
c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=utf8;
INSERT INTO t1 VALUES ('á');
......@@ -161,7 +161,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
C3A10A
CREATE TABLE t1
(
c1 CHAR(12)
c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=utf8 DATA_CHARSET=latin1;
INSERT INTO t1 VALUES ('á');
......@@ -174,7 +174,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
E10A
CREATE TABLE t1
(
c1 CHAR(12)
c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
INSERT INTO t1 VALUES ('á');
SELECT * FROM t1;
......@@ -186,7 +186,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
E10A
CREATE TABLE t1
(
c1 CHAR(12)
c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=latin1;
INSERT INTO t1 VALUES ('á');
......@@ -199,7 +199,7 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
E10A
CREATE TABLE t1
(
c1 CHAR(12)
c1 CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv'
CHARSET=latin1 DATA_CHARSET=utf8;
INSERT INTO t1 VALUES ('á');
......@@ -212,8 +212,8 @@ HEX(REPLACE(LOAD_FILE('DATADIR/test/t1.csv'),'\r\n','\n'))
C3A10A
CREATE TABLE t1
(
c1 CHAR(12) CHARACTER SET latin1,
c2 CHAR(12) CHARACTER SET utf8
c1 CHAR(12) CHARACTER SET latin1 NOT NULL,
c2 CHAR(12) CHARACTER SET utf8 NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.csv';
INSERT INTO t1 VALUES ('á','á');
SELECT * FROM t1;
......
#
# 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;
Table Create Table
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'
SELECT * FROM t1;
a
......@@ -56,11 +56,11 @@ END//
#
# 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;
Table Create Table
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'
INSERT INTO t1 VALUES (10),(20);
SELECT * FROM t1;
......@@ -73,7 +73,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1;
Table Create Table
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
INSERT INTO t1 VALUES (30);
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
SHOW CREATE TABLE t1;
Table Create Table
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
INSERT INTO t1 VALUES (30);
SELECT * FROM t1;
......@@ -103,9 +103,9 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a int(11) DEFAULT NULL,
b char(10) DEFAULT NULL,
c varchar(10) DEFAULT NULL
a int(11) NOT NULL,
b char(10) NOT NULL,
c varchar(10) NOT NULL
) ENGINE=CONNECT table_type=DBF file_name='t1.dbf';
INSERT INTO t1 VALUES (1,'1','1');
INSERT INTO t1 VALUES (2,'2','2');
......@@ -117,22 +117,22 @@ DROP TABLE t1;
#
# 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;
Table Create Table
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'
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
a
10
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;
Table Create Table
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'
INSERT INTO t1 VALUES ('test');
SELECT * FROM t1;
......@@ -162,9 +162,9 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a INT DEFAULT NULL,
b CHAR(10) DEFAULT NULL,
c VARCHAR(10) DEFAULT NULL
a INT NOT NULL,
b CHAR(10) NOT NULL,
c VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (1,'1','1');
INSERT INTO t1 VALUES (2,'2','2');
......@@ -212,7 +212,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a012345678901234567890123456789 INT DEFAULT NULL
a012345678901234567890123456789 INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
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
#
CREATE TABLE t1
(
a0123456789a INT DEFAULT NULL,
b0123456789b INT DEFAULT NULL
a0123456789a INT NOT NULL,
b0123456789b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x11.dbf';
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
(
a012345678a INT DEFAULT NULL,
b012345678b INT DEFAULT NULL
a012345678a INT NOT NULL,
b012345678b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x12.dbf';
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
(
a01234567a INT DEFAULT NULL,
b01234567b INT DEFAULT NULL
a01234567a INT NOT NULL,
b01234567b INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t02x13.dbf';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a01234567a` int(11) DEFAULT NULL,
`b01234567b` int(11) DEFAULT NULL
`a01234567a` int(11) NOT NULL,
`b01234567b` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t02x13.dbf'
INSERT INTO t1 VALUES (1,2);
SELECT * FROM t1;
......@@ -257,7 +257,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a bigint DEFAULT NULL
a bigint NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (0x7FFFFFFFFFFFFFFF);
INSERT INTO t1 VALUES (-0x8000000000000000);
......@@ -289,7 +289,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a TINYINT DEFAULT NULL
a TINYINT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123);
SELECT * FROM t1;
......@@ -301,7 +301,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a SMALLINT DEFAULT NULL
a SMALLINT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (0x7FFF);
INSERT INTO t1 VALUES (-0x8000);
......@@ -333,7 +333,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a VARCHAR(255)
a VARCHAR(255) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (REPEAT('a',255));
SELECT LENGTH(a) FROM t1;
......@@ -364,7 +364,7 @@ DROP 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';
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
(
a VARCHAR(256)
a VARCHAR(256) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
ERROR HY000: DBF: Column length too big for 'a' (max=255)
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';
ERROR HY000: DBF: Column length too big for 'a' (max=255)
CREATE TABLE t1
(
a VARCHAR(64000)
a VARCHAR(64000) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
ERROR HY000: DBF: Column length too big for 'a' (max=255)
#
......@@ -414,7 +414,7 @@ ERROR HY000: Unsupported type for column 'a'
#
CREATE TABLE t1
(
a DATE
a DATE NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('2001-01-01');
SELECT * FROM t1;
......@@ -444,7 +444,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a FLOAT(12,4)
a FLOAT(12,4) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123);
SELECT * FROM t1;
......@@ -474,7 +474,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
a DOUBLE(20,5)
a DOUBLE(20,5) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES (123);
INSERT INTO t1 VALUES (123456789.12345);
......@@ -506,7 +506,7 @@ DROP TABLE IF EXISTS t1;
#
CREATE TABLE t1
(
a VARCHAR(10)
a VARCHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('10');
SELECT * FROM t1;
......@@ -532,7 +532,7 @@ Flags 00
-------- --------
ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL;
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;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -594,22 +594,24 @@ DROP TABLE IF EXISTS t1;
#
CREATE TABLE t1
(
c1 VARCHAR(10),
c2 VARCHAR(10) DEFAULT 'def',
i1 INT,
i2 INT DEFAULT 123
c1 VARCHAR(10) NOT NULL,
c2 VARCHAR(10) NOT NULL DEFAULT 'def',
i1 INT NOT NULL,
i2 INT NOT NULL DEFAULT 123
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
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;
c1 c2 i1 i2
10 10 10 10
0 0
20 20 0
30 def 30 123
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
-------- --------
FileSize 248
FileSize 291
DBF_Version 03
NRecords 2
NRecords 3
FirstRecPos 162
RecLength 43
TableFlags 0000
......
CREATE TABLE t1 (
path VARCHAR(256) flag=1,
fname VARCHAR(256),
ftype CHAR(4),
size DOUBLE(12,0) flag=5
path VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256) NOT NULL,
ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'
OPTION_LIST='subdir=1';
SELECT * FROM t1;
......@@ -18,10 +18,10 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`path` varchar(256) DEFAULT NULL `flag`=1,
`fname` varchar(256) DEFAULT NULL,
`ftype` char(4) DEFAULT NULL,
`size` double(12,0) DEFAULT NULL `flag`=5
`path` varchar(256) NOT NULL `flag`=1,
`fname` varchar(256) NOT NULL,
`ftype` char(4) NOT NULL,
`size` double(12,0) NOT NULL `flag`=5
) 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;
fname ftype size
......
......@@ -3,7 +3,7 @@
#
CREATE TABLE t1
(
ID INT
ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=DOS FILE_NAME='nonexistent.txt';
SELECT * FROM t1;
ID
......@@ -15,7 +15,7 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
id INT
id INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
......@@ -27,7 +27,7 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1;
Table Create Table
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
INSERT INTO t1 VALUES (20);
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
SHOW CREATE TABLE t1;
Table Create Table
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
INSERT INTO t1 VALUES (20);
SELECT * FROM t1;
......@@ -57,10 +57,10 @@ DROP TABLE t1;
CREATE TABLE t1
(
number CHAR(4) not null,
location CHAR(15) flag=5,
director CHAR(5) flag=20,
function CHAR(12) flag=26,
name CHAR(22) flag=38
location CHAR(15) NOT NULL flag=5,
director CHAR(5) NOT NULL flag=20,
function CHAR(12) NOT NULL flag=26,
name CHAR(22) NOT NULL flag=38
) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='dept.dat';
SELECT * FROM t1;
number location director function name
......@@ -71,10 +71,10 @@ number location director function name
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' ENDING=1;
SELECT * FROM t1;
name city birth hired
......@@ -87,10 +87,10 @@ Bill Boston 1 1986-09-01 2008-02-10
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1;
SELECT * FROM t1;
name city birth hired
......@@ -103,10 +103,10 @@ Bill Boston 1 1986-09-01 2008-02-10
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2;
SELECT * FROM t1;
name city birth hired
......@@ -119,10 +119,10 @@ Bill Boston 1 1986-09-01 2008-02-10
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2;
SELECT * FROM t1;
name city birth hired
......
......@@ -3,7 +3,7 @@
#
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';
SELECT * FROM t1;
ID
......@@ -15,7 +15,7 @@ DROP 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';
INSERT INTO t1 VALUES (10),(20);
ERROR HY000: Got error 122 'Writing FMT files is not implemented yet' from CONNECT
......@@ -25,10 +25,10 @@ DROP TABLE t1;
#
CREATE TABLE t1
(
ID Integer(5) field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n',
SALARY Double(12,2) field_format=' ; %n%f%n'
ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny.txt';
SELECT * FROM t1;
ID NAME DEPNO SALARY
......@@ -38,20 +38,20 @@ ID NAME DEPNO SALARY
DROP TABLE t1;
CREATE TABLE t1
(
ID Integer(5) field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n',
SALARY Double(12,2) field_format=' ; %n%f%n'
ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt';
SELECT * FROM t1;
ERROR HY000: Got error 122 'Bad format line 2 field 3 of t1' from CONNECT
DROP TABLE t1;
CREATE TABLE t1
(
ID Integer(5) field_format=' %n%d%n',
NAME Char(16) field_format=' , ''%n%[^'']%m',
DEPNO Integer(4) field_format=''' , #%n%d%m',
SALARY Double(12,2) field_format=' ; %n%f%n'
ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=' , ''%n%[^'']%m',
DEPNO Integer(4) not null field_format=''' , #%n%d%m',
SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt';
SELECT * FROM t1;
ID NAME DEPNO SALARY
......
#
# 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:
Warning 1105 No table_type. Was set to DOS
Warning 1105 No file name. Table will use t1.DOS
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
`a` int(11) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `table_type`=DOS
DROP TABLE t1;
......@@ -15,7 +15,7 @@ brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5),
formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
SELECT * FROM t1 LIMIT 10;
......
CREATE TABLE dir1 (
spath VARCHAR(256) flag=1,
fname VARCHAR(256),
ftype CHAR(4),
size DOUBLE(12,0) flag=5
spath VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256) NOT NULL,
ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*';
CREATE TABLE t1
(
a INT,
b CHAR(10)
a INT NOT NULL,
b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(10) DEFAULT NULL
`a` int(11) NOT NULL,
`b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec'
SELECT * FROM t1;
a b
......@@ -46,14 +46,14 @@ t1vec2 40
DROP TABLE t1;
CREATE TABLE t1
(
a INT,
b CHAR(10)
a INT NOT NULL,
b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(10) DEFAULT NULL
`a` int(11) NOT NULL,
`b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec'
SELECT * FROM t1;
a b
......@@ -99,8 +99,8 @@ Warning 1105 The current version of CONNECT did not check what you changed in AL
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(10) DEFAULT NULL
`a` int(11) NOT NULL,
`b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=yes
INSERT INTO t1 VALUES (4,'test04');
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
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(10) DEFAULT NULL
`a` int(11) NOT NULL,
`b` char(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 MAX_ROWS=10 `TABLE_TYPE`=VEC `FILE_NAME`='t1vec' `READONLY`=no
INSERT INTO t1 VALUES (4,'test04');
UPDATE t1 SET b='test04a' WHERE a=4;
......
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat
--echo #
--echo # Testing errors
--echo #
CREATE TABLE t1
(
ID INT
) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb)
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
SELECT * FROM t1;
--error ER_GET_ERRMSG
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);
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing READONLY tables
--echo #
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat';
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ALTER TABLE t1 READONLY=NO;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
SELECT * FROM t1;
ALTER TABLE t1 READONLY=YES;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
DROP TABLE t1;
--echo #
--echo # Testing that the underlying file is created
--echo #
CREATE TABLE t1
(
c CHAR(4) NOT NULL FIELD_FORMAT='C'
) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat';
INSERT INTO t1 VALUES (10),(20),(300),(4000);
SELECT * FROM t1;
DROP TABLE t1;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/Testbal.dat
--remove_file $MYSQLD_DATADIR/test/bin2.dat
let $MYSQLD_DATADIR= `select @@datadir`;
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat
--echo #
--echo # Testing errors
--echo #
CREATE TABLE t1
(
ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb)
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
SELECT * FROM t1;
--error ER_GET_ERRMSG
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);
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing READONLY tables
--echo #
CREATE TABLE t1
(
fig INT(4) NOT NULL FIELD_FORMAT='C',
name CHAR(10) not null,
birth DATE NOT NULL,
id CHAR(5) NOT NULL FIELD_FORMAT='S',
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
dept INT(4) NOT NULL FIELD_FORMAT='S'
) ENGINE=CONNECT TABLE_TYPE=BIN READONLY=Yes FILE_NAME='Testbal.dat';
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
ALTER TABLE t1 READONLY=NO;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
SELECT * FROM t1;
ALTER TABLE t1 READONLY=YES;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777);
DROP TABLE t1;
--echo #
--echo # Testing that the underlying file is created
--echo #
CREATE TABLE t1
(
c CHAR(4) NOT NULL FIELD_FORMAT='C'
) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat';
INSERT INTO t1 VALUES (10),(20),(300),(4000);
SELECT * FROM t1;
DROP TABLE t1;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/Testbal.dat
--remove_file $MYSQLD_DATADIR/test/bin2.dat
This diff is collapsed.
This diff is collapsed.
let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE t1 (
path VARCHAR(256) flag=1,
fname VARCHAR(256),
ftype CHAR(4),
size DOUBLE(12,0) flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'
OPTION_LIST='subdir=1';
--replace_result $MYSQLD_DATADIR DATADIR/
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/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt
--mkdir $MYSQLD_DATADIR/test/subdir/
--copy_file $MYSQLD_DATADIR/test/boys.txt $MYSQLD_DATADIR/test/subdir/boys2.txt
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
ALTER TABLE t1 OPTION_LIST='subdir=0';
SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
# TODO: add a better error message
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('','','','');
DROP TABLE t1;
# TODO: automatically add columns
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
#
# TODO: this fails on Linux
#
#CREATE TABLE t1 t1 (
# DRIVE CHAR(2),
# PATH VARCHAR(256),
# FNAME VARCHAR(256),
# FTYPE CHAR(4),
# SIZE DOUBLE(12,0) flag=5,
# MODIFIED datetime
#) engine=CONNECT table_type=DIR file_name='*.txt';
#SELECT * FROM t1;
#DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/subdir/boys2.txt
--rmdir $MYSQLD_DATADIR/test/subdir/
--remove_file $MYSQLD_DATADIR/test/boys.txt
--remove_file $MYSQLD_DATADIR/test/boyswin.txt
let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE t1 (
path VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256) NOT NULL,
ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'
OPTION_LIST='subdir=1';
--replace_result $MYSQLD_DATADIR DATADIR/
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/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt
--mkdir $MYSQLD_DATADIR/test/subdir/
--copy_file $MYSQLD_DATADIR/test/boys.txt $MYSQLD_DATADIR/test/subdir/boys2.txt
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
ALTER TABLE t1 OPTION_LIST='subdir=0';
SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size;
# TODO: add a better error message
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('','','','');
DROP TABLE t1;
# TODO: automatically add columns
--error ER_UNKNOWN_ERROR
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
#
# TODO: this fails on Linux
#
#CREATE TABLE t1 t1 (
# DRIVE CHAR(2),
# PATH VARCHAR(256),
# FNAME VARCHAR(256),
# FTYPE CHAR(4),
# SIZE DOUBLE(12,0) flag=5,
# MODIFIED datetime
#) engine=CONNECT table_type=DIR file_name='*.txt';
#SELECT * FROM t1;
#DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/subdir/boys2.txt
--rmdir $MYSQLD_DATADIR/test/subdir/
--remove_file $MYSQLD_DATADIR/test/boys.txt
--remove_file $MYSQLD_DATADIR/test/boyswin.txt
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/boys.txt $MYSQLD_DATADIR/test/boys.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt
--echo #
--echo # Testing errors
--echo #
CREATE TABLE t1
(
ID INT
) Engine=CONNECT TABLE_TYPE=DOS FILE_NAME='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb)
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing READONLY tables
--echo #
CREATE TABLE t1
(
id INT
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
ALTER TABLE t1 READONLY=1;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (20);
--error ER_GET_ERRMSG
UPDATE t1 SET id=20 WHERE id=10;
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE id=10;
--error ER_GET_ERRMSG
TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (20);
SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.txt
--echo #
--echo # Testing manual examples
--echo #
CREATE TABLE t1
(
number CHAR(4) not null,
location CHAR(15) flag=5,
director CHAR(5) flag=20,
function CHAR(12) flag=26,
name CHAR(22) flag=38
) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='dept.dat';
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' ENDING=1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12),
city char(12),
birth date date_format='DD/MM/YYYY',
hired date date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2;
SELECT * FROM t1;
DROP TABLE t1;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/dept.dat
--remove_file $MYSQLD_DATADIR/test/boys.txt
--remove_file $MYSQLD_DATADIR/test/boyswin.txt
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/boys.txt $MYSQLD_DATADIR/test/boys.txt
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/boyswin.txt $MYSQLD_DATADIR/test/boyswin.txt
--echo #
--echo # Testing errors
--echo #
CREATE TABLE t1
(
ID INT NOT NULL
) Engine=CONNECT TABLE_TYPE=DOS FILE_NAME='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb)
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing READONLY tables
--echo #
CREATE TABLE t1
(
id INT NOT NULL
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
INSERT INTO t1 VALUES (10);
SELECT * FROM t1;
ALTER TABLE t1 READONLY=1;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (20);
--error ER_GET_ERRMSG
UPDATE t1 SET id=20 WHERE id=10;
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE id=10;
--error ER_GET_ERRMSG
TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=0;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (20);
SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.txt
--echo #
--echo # Testing manual examples
--echo #
CREATE TABLE t1
(
number CHAR(4) not null,
location CHAR(15) NOT NULL flag=5,
director CHAR(5) NOT NULL flag=20,
function CHAR(12) NOT NULL flag=26,
name CHAR(22) NOT NULL flag=38
) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='dept.dat';
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' ENDING=1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
name char(12) not null,
city char(12) not null,
birth date not null date_format='DD/MM/YYYY',
hired date not null date_format='DD/MM/YYYY' flag=36
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2;
SELECT * FROM t1;
DROP TABLE t1;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/dept.dat
--remove_file $MYSQLD_DATADIR/test/boys.txt
--remove_file $MYSQLD_DATADIR/test/boyswin.txt
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/funny2.txt $MYSQLD_DATADIR/test/funny2.txt
--echo #
--echo # Testing errors
--echo #
CREATE TABLE t1
(
ID INT field_format=' %n%d%n'
) Engine=CONNECT table_type=FMT file_name='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb)
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing update on FMT tables
--echo #
CREATE TABLE t1
(
id INT field_format=' %n%d%n'
) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt';
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (10),(20);
# TODO:
#--error ER_GET_ERRMSG
#UPDATE t1 SET id=20;
#TRUNCATE TABLE t1;
#DELETE FROM t1 WHERE id=10;
#SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.txt
--echo #
--echo # Testing manual examples
--echo #
CREATE TABLE t1
(
ID Integer(5) field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n',
SALARY Double(12,2) field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny.txt';
SELECT * FROM t1;
DROP TABLE t1;
#
# TODO: shoudn't a warning instead of error be returned on bad format?
#
CREATE TABLE t1
(
ID Integer(5) field_format=' %n%d%n',
NAME Char(16) field_format=" , '%n%[^']%n'",
DEPNO Integer(4) field_format=' , #%n%d%n',
SALARY Double(12,2) field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt';
--error ER_GET_ERRMSG
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
ID Integer(5) field_format=' %n%d%n',
NAME Char(16) field_format=' , ''%n%[^'']%m',
DEPNO Integer(4) field_format=''' , #%n%d%m',
SALARY Double(12,2) field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt';
SELECT * FROM t1;
--error ER_GET_ERRMSG
UPDATE t1 SET SALARY=1234;
# TODO: this query crashes
# UPDATE t1 SET SALARY=1234 WHERE ID=56;
DELETE FROM t1 WHERE ID=56;
SELECT * FROM t1;
DROP TABLE t1;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/funny.txt
--remove_file $MYSQLD_DATADIR/test/funny2.txt
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/funny2.txt $MYSQLD_DATADIR/test/funny2.txt
--echo #
--echo # Testing errors
--echo #
CREATE TABLE t1
(
ID INT NOT NULL field_format=' %n%d%n'
) Engine=CONNECT table_type=FMT file_name='nonexistent.txt';
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
# TODO: check why this is needed for Windows
--replace_result Open(rt) Open(rb)
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Testing update on FMT tables
--echo #
CREATE TABLE t1
(
id INT NOT NULL field_format=' %n%d%n'
) ENGINE=CONNECT TABLE_TYPE=FMT FILE_NAME='t1.txt';
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (10),(20);
# TODO:
#--error ER_GET_ERRMSG
#UPDATE t1 SET id=20;
#TRUNCATE TABLE t1;
#DELETE FROM t1 WHERE id=10;
#SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1.txt
--echo #
--echo # Testing manual examples
--echo #
CREATE TABLE t1
(
ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny.txt';
SELECT * FROM t1;
DROP TABLE t1;
#
# TODO: shoudn't a warning instead of error be returned on bad format?
#
CREATE TABLE t1
(
ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=" , '%n%[^']%n'",
DEPNO Integer(4) not null field_format=' , #%n%d%n',
SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt';
--error ER_GET_ERRMSG
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1
(
ID Integer(5) not null field_format=' %n%d%n',
NAME Char(16) not null field_format=' , ''%n%[^'']%m',
DEPNO Integer(4) not null field_format=''' , #%n%d%m',
SALARY Double(12,2) not null field_format=' ; %n%f%n'
) Engine=CONNECT table_type=FMT file_name='funny2.txt';
SELECT * FROM t1;
--error ER_GET_ERRMSG
UPDATE t1 SET SALARY=1234;
# TODO: this query crashes
# UPDATE t1 SET SALARY=1234 WHERE ID=56;
DELETE FROM t1 WHERE ID=56;
SELECT * FROM t1;
DROP TABLE t1;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/funny.txt
--remove_file $MYSQLD_DATADIR/test/funny2.txt
--echo #
--echo # Testing features not specific to any TABLE_TYPE
--echo #
CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
#INSERT INTO t1 VALUES (10);
#SELECT * FROM t1;
#--error ER_GET_ERRMSG
#ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
#SELECT * FROM t1;
#DROP TABLE t1;
--echo #
--echo # Testing features not specific to any TABLE_TYPE
--echo #
CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=NON_EXISTING;
SHOW CREATE TABLE t1;
DROP TABLE t1;
#CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.txt';
#INSERT INTO t1 VALUES (10);
#SELECT * FROM t1;
#--error ER_GET_ERRMSG
#ALTER TABLE t1 TABLE_TYPE=NON_EXISTING;
#SELECT * FROM t1;
#DROP TABLE t1;
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/sexe.csv $MYSQLD_DATADIR/test/sexe.csv
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sitmat.csv $MYSQLD_DATADIR/test/sitmat.csv
--echo #
--echo # Testing indexing
--echo #
CREATE TABLE t1
(
matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5),
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) from t1;
--echo #
--echo # Testing file mapping
--echo #
ALTER TABLE t1 MAPPED=yes;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) FROM t1;
--echo #
--echo # Test the indexes (made when creating the table)
--echo #
SELECT * FROM t1 WHERE matricule = '0091';
SELECT * FROM t1 WHERE nom = 'FOCH';
SELECT * FROM t1 WHERE nom = 'FOCH' and prenom = 'DENIS';
--echo #
--echo # Testing UPDATE
--echo #
UPDATE t1 SET aanais = aanais + 16;
UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year);
UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year);
SELECT * FROM t1 WHERE nom = 'FOCH';
--echo #
--echo # Testing JOIN
--echo #
create table t2
(
sexe INT(1) KEY,
genre CHAR(8) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sexe.csv' SEP_CHAR=';' ENDING=2;
SELECT * FROM t2;
SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10;
--echo #
--echo # Another table
--echo #
CREATE TABLE t3 (
sitmat CHAR(1) KEY,
situation CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sitmat.csv' SEP_CHAR=';' ENDING=2;
SELECT * FROM t3;
SELECT nom, prenom, genre, situation FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 WHERE nom = 'FOCH';
--echo #
--echo # Testing DELETE
--echo #
DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/emp.txt
--remove_file $MYSQLD_DATADIR/test/sexe.csv
--remove_file $MYSQLD_DATADIR/test/sitmat.csv
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/sexe.csv $MYSQLD_DATADIR/test/sexe.csv
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/sitmat.csv $MYSQLD_DATADIR/test/sitmat.csv
--echo #
--echo # Testing indexing
--echo #
CREATE TABLE t1
(
matricule INT(4) KEY NOT NULL field_format='Z',
nom VARCHAR(16) NOT NULL,
prenom VARCHAR(20) NOT NULL,
sexe SMALLINT(1) NOT NULL COMMENT 'sexe 1:M 2:F',
aanais INT(4) NOT NULL,
mmnais INT(2) NOT NULL,
ddentree DATE NOT NULL date_format='YYYYMM',
ddnom DATE NOT NULL date_format='YYYYMM',
brut INT(5) NOT NULL,
net DOUBLE(8,2) NOT NULL,
service INT(2) NOT NULL,
sitmat CHAR(1) NOT NULL,
formation CHAR(5) NOT NULL,
INDEX NP(nom,prenom)
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='emp.txt' ENDING=2;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) from t1;
--echo #
--echo # Testing file mapping
--echo #
ALTER TABLE t1 MAPPED=yes;
SELECT * FROM t1 LIMIT 10;
SELECT SUM(brut) FROM t1;
--echo #
--echo # Test the indexes (made when creating the table)
--echo #
SELECT * FROM t1 WHERE matricule = '0091';
SELECT * FROM t1 WHERE nom = 'FOCH';
SELECT * FROM t1 WHERE nom = 'FOCH' and prenom = 'DENIS';
--echo #
--echo # Testing UPDATE
--echo #
UPDATE t1 SET aanais = aanais + 16;
UPDATE t1 SET ddentree = adddate(ddentree, interval 16 year);
UPDATE t1 SET ddnom = adddate(ddnom, interval 16 year);
SELECT * FROM t1 WHERE nom = 'FOCH';
--echo #
--echo # Testing JOIN
--echo #
create table t2
(
sexe INT(1) KEY,
genre CHAR(8) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sexe.csv' SEP_CHAR=';' ENDING=2;
SELECT * FROM t2;
SELECT nom, prenom, genre FROM t1 NATURAL JOIN t2 LIMIT 10;
--echo #
--echo # Another table
--echo #
CREATE TABLE t3 (
sitmat CHAR(1) KEY,
situation CHAR(12) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='sitmat.csv' SEP_CHAR=';' ENDING=2;
SELECT * FROM t3;
SELECT nom, prenom, genre, situation FROM t1 NATURAL JOIN t2 NATURAL JOIN t3 WHERE nom = 'FOCH';
--echo #
--echo # Testing DELETE
--echo #
DELETE FROM t1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
#
# Clean up
#
--remove_file $MYSQLD_DATADIR/test/emp.txt
--remove_file $MYSQLD_DATADIR/test/sexe.csv
--remove_file $MYSQLD_DATADIR/test/sitmat.csv
let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE dir1 (
spath VARCHAR(256) flag=1,
fname VARCHAR(256),
ftype CHAR(4),
size DOUBLE(12,0) flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*';
CREATE TABLE t1
(
a INT,
b CHAR(10)
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec';
SHOW CREATE TABLE t1;
# Testing SELECT on empty file
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT * FROM t1;
INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
SELECT * FROM t1;
SELECT a FROM t1;
SELECT b FROM t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1vec1
--remove_file $MYSQLD_DATADIR/test/t1vec2
CREATE TABLE t1
(
a INT,
b CHAR(10)
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10;
SHOW CREATE TABLE t1;
# Testing SELECTs on empty file
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT * FROM t1;
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT a FROM t1;
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT b FROM t1;
INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
SELECT * FROM t1;
SELECT a FROM t1;
SELECT b FROM t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
--echo #
--echo # Testing READONLY
--echo #
ALTER TABLE t1 READONLY=yes;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (4,'test04');
--error ER_GET_ERRMSG
UPDATE t1 SET b='test04' WHERE a=3;
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE a=3;
--error ER_GET_ERRMSG
TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=no;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (4,'test04');
UPDATE t1 SET b='test04a' WHERE a=4;
DELETE FROM t1 WHERE a=0;
SELECT * FROM t1;
TRUNCATE TABLE t1;
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1vec
--remove_file $MYSQLD_DATADIR/test/t1vec.blk
--echo #
--echo # Clean up
--echo #
DROP TABLE dir1;
let $MYSQLD_DATADIR= `select @@datadir`;
CREATE TABLE dir1 (
spath VARCHAR(256) NOT NULL flag=1,
fname VARCHAR(256) NOT NULL,
ftype CHAR(4) NOT NULL,
size DOUBLE(12,0) NOT NULL flag=5
) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*vec*';
CREATE TABLE t1
(
a INT NOT NULL,
b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec';
SHOW CREATE TABLE t1;
# Testing SELECT on empty file
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT * FROM t1;
INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
SELECT * FROM t1;
SELECT a FROM t1;
SELECT b FROM t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1vec1
--remove_file $MYSQLD_DATADIR/test/t1vec2
CREATE TABLE t1
(
a INT NOT NULL,
b CHAR(10) NOT NULL
) ENGINE=CONNECT TABLE_TYPE=VEC FILE_NAME='t1vec' MAX_ROWS=10;
SHOW CREATE TABLE t1;
# Testing SELECTs on empty file
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT * FROM t1;
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT a FROM t1;
--replace_regex /Open.rb. error 2 on .*\/test\/t1vec/Open(rb) error 2 on DATADIR\/test\/t1vec/
SELECT b FROM t1;
INSERT INTO t1 VALUES (0,'test01'), (1,'test01'), (2,'test02'), (3,'test03');
SELECT * FROM t1;
SELECT a FROM t1;
SELECT b FROM t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
--echo #
--echo # Testing READONLY
--echo #
ALTER TABLE t1 READONLY=yes;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES (4,'test04');
--error ER_GET_ERRMSG
UPDATE t1 SET b='test04' WHERE a=3;
--error ER_GET_ERRMSG
DELETE FROM t1 WHERE a=3;
--error ER_GET_ERRMSG
TRUNCATE TABLE t1;
ALTER TABLE t1 READONLY=no;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (4,'test04');
UPDATE t1 SET b='test04a' WHERE a=4;
DELETE FROM t1 WHERE a=0;
SELECT * FROM t1;
TRUNCATE TABLE t1;
SELECT fname, ftype, size FROM dir1 ORDER BY fname, ftype;
SELECT * FROM t1;
DROP TABLE t1;
--remove_file $MYSQLD_DATADIR/test/t1vec
--remove_file $MYSQLD_DATADIR/test/t1vec.blk
--echo #
--echo # Clean up
--echo #
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