summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-10-26 14:11:08 -0700
committerunknown <jimw@mysql.com>2005-10-26 14:11:08 -0700
commit47a60b53c6899e99f472303f62550b91bc8e3799 (patch)
treefefa272de0f1166e382e2d25bf1cebb7265a19d6 /sql/sql_load.cc
parent3cee9661307178e7fd0c19f12930bffa4b8336b9 (diff)
parent1a5218a0630d1489f2d226b6a417962dd2e12565 (diff)
downloadmariadb-git-47a60b53c6899e99f472303f62550b91bc8e3799.tar.gz
Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into mysql.com:/home/jimw/my/mysql-5.0-clean mysql-test/std_data/loaddata_dq.dat: Merge rename: mysql-test/std_data/loaddata5.dat -> mysql-test/std_data/loaddata_dq.dat sql/item.cc: Auto merged sql/sql_load.cc: Auto merged mysql-test/r/loaddata.result: Resolve conflicts, deal with renamed dat file mysql-test/t/loaddata.test: Resolve conflicts, deal with renamed dat file
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)