summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorjimw@mysql.com <>2005-10-21 17:57:51 -0700
committerjimw@mysql.com <>2005-10-21 17:57:51 -0700
commit2d018862fa87b897bcf0e63edcb67f4d1649521f (patch)
treecea4796a7b3ab7f6b02ae382afb690e76669aa80 /sql/sql_load.cc
parent721873f7cda9587e40a461887a5b6bc6b698f2d8 (diff)
parentdab880274afbae01571257feebb819d94b861c01 (diff)
downloadmariadb-git-2d018862fa87b897bcf0e63edcb67f4d1649521f.tar.gz
Merge mysql.com:/home/jimw/my/mysql-4.1-11203
into mysql.com:/home/jimw/my/mysql-4.1-clean
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 4d09da70ef7..3b7c6608aef 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -806,8 +806,23 @@ int READ_INFO::read_field()
*to++= (byte) escape_char;
goto found_eof;
}
- *to++ = (byte) unescape((char) chr);
- continue;
+ /*
+ When escape_char == enclosed_char, we treat it like we do for
+ handling quotes in SQL parsing -- you can double-up the
+ escape_char to include it literally, but it doesn't do escapes
+ like \n. This allows: LOAD DATA ... ENCLOSED BY '"' ESCAPED BY '"'
+ with data like: "fie""ld1", "field2"
+ */
+ if (escape_char != enclosed_char || chr == escape_char)
+ {
+ *to++ = (byte) unescape((char) chr);
+ continue;
+ }
+ else
+ {
+ PUSH(chr);
+ chr= escape_char;
+ }
}
#ifdef ALLOW_LINESEPARATOR_IN_STRINGS
if (chr == line_term_char)