|
|||||||||||
|
bk commit into 4.1 tree (gshchepa:1.2671) BUG#29294
From: <gshchepa(at)mysql.com>
Date: Fri Jun 29 2007 - 07:40:49 EDT
ChangeSet@1.2671, 2007-06-29 16:40:46+05:00, gshchepa@gleb.loc +4 -0
Fixed bug #29294.
NOTE 1: This is a result of the undocumented feature: the LOAD DATA INFILE recognises 2-byte input sequences like \n, \t, \r and \Z in addition to documented 2-byte sequences: \0 and \N. This feature should be documented (here backspace character is a default ESCAPED BY character, in the real-life example it may be any ESCAPED BY character).
NOTE 2, changed behaviour:
mysql-test/r/loaddata.result@1.18, 2007-06-29 16:38:46+05:00, gshchepa@gleb.loc +64 -1 Update test case for bug #29294. mysql-test/t/loaddata.test@1.11, 2007-06-29 16:38:42+05:00, gshchepa@gleb.loc +37 -1 Update test case for bug #29294.
sql/sql_class.cc@1.215, 2007-06-29 16:37:16+05:00, gshchepa@gleb.loc +5 -1
Fixed bug #29294.
sql/sql_class.h@1.294, 2007-06-29 16:34:41+05:00, gshchepa@gleb.loc +9 -0
Fixed bug #29294.
diff -Nrup a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result --- a/mysql-test/r/loaddata.result 2005-10-22 07:54:29 +05:00@@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a date, b date, c date not null, d date); load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','; Warnings: @@ -85,3 +85,66 @@ field1 field2 a"b cd"ef a"b c"d"e drop table t1; +CREATE TABLE t1 ( +id INT AUTO_INCREMENT PRIMARY KEY, +c1 VARCHAR(255) +); +CREATE TABLE t2 ( +id INT, +c2 VARCHAR(255) +); +INSERT INTO t1 (c1) VALUES +('r'), ('rr'), ('rrr'), ('rrrr'), +('.r'), ('.rr'), ('.rrr'), ('.rrrr'), +('r.'), ('rr.'), ('rrr.'), ('rrrr.'), +('.r.'), ('.rr.'), ('.rrr.'), ('.rrrr.'), +('\r'), ('\\rr'), ('\\\rr'), ('\\\\rr'); +SELECT * FROM t1; +id c1 +1 r +2 rr +3 rrr +4 rrrr +5 .r +6 .rr +7 .rrr +8 .rrrr +9 r. +10 rr. +11 rrr. +12 rrrr. +13 .r. +14 .rr. +15 .rrr. +16 .rrrr. +17 +18 \rr +19 \r +20 \\rr +SELECT * INTO OUTFILE 'MYSQL_TEST_DIR/var/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1; +r1r rrrr +r2r rrrrrr +r3r rrrrrrrr +r4r rrrrrrrrrr +r5r r.rrr +r6r r.rrrrr +r7r r.rrrrrrr +r8r r.rrrrrrrrr +r9r rrr.r +r10r rrrrr.r +r11r rrrrrrr.r +r12r rrrrrrrrr.r +r13r r.rr.r +r14r r.rrrr.r +r15r r.rrrrrr.r +r16r r.rrrrrrrr.r +r17r rr +r18r r\\rrrrr +r19r r\\rrr +r20r r\\\\rrrrr +LOAD DATA INFILE 'MYSQL_TEST_DIR/var/tmp/t1' INTO TABLE t2 FIELDS ENCLOSED BY 'r'; +SELECT t1.id, c1, c2 FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE c1 != c2; +id c1 c2 +SELECT t1.id, c1, c2 FROM t1 RIGHT JOIN t2 ON t1.id=t2.id WHERE c1 != c2; +id c1 c2 +DROP TABLE t1,t2; diff -Nrup a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test --- a/mysql-test/t/loaddata.test 2005-10-22 07:54:29 +05:00@@ -3,7 +3,7 @@ #
--disable_warnings
create table t1 (a date, b date, c date not null, d date);
@@ -66,5 +66,41 @@ create table t1 (a varchar(20), b varcha
load data infile '../../std_data/loaddata5.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
select * from t1;
# End of 4.1 tests
--- a/sql/sql_class.cc 2007-03-20 21:59:23 +04:00 + is_ambiguous_field_sep= strchr(ESCAPE_CHARS, field_sep_char); line_sep_char= (exchange->line_term->length() ?
(*exchange->line_term)[0] : INT_MAX);
if (!field_term_length)
(int) *pos == line_sep_char || !*pos)
{
char tmp_buff[2];
- tmp_buff[0]= escape_char;
@@ -1224,9 +1224,18 @@ public:
}; +#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescaped
bool fixed_row_size;
-- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Fri Jun 29 07:40:21 2007 This archive was generated by hypermail 2.1.8 : Fri Jun 29 2007 - 07:50:03 EDT |
||||||||||
|
|||||||||||