1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

fixed bug #2592 mysqldump doesn't quote "tricky" names correctly

This commit is contained in:
vva@eagle.mysql.r18.ru
2004-02-07 02:22:12 +04:00
parent d4d097689b
commit cc1ff3c479
4 changed files with 47 additions and 13 deletions

View File

@ -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);