summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-02-17 16:16:58 -0800
committerunknown <jimw@mysql.com>2005-02-17 16:16:58 -0800
commit90cc9c6bb60c60dbf6e603a0cb5d9ae736a9a906 (patch)
tree76f459723b9f122eb50373fe7c42ffc72f277131 /sql/sql_lex.cc
parent4c5a3914b8924ebc72c6c4233c18d2e3f1ad118b (diff)
parent2b69b4ae4f0b29a0eceb72a404b7f52a67748875 (diff)
downloadmariadb-git-90cc9c6bb60c60dbf6e603a0cb5d9ae736a9a906.tar.gz
Merge
BitKeeper/triggers/post-commit: Auto merged mysql-test/r/lowercase_table2.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/variables.test: Auto merged sql/mysql_priv.h: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/system_mysql_db.result: Update results scripts/mysql_create_system_tables.sh: Merge fix for Bug #7617, making enum fields in grant tables case-insensitive. scripts/mysql_fix_privilege_tables.sql: Merge fix for Bug #7617, and fix additional enum/set columns. sql/sql_acl.cc: Hand-merge due to whitespace change sql/sql_lex.cc: Hand-merge bug fix.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc33
1 files changed, 27 insertions, 6 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 08cf4402b74..9d7b2183f52 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -296,7 +296,18 @@ static char *get_text(LEX *lex)
found_escape=1;
if (lex->ptr == lex->end_of_query)
return 0;
- yySkip();
+#ifdef USE_MB
+ int l;
+ if (use_mb(cs) &&
+ (l = my_ismbchar(cs,
+ (const char *)lex->ptr,
+ (const char *)lex->end_of_query))) {
+ lex->ptr += l;
+ continue;
+ }
+ else
+#endif
+ yySkip();
}
else if (c == sep)
{
@@ -324,6 +335,10 @@ static char *get_text(LEX *lex)
else
{
uchar *to;
+
+ /* Re-use found_escape for tracking state of escapes */
+ found_escape= 0;
+
for (to=start ; str != end ; str++)
{
#ifdef USE_MB
@@ -337,7 +352,8 @@ static char *get_text(LEX *lex)
continue;
}
#endif
- if (!(lex->thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) &&
+ if (!found_escape &&
+ !(lex->thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) &&
*str == '\\' && str+1 != end)
{
switch(*++str) {
@@ -364,15 +380,20 @@ static char *get_text(LEX *lex)
*to++= '\\'; // remember prefix for wildcard
/* Fall through */
default:
- *to++ = *str;
+ found_escape= 1;
+ str--;
break;
}
}
- else if (*str == sep)
- *to++= *str++; // Two ' or "
+ else if (!found_escape && *str == sep)
+ {
+ found_escape= 1;
+ }
else
+ {
*to++ = *str;
-
+ found_escape= 0;
+ }
}
*to=0;
lex->yytoklen=(uint) (to-start);