From c7724872d85cebf07df3380757cf7259f9116682 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 7 Jul 2008 10:00:08 -0600 Subject: Bug#26030 (Parsing fails for stored routine w/multi-statement execution enabled) Before this fix, the lexer and parser would treat the ';' character as a different token (either ';' or END_OF_INPUT), based on convoluted logic, which failed in simple cases where a stored procedure is implemented as a single statement, and used in a multi query. With this fix: - the character ';' is always parsed as a ';' token in the lexer, - parsing multi queries is implemented in the parser, in the 'query:' rules, - the value of thd->client_capabilities, which is the capabilities negotiated between the client and the server during bootstrap, is immutable and not arbitrarily modified during parsing (which was the root cause of the bug) --- sql/sql_lex.cc | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6bfcd982b04..a1bfc3edc6c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1010,21 +1010,8 @@ int MYSQLlex(void *arg, void *yythd) yySkip(); return (SET_VAR); case MY_LEX_SEMICOLON: // optional line terminator - if (yyPeek()) - { - if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS) && - !lip->stmt_prepare_mode) - { - lex->safe_to_cache_query= 0; - lip->found_semicolon= lip->ptr; - thd->server_status|= SERVER_MORE_RESULTS_EXISTS; - lip->next_state= MY_LEX_END; - return (END_OF_INPUT); - } - state= MY_LEX_CHAR; // Return ';' - break; - } - /* fall true */ + state= MY_LEX_CHAR; // Return ';' + break; case MY_LEX_EOL: if (lip->ptr >= lip->end_of_query) { @@ -1039,7 +1026,7 @@ int MYSQLlex(void *arg, void *yythd) case MY_LEX_END: lip->next_state=MY_LEX_END; return(0); // We found end of input last time - + /* Actually real shouldn't start with . but allow them anyhow */ case MY_LEX_REAL_OR_POINT: if (my_isdigit(cs,yyPeek())) -- cgit v1.2.1