summaryrefslogtreecommitdiff
path: root/sql
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
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')
-rw-r--r--sql/item.cc2
-rw-r--r--sql/sql_load.cc19
2 files changed, 18 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc
index b2aca750475..fed3ffcc080 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3248,7 +3248,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
&counter, REPORT_EXCEPT_NOT_FOUND,
&not_used);
- if (res != not_found_item && (*res)->type() == Item::FIELD_ITEM)
+ if (res != (Item **)not_found_item && (*res)->type() == Item::FIELD_ITEM)
{
set_field((*((Item_field**)res))->field);
return 0;
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)