summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorjimw@mysql.com <>2005-10-26 14:11:08 -0700
committerjimw@mysql.com <>2005-10-26 14:11:08 -0700
commit607c12973732d27fb1b9a4543ed126ae7b3b5c5f (patch)
treefefa272de0f1166e382e2d25bf1cebb7265a19d6 /sql/sql_load.cc
parent0eacb6fb35bb5e2c341a2fa1d060eceaa64c05a7 (diff)
parent7510c45423af35a11a6c8942501e4a0a8d0c3da7 (diff)
downloadmariadb-git-607c12973732d27fb1b9a4543ed126ae7b3b5c5f.tar.gz
Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into mysql.com:/home/jimw/my/mysql-5.0-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 ff2be0ae6fb..37342d47d78 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -1014,8 +1014,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)