summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2011-05-18 16:27:19 +0300
committerunknown <sanja@askmonty.org>2011-05-18 16:27:19 +0300
commit1177bea2f1cd0c9f887670b65c9a403a26f07d76 (patch)
tree86c61cd5b446c4e6a3fc89470b3e35e806d99924 /sql/sql_lex.cc
parent0da2df248ba5915630d04e7b7335bea409670cd6 (diff)
downloadmariadb-git-1177bea2f1cd0c9f887670b65c9a403a26f07d76.tar.gz
Rewritten patch of percona - switching query cache on and off, removing comments.
client/mysqltest.cc: Column names. mysql-test/r/grant_cache_no_prot.result: fix of text. mysql-test/r/grant_cache_ps_prot.result: Fix of test. mysql-test/r/query_cache.result: Switching on and off query cache. mysql-test/t/query_cache.test: Switching on and off query cache. mysys/charset.c: Fix of parser. sql/handler.cc: thd added to parameters. sql/log_event.cc: thd added to parameters. sql/log_event_old.cc: thd added to parameters. sql/mysql_priv.h: Fixed functions definitions. sql/mysqld.cc: Comments stripping. sql/set_var.cc: Switching on and off query cache. sql/set_var.h: Switching on and off query cache. sql/share/errmsg.txt: New errors. sql/sql_cache.cc: Switching query cache on and off, removing comments. sql/sql_cache.h: thd added to parameters. sql/sql_class.h: Comments stripping. sql/sql_db.cc: thd added to parameters. sql/sql_lex.cc: lex fixed. sql/sql_parse.cc: thd added to parameters.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc59
1 files changed, 31 insertions, 28 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index f1640bf71ed..2368720f84b 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -818,45 +818,48 @@ int MYSQLlex(void *arg, void *yythd)
yylval->lex_str.length=2;
return NULL_SYM;
}
+ /* Fall through */
case MY_LEX_CHAR: // Unknown or single char token
case MY_LEX_SKIP: // This should not happen
- if (c == '-' && lip->yyPeek() == '-' &&
+ if (c != ')')
+ lip->next_state= MY_LEX_START; // Allow signed numbers
+ return((int) c);
+
+ case MY_LEX_MINUS_OR_COMMENT:
+ if (lip->yyPeek() == '-' &&
(my_isspace(cs,lip->yyPeekn(1)) ||
my_iscntrl(cs,lip->yyPeekn(1))))
{
state=MY_LEX_COMMENT;
break;
}
+ lip->next_state= MY_LEX_START; // Allow signed numbers
+ return((int) c);
- if (c != ')')
- lip->next_state= MY_LEX_START; // Allow signed numbers
-
- if (c == ',')
- {
- /*
- Warning:
- This is a work around, to make the "remember_name" rule in
- sql/sql_yacc.yy work properly.
- The problem is that, when parsing "select expr1, expr2",
- the code generated by bison executes the *pre* action
- remember_name (see select_item) *before* actually parsing the
- first token of expr2.
- */
- lip->restart_token();
- }
- else
- {
- /*
- Check for a placeholder: it should not precede a possible identifier
- because of binlogging: when a placeholder is replaced with
- its value in a query for the binlog, the query must stay
- grammatically correct.
- */
- if (c == '?' && lip->stmt_prepare_mode &&
- !ident_map[(uchar) lip->yyPeek()])
+ case MY_LEX_PLACEHOLDER:
+ /*
+ Check for a placeholder: it should not precede a possible identifier
+ because of binlogging: when a placeholder is replaced with
+ its value in a query for the binlog, the query must stay
+ grammatically correct.
+ */
+ lip->next_state= MY_LEX_START; // Allow signed numbers
+ if (lip->stmt_prepare_mode && !ident_map[(uchar) lip->yyPeek()])
return(PARAM_MARKER);
- }
+ return((int) c);
+ case MY_LEX_COMMA:
+ lip->next_state= MY_LEX_START; // Allow signed numbers
+ /*
+ Warning:
+ This is a work around, to make the "remember_name" rule in
+ sql/sql_yacc.yy work properly.
+ The problem is that, when parsing "select expr1, expr2",
+ the code generated by bison executes the *pre* action
+ remember_name (see select_item) *before* actually parsing the
+ first token of expr2.
+ */
+ lip->restart_token();
return((int) c);
case MY_LEX_IDENT_OR_NCHAR: