Commit d6f2f7c5 authored by Olivier Bertrand's avatar Olivier Bertrand

- Changing CRLF line endings to LF only.

modified:
  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 964a423d
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
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) 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`;
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 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/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 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
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 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;
--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) 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`;
--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) 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;
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