summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-02-12 11:12:16 +0200
committerunknown <bell@sanja.is.com.ua>2004-02-12 11:12:16 +0200
commit0f0ca5e35bdd97602f6fbf912737823200835c25 (patch)
tree392565075b89db4af8addc318bdbdbf2349ebce8 /sql/sql_lex.cc
parent4b37cf65f7d9d83005fd73dc05fae39639303f24 (diff)
parentf2753fe9ac04edac1e8b968d29e77178b4e8c0a5 (diff)
downloadmariadb-git-0f0ca5e35bdd97602f6fbf912737823200835c25.tar.gz
merge
sql/item.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_prepare.cc: Auto merged
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc59
1 files changed, 30 insertions, 29 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 4bc04ddf9ac..f145a232809 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -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;
@@ -667,32 +674,17 @@ 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 `
+ while ((c=yyGet()))
+ {
#ifdef USE_MB
- if (use_mb(cs))
- {
- while ((c=yyGet()) && c != delim && c != (uchar) NAMES_SEP_CHAR)
- {
- 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;
- }
- }
- yylval->lex_str=get_token(lex,yyLength());
- }
- else
+ if (my_mbcharlen(cs, c) == 1)
#endif
- {
- uint double_quotes= 0;
- char quote_char= c;
- 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)
@@ -701,16 +693,25 @@ int yylex(void *arg, void *yythd)
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);
+#ifdef USE_MB
else
- yylval->lex_str=get_token(lex,yyLength());
+ {
+ 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 (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);