diff options
author | V Narayanan <v.narayanan@sun.com> | 2009-12-03 17:18:43 +0530 |
---|---|---|
committer | V Narayanan <v.narayanan@sun.com> | 2009-12-03 17:18:43 +0530 |
commit | a5aa3b3c919ab53cdcaa657a6446051348371245 (patch) | |
tree | 93acd035717949e4567c97f47e5ade78fe2f641c /mysql-test/r | |
parent | 40ec012c905be0262ba5c36bbccfa0db0105e31f (diff) | |
download | mariadb-git-a5aa3b3c919ab53cdcaa657a6446051348371245.tar.gz |
Bug#40814 CSV engine does not parse \X characters when they occur in unquoted fields
When a .CSV file for table in the CSV engine contains
\X characters as part of unquoted fields, e.g.
2,naraya\nan
\n is not interpreted as a new line (it is however interpreted as a
newline in a quoted field).
The old algorithm copied the entire value for a unquoted field without
parsing the \X characters.
The new algorithm adds the capability to handle \X characters in the
unquoted fields of a .CSV file.
mysql-test/r/csv.result:
Bug#40814 CSV engine does not parse \X characters when they occur in unquoted fields
Contains additional test output corresponding to the new
tests added.
mysql-test/t/csv.test:
Bug#40814 CSV engine does not parse \X characters when they occur in unquoted fields
Contains additional tests for testing the behaviour of the CSV
storage engine when the fields are not enclosed in quotes and
contain \X characters.
storage/csv/ha_tina.cc:
Bug#40814 CSV engine does not parse \X characters when they occur in unquoted fields
Changes the parsing logic of the rows in a CSV file, to parse
\X characters that might be present in the unquoted fields.
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/csv.result | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 4b96f5a5ed0..97996b484bb 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5407,4 +5407,60 @@ test.t1 repair status OK select * from t1 limit 1; a drop table t1; +# +# Test for the following cases +# 1) integers and strings enclosed in quotes +# 2) integers and strings not enclosed in quotes +# 3) \X characters with quotes +# 4) \X characters outside quotes +# +CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv; +# remove the already existing .CSV file if any +# create the .CSV file that contains the hard-coded data used in +# testing +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 +# select from the table in which the data has been filled in using +# the hard-coded .CSV file +SELECT * FROM t1; +c1 c2 +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 + " \
\a within quotes +1 escape sequence + " \
\a without quotes +DROP TABLE t1; +# Test for the case when a field begins with a quote, but does not end in a +# quote. +# Note: This results in an error. +CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv; +# remove the already existing .CSV file if any +# create the .CSV file that contains the hard-coded data used in +# testing +1,"string only at the beginning quotes +# select from the table in which the data has been filled in using +# the hard-coded .CSV file +SELECT * FROM t1; +ERROR HY000: Table 't1' is marked as crashed and should be repaired +DROP TABLE t1; +# Test for the case when a field ends with a quote, but does not begin in a +# quote. +# Note: This results in an error. +CREATE TABLE t1(c1 INT NOT NULL, c2 VARCHAR(50) NOT NULL) ENGINE=csv; +# remove the already existing .CSV file if any +# create the .CSV file that contains the hard-coded data used in +# testing +1,string with only ending quotes" +# select from the table in which the data has been filled in using +# the hard-coded .CSV file +SELECT * FROM t1; +ERROR HY000: Table 't1' is marked as crashed and should be repaired +DROP TABLE t1; End of 5.1 tests |