Commit d0f6e9a8 authored by Alexander Barkov's avatar Alexander Barkov

Adding a test for TABLE_TYPE=DIR

added:
  mysql-test/suite/connect/r/dir.result
  mysql-test/suite/connect/t/dir.test
parent 516e8af8
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';
SELECT * FROM t1;
path fname ftype size
SELECT fname, ftype, size FROM t1;
fname ftype size
boys .txt 282
boyswin .txt 288
boys2 .txt 282
ALTER TABLE t1 OPTION_LIST='subdir=0';
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
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DIR `FILE_NAME`='*.txt' `OPTION_LIST`='subdir=0'
SELECT fname, ftype, size FROM t1;
fname ftype size
boys .txt 282
boyswin .txt 288
INSERT INTO t1 VALUES ('','','','');
ERROR HY000: Got error 174 'COLBLK SetBuffer: undefined Access Method' from CONNECT
DROP TABLE t1;
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt';
ERROR 42000: A table must have at least 1 column
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;
ALTER TABLE t1 OPTION_LIST='subdir=0';
SHOW CREATE TABLE t1;
--replace_result $MYSQLD_DATADIR DATADIR/
SELECT fname, ftype, size FROM t1;
# TODO: add a better error message
--error ER_GET_ERRMSG
INSERT INTO t1 VALUES ('','','','');
DROP TABLE t1;
# TODO: automatically add columns
--error ER_TABLE_MUST_HAVE_COLUMNS
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
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