summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2008-09-17 08:34:00 +0200
committerTatiana A. Nurnberg <azundris@mysql.com>2008-09-17 08:34:00 +0200
commit2f082d9d427059a2a7cbcaf1d575cdd25c1376c2 (patch)
tree25c09e0355770b938cf680fcd6d4dd8c8c89065a /sql/sql_load.cc
parentebd3a6e452c13510d13f82b8fe83850ae41f1b5c (diff)
downloadmariadb-git-2f082d9d427059a2a7cbcaf1d575cdd25c1376c2.tar.gz
Bug#37114: sql_mode NO_BACKSLASH_ESCAPES does not work properly with LOAD DATA INFILE
NO_BACKSLASH_ESCAPES was not heeded in LOAD DATA INFILE and SELECT INTO OUTFILE. It is now. mysql-test/r/loaddata.result: Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in INFILE/OUTFILE, and that dump/restore cycles work! mysql-test/t/loaddata.test: Show that SQL-mode NO_BACKSLASH_ESCAPES is heeded in INFILE/OUTFILE, and that dump/restore cycles work! sql/sql_class.cc: Add function to enquire whether ESCAPED BY was given. When doing SELECT...OUTFILE, use ESCAPED BY if specifically given; otherwise use sensible default value depending on SQL-mode features NO_BACKSLASH_ESCAPES. sql/sql_class.h: Add function to enquire whether ESCAPED BY was given. sql/sql_load.cc: When doing LOAD DATA INFILE, use ESCAPED BY if specifically given; otherwise use sensible default value depending on SQL-mode features NO_BACKSLASH_ESCAPES.
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index e9fd04dff15..5477610bb05 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -325,7 +325,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
bzero((char*) &info,sizeof(info));
info.ignore= ignore;
info.handle_duplicates=handle_duplicates;
- info.escape_char=escaped->length() ? (*escaped)[0] : INT_MAX;
+ info.escape_char= (escaped->length() && (ex->escaped_given() ||
+ !(thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)))
+ ? (*escaped)[0] : INT_MAX;
READ_INFO read_info(file,tot_length,
ex->cs ? ex->cs : thd->variables.collation_database,