diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-02-07 02:22:12 +0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-02-07 02:22:12 +0400 |
commit | a54adfc3ab4d6fcb20570202d33495e2b6ffd613 (patch) | |
tree | b5e79ad184f94abc9ba94243a4ca063089ed6fc5 /sql/sql_lex.cc | |
parent | 150c99dffe2737ef4de7534bf297ff6943612cd0 (diff) | |
download | mariadb-git-a54adfc3ab4d6fcb20570202d33495e2b6ffd613.tar.gz |
fixed bug #2592 mysqldump doesn't quote "tricky" names correctly
mysql-test/r/mysqldump.result:
added test for
bug #2592 mysqldump doesn't quote "tricky" names correctly
please note, output's still looking wrong because of bug #2593
it will be fixed when fix for bug #2593 will be pushed
mysql-test/t/mysqldump.test:
added test for bug
#2592 mysqldump doesn't quote "tricky" names correctly
sql/sql_lex.cc:
fixed processing of multibyte quoted variables
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 65c958093bd..017b5677ced 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -667,13 +667,24 @@ int yylex(void *arg, void *yythd) case MY_LEX_USER_VARIABLE_DELIMITER: { - char delim= c; // Used char + uint double_quotes= 0; + char quote_char= c; // Used char lex->tok_start=lex->ptr; // Skip first ` #ifdef USE_MB if (use_mb(cs)) { - while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR) + while ((c= yyGet())) { + if (c == quote_char) + { + if (yyPeek() != quote_char) + break; + c= yyGet(); + double_quotes++; + continue; + } + if (c == (uchar) NAMES_SEP_CHAR) + break; if (my_mbcharlen(cs, c) > 1) { int l; @@ -684,13 +695,10 @@ int yylex(void *arg, void *yythd) lex->ptr += l-1; } } - yylval->lex_str=get_token(lex,yyLength()); } else #endif { - uint double_quotes= 0; - char quote_char= c; while ((c=yyGet())) { if (c == quote_char) @@ -704,13 +712,13 @@ int yylex(void *arg, void *yythd) if (c == (uchar) NAMES_SEP_CHAR) break; } - if (double_quotes) - yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes, - quote_char); - else - yylval->lex_str=get_token(lex,yyLength()); } - if (c == delim) + if (double_quotes) + yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes, + quote_char); + else + yylval->lex_str=get_token(lex,yyLength()); + if (c == quote_char) yySkip(); // Skip end ` lex->next_state= MY_LEX_START; return(IDENT_QUOTED); |