diff options
author | unknown <jcole@tetra.spaceapes.com> | 2001-03-12 18:16:30 -0600 |
---|---|---|
committer | unknown <jcole@tetra.spaceapes.com> | 2001-03-12 18:16:30 -0600 |
commit | ee92b9f634e3ca573ee6c30f87bc8e8714c08827 (patch) | |
tree | 873907f6d77f9c15af35e496f4d8ce9d14bf0dcc /sql/sql_lex.cc | |
parent | c6639098152b68b13aa77709e38c76515304381e (diff) | |
download | mariadb-git-ee92b9f634e3ca573ee6c30f87bc8e8714c08827.tar.gz |
Added SQL_ANSI_MODE.
Docs/manual.texi:
Added News section for 3.23.35, and change notes for SQL_ANSI_MODE.
sql/gen_lex_hash.cc:
Fixed typo.
Updated the values, so the parser can be created.
sql/mysql_priv.h:
Added ``global_state_map'' from sql_lex.cc.
sql/sql_class.h:
Added ``state_map'' to THD. This is a per-thread state map for lex.
sql/sql_lex.cc:
Renamed ``state_map'' to ``global_state_map''.
Changed yylex() to use the new per-thread state map.
sql/sql_parse.cc:
Copy global_state_map into thd->state_map on thread start.
sql/sql_yacc.yy:
Added SQL_ANSI_MODE.
Cleaned up some.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b8d2ee13b0e..f0357b99d70 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -75,7 +75,7 @@ inline int lex_casecmp(const char *s, const char *t, uint len) #include "lex_hash.h" -static uchar state_map[256]; +uchar global_state_map[256]; void lex_init(void) @@ -89,42 +89,49 @@ void lex_init(void) VOID(pthread_key_create(&THR_LEX,NULL)); - /* Fill state_map with states to get a faster parser */ + /* Fill global_state_map with states to get a faster parser */ for (i=0; i < 256 ; i++) { if (isalpha(i)) - state_map[i]=(uchar) STATE_IDENT; + global_state_map[i]=(uchar) STATE_IDENT; else if (isdigit(i)) - state_map[i]=(uchar) STATE_NUMBER_IDENT; + global_state_map[i]=(uchar) STATE_NUMBER_IDENT; #if defined(USE_MB) && defined(USE_MB_IDENT) else if (use_mb(default_charset_info) && my_ismbhead(default_charset_info, i)) - state_map[i]=(uchar) STATE_IDENT; + global_state_map[i]=(uchar) STATE_IDENT; #endif else if (!isgraph(i)) - state_map[i]=(uchar) STATE_SKIP; + global_state_map[i]=(uchar) STATE_SKIP; else - state_map[i]=(uchar) STATE_CHAR; + global_state_map[i]=(uchar) STATE_CHAR; } - state_map[(uchar)'_']=state_map[(uchar)'$']=(uchar) STATE_IDENT; - state_map[(uchar)'\'']=state_map[(uchar)'"']=(uchar) STATE_STRING; - state_map[(uchar)'-']=state_map[(uchar)'+']=(uchar) STATE_SIGNED_NUMBER; - state_map[(uchar)'.']=(uchar) STATE_REAL_OR_POINT; - state_map[(uchar)'>']=state_map[(uchar)'=']=state_map[(uchar)'!']= (uchar) STATE_CMP_OP; - state_map[(uchar)'<']= (uchar) STATE_LONG_CMP_OP; - state_map[(uchar)'&']=state_map[(uchar)'|']=(uchar) STATE_BOOL; - state_map[(uchar)'#']=(uchar) STATE_COMMENT; - state_map[(uchar)';']=(uchar) STATE_COLON; - state_map[(uchar)':']=(uchar) STATE_SET_VAR; - state_map[0]=(uchar) STATE_EOL; - state_map[(uchar)'\\']= (uchar) STATE_ESCAPE; - state_map[(uchar)'/']= (uchar) STATE_LONG_COMMENT; - state_map[(uchar)'*']= (uchar) STATE_END_LONG_COMMENT; - state_map[(uchar)'@']= (uchar) STATE_USER_END; - state_map[(uchar) '`']= (uchar) STATE_USER_VARIABLE_DELIMITER; + global_state_map[(uchar)'_']= + global_state_map[(uchar)'$']=(uchar) STATE_IDENT; + global_state_map[(uchar)'\'']= + global_state_map[(uchar)'"']=(uchar) STATE_STRING; + global_state_map[(uchar)'-']= + global_state_map[(uchar)'+']=(uchar) STATE_SIGNED_NUMBER; + global_state_map[(uchar)'.']=(uchar) STATE_REAL_OR_POINT; + global_state_map[(uchar)'>']= + global_state_map[(uchar)'=']= + global_state_map[(uchar)'!']= (uchar) STATE_CMP_OP; + global_state_map[(uchar)'<']= (uchar) STATE_LONG_CMP_OP; + global_state_map[(uchar)'&']=global_state_map[(uchar)'|']=(uchar) STATE_BOOL; + global_state_map[(uchar)'#']=(uchar) STATE_COMMENT; + global_state_map[(uchar)';']=(uchar) STATE_COLON; + global_state_map[(uchar)':']=(uchar) STATE_SET_VAR; + global_state_map[0]=(uchar) STATE_EOL; + global_state_map[(uchar)'\\']= (uchar) STATE_ESCAPE; + global_state_map[(uchar)'/']= (uchar) STATE_LONG_COMMENT; + global_state_map[(uchar)'*']= (uchar) STATE_END_LONG_COMMENT; + global_state_map[(uchar)'@']= (uchar) STATE_USER_END; + global_state_map[(uchar) '`']= (uchar) STATE_USER_VARIABLE_DELIMITER; + if (thd_startup_options & OPTION_ANSI_MODE) { - state_map[(uchar) '"'] = STATE_USER_VARIABLE_DELIMITER; + global_state_map[(uchar) '"'] = STATE_USER_VARIABLE_DELIMITER; } + DBUG_VOID_RETURN; } @@ -418,6 +425,7 @@ int yylex(void *arg) uint length; enum lex_states state,prev_state; LEX *lex=current_lex; + uchar *state_map = lex->thd->state_map; YYSTYPE *yylval=(YYSTYPE*) arg; lex->yylval=yylval; // The global state |