Commit 9aa88d50 authored by Alexander Barkov's avatar Alexander Barkov

Adding tests for TABLE_TYPE=FIX

added:
  mysql-test/suite/connect/r/fix.result
  mysql-test/suite/connect/std_data/boys.txt
  mysql-test/suite/connect/std_data/boyswin.txt
  mysql-test/suite/connect/std_data/dept.dat
  mysql-test/suite/connect/t/fix.test
parent 06dd5ea4
#
# Testing errors
#
CREATE TABLE t1
(
ID INT
) Engine=CONNECT TABLE_TYPE=DOS FILE_NAME='nonexistent.txt';
SELECT * FROM t1;
ID
Warnings:
Warning 1105 Open(rb) error 2 on DATADIR/test/nonexistent.txt: No such file or directory
DROP TABLE t1;
#
# Testing manual examples
#
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;
number location director function name
0318 KINGSTON 70012 SALES Bank/Insurance
0021 ARMONK 87777 CHQ Corporate headquarter
0319 HARRISON 40567 SALES Federal Administration
2452 POUGHKEEPSIE 31416 DEVELOPMENT Research & development
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;
name city birth hired
John Boston 2 1986-01-05 2010-06-02
Henry Boston 0 1987-06-07 2008-04-01
George San Jose 1 1981-07-31 2010-06-02
Sam Chicago 2 1979-11-02 2007-10-10
James Dallas 1 1992-05-03 2009-12-14
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
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boys.txt' LRECL=47 ENDING=1;
SELECT * FROM t1;
name city birth hired
John Boston 2 1986-01-05 2010-06-02
Henry Boston 0 1987-06-07 2008-04-01
George San Jose 1 1981-07-31 2010-06-02
Sam Chicago 2 1979-11-02 2007-10-10
James Dallas 1 1992-05-03 2009-12-14
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
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' ENDING=2;
SELECT * FROM t1;
name city birth hired
John Boston 2 1986-01-05 2010-06-02
Henry Boston 0 1987-06-07 2008-04-01
George San Jose 1 1981-07-31 2010-06-02
Sam Chicago 2 1979-11-02 2007-10-10
James Dallas 1 1992-05-03 2009-12-14
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
) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='boyswin.txt' LRECL=47 ENDING=2;
SELECT * FROM t1;
name city birth hired
John Boston 2 1986-01-05 2010-06-02
Henry Boston 0 1987-06-07 2008-04-01
George San Jose 1 1981-07-31 2010-06-02
Sam Chicago 2 1979-11-02 2007-10-10
James Dallas 1 1992-05-03 2009-12-14
Bill Boston 1 1986-09-01 2008-02-10
DROP TABLE t1;
John Boston 25/01/1986 02/06/2010
Henry Boston 07/06/1987 01/04/2008
George San Jose 10/08/1981 02/06/2010
Sam Chicago 22/11/1979 10/10/2007
James Dallas 13/05/1992 14/12/2009
Bill Boston 11/09/1986 10/02/2008
John Boston 25/01/1986 02/06/2010
Henry Boston 07/06/1987 01/04/2008
George San Jose 10/08/1981 02/06/2010
Sam Chicago 22/11/1979 10/10/2007
James Dallas 13/05/1992 14/12/2009
Bill Boston 11/09/1986 10/02/2008
0318 KINGSTON 70012 SALES Bank/Insurance
0021 ARMONK 87777 CHQ Corporate headquarter
0319 HARRISON 40567 SALES Federal Administration
2452 POUGHKEEPSIE 31416 DEVELOPMENT Research & development
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 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
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