mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge mysql.com:/home/pem/work/mysql-4.1
into mysql.com:/home/pem/work/mysql-5.0-merge
This commit is contained in:
@ -203,6 +203,23 @@ static int find_keyword(LEX *lex, uint len, bool function)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Check if name is a keyword
|
||||
|
||||
SYNOPSIS
|
||||
is_keyword()
|
||||
name checked name
|
||||
len length of checked name
|
||||
|
||||
RETURN VALUES
|
||||
0 name is a keyword
|
||||
1 name isn't a keyword
|
||||
*/
|
||||
|
||||
bool is_keyword(const char *name, uint len)
|
||||
{
|
||||
return get_hash_symbol(name,len,0)!=0;
|
||||
}
|
||||
|
||||
/* make a copy of token before ptr and set yytoklen */
|
||||
|
||||
@ -215,6 +232,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;
|
||||
@ -442,7 +466,6 @@ inline static uint int_token(const char *str,uint length)
|
||||
return ((uchar) str[-1] <= (uchar) cmp[-1]) ? smaller : bigger;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
yylex remember the following states from the following yylex()
|
||||
|
||||
@ -692,37 +715,14 @@ int yylex(void *arg, void *yythd)
|
||||
uint double_quotes= 0;
|
||||
char quote_char= c; // Used char
|
||||
lex->tok_start=lex->ptr; // Skip first `
|
||||
while ((c=yyGet()))
|
||||
{
|
||||
#ifdef USE_MB
|
||||
if (use_mb(cs))
|
||||
{
|
||||
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;
|
||||
if ((l = my_ismbchar(cs,
|
||||
(const char *)lex->ptr-1,
|
||||
(const char *)lex->end_of_query)) == 0)
|
||||
break;
|
||||
lex->ptr += l-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if (my_mbcharlen(cs, c) == 1)
|
||||
#endif
|
||||
{
|
||||
while ((c=yyGet()))
|
||||
{
|
||||
if (c == (uchar) NAMES_SEP_CHAR)
|
||||
break; /* Old .frm format can't handle this char */
|
||||
if (c == quote_char)
|
||||
{
|
||||
if (yyPeek() != quote_char)
|
||||
@ -731,9 +731,18 @@ int yylex(void *arg, void *yythd)
|
||||
double_quotes++;
|
||||
continue;
|
||||
}
|
||||
if (c == (uchar) NAMES_SEP_CHAR)
|
||||
break;
|
||||
}
|
||||
#ifdef USE_MB
|
||||
else
|
||||
{
|
||||
int l;
|
||||
if ((l = my_ismbchar(cs,
|
||||
(const char *)lex->ptr-1,
|
||||
(const char *)lex->end_of_query)) == 0)
|
||||
break;
|
||||
lex->ptr += l-1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (double_quotes)
|
||||
yylval->lex_str=get_quoted_token(lex,yyLength() - double_quotes,
|
||||
@ -915,8 +924,13 @@ int yylex(void *arg, void *yythd)
|
||||
}
|
||||
/* fall true */
|
||||
case MY_LEX_EOL:
|
||||
lex->next_state=MY_LEX_END; // Mark for next loop
|
||||
return(END_OF_INPUT);
|
||||
if (lex->ptr >= lex->end_of_query)
|
||||
{
|
||||
lex->next_state=MY_LEX_END; // Mark for next loop
|
||||
return(END_OF_INPUT);
|
||||
}
|
||||
state=MY_LEX_CHAR;
|
||||
break;
|
||||
case MY_LEX_END:
|
||||
lex->next_state=MY_LEX_END;
|
||||
return(0); // We found end of input last time
|
||||
|
Reference in New Issue
Block a user