mirror of
https://github.com/MariaDB/server.git
synced 2025-07-11 15:22:09 +03:00
Merge work:/home/bk/mysql-4.1 into hundin.mysql.fi:/my/mysql-4.1
sql/sql_lex.cc: Auto merged sql/sql_yacc.yy: Auto merged
This commit is contained in:
@ -220,7 +220,7 @@ static int find_keyword(LEX *lex, uint len, bool function)
|
|||||||
|
|
||||||
/* make a copy of token before ptr and set yytoklen */
|
/* make a copy of token before ptr and set yytoklen */
|
||||||
|
|
||||||
LEX_STRING get_token(LEX *lex,uint length)
|
static LEX_STRING get_token(LEX *lex,uint length)
|
||||||
{
|
{
|
||||||
LEX_STRING tmp;
|
LEX_STRING tmp;
|
||||||
yyUnget(); // ptr points now after last token char
|
yyUnget(); // ptr points now after last token char
|
||||||
@ -229,8 +229,27 @@ LEX_STRING get_token(LEX *lex,uint length)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return an unescaped text literal without quotes */
|
static LEX_STRING get_quoted_token(LEX *lex,uint length, char quote)
|
||||||
/* Fix sometimes to do only one scan of the string */
|
{
|
||||||
|
LEX_STRING tmp;
|
||||||
|
byte *from, *to, *end;
|
||||||
|
yyUnget(); // ptr points now after last token char
|
||||||
|
tmp.length=lex->yytoklen=length;
|
||||||
|
tmp.str=(char*) lex->thd->alloc(tmp.length+1);
|
||||||
|
for (from= (byte*) lex->tok_start, to= tmp.str, end= to+length ; to != end ;)
|
||||||
|
{
|
||||||
|
if ((*to++= *from++) == quote)
|
||||||
|
from++; // Skip double quotes
|
||||||
|
}
|
||||||
|
*to= 0; // End null for safety
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Return an unescaped text literal without quotes
|
||||||
|
Fix sometimes to do only one scan of the string
|
||||||
|
*/
|
||||||
|
|
||||||
static char *get_text(LEX *lex)
|
static char *get_text(LEX *lex)
|
||||||
{
|
{
|
||||||
@ -667,14 +686,32 @@ int yylex(void *arg, void *yythd)
|
|||||||
lex->ptr += l-1;
|
lex->ptr += l-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
yylval->lex_str=get_token(lex,yyLength());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
while ((c=yyGet()) && state_map[c] != STATE_USER_VARIABLE_DELIMITER &&
|
uint double_quotes= 0;
|
||||||
c != (uchar) NAMES_SEP_CHAR) ;
|
char quote_char= c;
|
||||||
|
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,
|
||||||
|
quote_char);
|
||||||
|
else
|
||||||
|
yylval->lex_str=get_token(lex,yyLength());
|
||||||
}
|
}
|
||||||
yylval->lex_str=get_token(lex,yyLength());
|
|
||||||
if (lex->convert_set)
|
if (lex->convert_set)
|
||||||
lex->convert_set->convert((char*) yylval->lex_str.str,lex->yytoklen);
|
lex->convert_set->convert((char*) yylval->lex_str.str,lex->yytoklen);
|
||||||
if (state_map[c] == STATE_USER_VARIABLE_DELIMITER)
|
if (state_map[c] == STATE_USER_VARIABLE_DELIMITER)
|
||||||
|
@ -1071,6 +1071,8 @@ type:
|
|||||||
$$=FIELD_TYPE_TINY; }
|
$$=FIELD_TYPE_TINY; }
|
||||||
| BOOL_SYM { Lex->length=(char*) "1";
|
| BOOL_SYM { Lex->length=(char*) "1";
|
||||||
$$=FIELD_TYPE_TINY; }
|
$$=FIELD_TYPE_TINY; }
|
||||||
|
| BOOLEAN_SYM { Lex->length=(char*) "1";
|
||||||
|
$$=FIELD_TYPE_TINY; }
|
||||||
| char '(' NUM ')' opt_binary { Lex->length=$3.str;
|
| char '(' NUM ')' opt_binary { Lex->length=$3.str;
|
||||||
$$=FIELD_TYPE_STRING; }
|
$$=FIELD_TYPE_STRING; }
|
||||||
| char opt_binary { Lex->length=(char*) "1";
|
| char opt_binary { Lex->length=(char*) "1";
|
||||||
|
Reference in New Issue
Block a user