code cleanup of processing MY_LEX_USER_VARIABLE_DELIMITER

in sql/sql_lex.cc
parent da8f78a0
......@@ -193,6 +193,13 @@ static LEX_STRING get_token(LEX *lex,uint length)
return tmp;
}
/*
todo:
There are no dangerous charsets in mysql for function
get_quoted_token yet. But it should be fixed in the
future to operate multichar strings (like ucs2)
*/
static LEX_STRING get_quoted_token(LEX *lex,uint length, char quote)
{
LEX_STRING tmp;
......@@ -670,22 +677,25 @@ int yylex(void *arg, void *yythd)
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()))
{
while ((c= yyGet()))
#ifdef USE_MB
if (my_mbcharlen(cs, c) == 1)
#endif
{
if (c == (uchar) NAMES_SEP_CHAR)
break; /* Old .frm format can't handle this char */
if (c == quote_char)
{
if (yyPeek() != quote_char)
break;
c= yyGet();
c=yyGet();
double_quotes++;
continue;
}
if (c == (uchar) NAMES_SEP_CHAR)
break;
if (my_mbcharlen(cs, c) > 1)
}
#ifdef USE_MB
else
{
int l;
if ((l = my_ismbchar(cs,
......@@ -694,24 +704,7 @@ int yylex(void *arg, void *yythd)
break;
lex->ptr += l-1;
}
}
}
else
#endif
{
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 (double_quotes)
yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment