diff options
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 2c970e4c7ca..1ffe3d12139 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -44,13 +44,6 @@ pthread_key(LEX*,THR_LEX); #define TOCK_NAME_LENGTH 24 /* - Map to default keyword characters. This is used to test if an identifer - is 'simple', in which case we don't have to do any character set conversions - on it -*/ -uchar *bin_ident_map= my_charset_bin.ident_map; - -/* The following data is based on the latin1 character set, and is only used when comparing keywords */ @@ -556,13 +549,9 @@ int yylex(void *arg, void *yythd) else #endif { - result_state= bin_ident_map[c] ? IDENT : IDENT_QUOTED; - while (ident_map[c=yyGet()]) - { - /* If not simple character, mark that we must convert it */ - if (!bin_ident_map[c]) - result_state= IDENT_QUOTED; - } + for (result_state= c; ident_map[c= yyGet()]; result_state|= c); + /* If there were non-ASCII characters, mark that we must convert */ + result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; } length= (uint) (lex->ptr - lex->tok_start)-1; if (lex->ignore_space) @@ -664,12 +653,11 @@ int yylex(void *arg, void *yythd) } else #endif - while (ident_map[c = yyGet()]) - { - /* If not simple character, mark that we must convert it */ - if (!bin_ident_map[c]) - result_state= IDENT_QUOTED; - } + { + for (result_state=0; ident_map[c= yyGet()]; result_state|= c); + /* If there were non-ASCII characters, mark that we must convert */ + result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; + } if (c == '.' && ident_map[yyPeek()]) lex->next_state=MY_LEX_IDENT_SEP;// Next is '.' @@ -943,13 +931,11 @@ int yylex(void *arg, void *yythd) We should now be able to handle: [(global | local | session) .]variable_name */ - result_state= IDENT; - while (ident_map[c=yyGet()]) - { - /* If not simple character, mark that we must convert it */ - if (!bin_ident_map[c]) - result_state= IDENT_QUOTED; - } + + for (result_state= 0; ident_map[c= yyGet()]; result_state|= c); + /* If there were non-ASCII characters, mark that we must convert */ + result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT; + if (c == '.') lex->next_state=MY_LEX_IDENT_SEP; length= (uint) (lex->ptr - lex->tok_start)-1; @@ -1017,7 +1003,7 @@ void st_select_lex::init_query() ref_pointer_array= 0; select_n_having_items= 0; prep_where= 0; - explicit_limit= 0; + subquery_in_having= explicit_limit= 0; first_execution= 1; first_cond_optimization= 1; } |