diff options
Diffstat (limited to 'mysql-test/t/csv.test')
-rw-r--r-- | mysql-test/t/csv.test | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index cdf274190dd..ea949f463c9 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1819,4 +1819,84 @@ repair table t1; select * from t1 limit 1; drop table t1; +# +# Bug #40814 CSV engine does not parse \X characters when they occur in unquoted fields +# + +--echo # +--echo # Test for the following cases +--echo # 1) integers and strings enclosed in quotes +--echo # 2) integers and strings not enclosed in quotes +--echo # 3) \X characters with quotes +--echo # 4) \X characters outside quotes +--echo # + +CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv; + +--echo # remove the already existing .CSV file if any +--remove_file $MYSQLD_DATADIR/test/t1.CSV + +--echo # create the .CSV file that contains the hard-coded data used in +--echo # testing +--write_file $MYSQLD_DATADIR/test/t1.CSV +1,"integer sans quotes" +1,string sans quotes +1,quotes"in between" strings +"1",Integer with quote and string with no quote +1,"escape sequence \n \" \\ \r \a within quotes" +1,escape sequence \n \" \\ \r \a without quotes +EOF +--cat_file $MYSQLD_DATADIR/test/t1.CSV + +--echo # select from the table in which the data has been filled in using +--echo # the hard-coded .CSV file +SELECT * FROM t1; + +DROP TABLE t1; + +--echo # Test for the case when a field begins with a quote, but does not end in a +--echo # quote. +--echo # Note: This results in an error. + +CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv; + +--echo # remove the already existing .CSV file if any +--remove_file $MYSQLD_DATADIR/test/t1.CSV + +--echo # create the .CSV file that contains the hard-coded data used in +--echo # testing +--write_file $MYSQLD_DATADIR/test/t1.CSV +1,"string only at the beginning quotes +EOF +--cat_file $MYSQLD_DATADIR/test/t1.CSV + +--echo # select from the table in which the data has been filled in using +--echo # the hard-coded .CSV file +--error ER_CRASHED_ON_USAGE +SELECT * FROM t1; + +DROP TABLE t1; + +--echo # Test for the case when a field ends with a quote, but does not begin in a +--echo # quote. +--echo # Note: This results in an error. + +CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv; + +--echo # remove the already existing .CSV file if any +--remove_file $MYSQLD_DATADIR/test/t1.CSV + +--echo # create the .CSV file that contains the hard-coded data used in +--echo # testing +--write_file $MYSQLD_DATADIR/test/t1.CSV +1,string with only ending quotes" +EOF +--cat_file $MYSQLD_DATADIR/test/t1.CSV + +--echo # select from the table in which the data has been filled in using +--echo # the hard-coded .CSV file +--error ER_CRASHED_ON_USAGE +SELECT * FROM t1; + +DROP TABLE t1; --echo End of 5.1 tests |