mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
code review fix
This commit is contained in:
parent
575eeda804
commit
10dd997019
3 changed files with 12 additions and 8 deletions
|
@ -122,7 +122,8 @@ Lex_input_stream::Lex_input_stream(THD *thd,
|
|||
tok_start_prev(NULL),
|
||||
buf(buffer),
|
||||
next_state(MY_LEX_START),
|
||||
found_semicolon(NULL)
|
||||
found_semicolon(NULL),
|
||||
ignore_space(test(thd->variables.sql_mode & MODE_IGNORE_SPACE))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -192,7 +193,6 @@ void lex_start(THD *thd)
|
|||
lex->select_lex.udf_list.empty();
|
||||
lex->current_select= &lex->select_lex;
|
||||
lex->yacc_yyss=lex->yacc_yyvs=0;
|
||||
lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
|
||||
lex->sql_command= lex->orig_sql_command= SQLCOM_END;
|
||||
lex->duplicates= DUP_ERROR;
|
||||
lex->ignore= 0;
|
||||
|
@ -656,7 +656,7 @@ int MYSQLlex(void *arg, void *yythd)
|
|||
}
|
||||
length= (uint) (lip->ptr - lip->tok_start)-1;
|
||||
start= lip->ptr;
|
||||
if (lex->ignore_space)
|
||||
if (lip->ignore_space)
|
||||
{
|
||||
/*
|
||||
If we find a space then this can't be an identifier. We notice this
|
||||
|
|
|
@ -951,6 +951,9 @@ public:
|
|||
|
||||
/** Position of ';' in the stream, to delimit multiple queries. */
|
||||
const char* found_semicolon;
|
||||
|
||||
/** SQL_MODE = IGNORE_SPACE. */
|
||||
bool ignore_space;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1069,7 +1072,7 @@ typedef struct st_lex : public Query_tables_list
|
|||
uint8 create_view_algorithm;
|
||||
uint8 create_view_check;
|
||||
bool drop_if_exists, drop_temporary, local_file, one_shot_set;
|
||||
bool in_comment, ignore_space, verbose, no_write_to_binlog;
|
||||
bool in_comment, verbose, no_write_to_binlog;
|
||||
bool tx_chain, tx_release;
|
||||
/*
|
||||
Special JOIN::prepare mode: changing of query is prohibited.
|
||||
|
|
|
@ -5990,16 +5990,14 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
|
|||
- first, call query_cache_send_result_to_client,
|
||||
- second, if caching failed, initialise the lexical and syntactic parser.
|
||||
The problem is that the query cache depends on a clean initialization
|
||||
of the thd and thd->lex structures, which happen to be implemented
|
||||
by:
|
||||
of (among others) lex->safe_to_cache_query and thd->server_status,
|
||||
which are reset respectively in
|
||||
- lex_start()
|
||||
- mysql_reset_thd_for_next_command()
|
||||
So, initializing the lexical analyser *before* using the query cache
|
||||
is required for the cache to work properly.
|
||||
FIXME: cleanup the dependencies in the code to simplify this.
|
||||
*/
|
||||
Lex_input_stream lip(thd, inBuf, length);
|
||||
thd->m_lip= &lip;
|
||||
lex_start(thd);
|
||||
mysql_reset_thd_for_next_command(thd);
|
||||
|
||||
|
@ -6010,6 +6008,9 @@ void mysql_parse(THD *thd, const char *inBuf, uint length,
|
|||
sp_cache_flush_obsolete(&thd->sp_proc_cache);
|
||||
sp_cache_flush_obsolete(&thd->sp_func_cache);
|
||||
|
||||
Lex_input_stream lip(thd, inBuf, length);
|
||||
thd->m_lip= &lip;
|
||||
|
||||
int err= MYSQLparse(thd);
|
||||
*found_semicolon= lip.found_semicolon;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue