diff options
author | Alexander Barkov <bar@mariadb.org> | 2018-02-08 19:06:25 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2018-02-08 19:06:25 +0400 |
commit | 3cad31f2a758f797ef0acac5625d0e007ecbce93 (patch) | |
tree | 73c054636c4858b2a51eddf7eaa653746d67524e /sql/sql_prepare.cc | |
parent | 560b9895d413bdfedda0a0ca871a635858990c05 (diff) | |
parent | 5c057b3fef3aa92cfadbd63043799b430132a494 (diff) | |
download | mariadb-git-3cad31f2a758f797ef0acac5625d0e007ecbce93.tar.gz |
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 2fd0f9c0531..52200798cf3 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -167,20 +167,6 @@ public: uint param_count; uint last_errno; uint flags; - /* - The value of thd->select_number at the end of the PREPARE phase. - - The issue is: each statement execution opens VIEWs, which may cause - select_lex objects to be created, and select_number values to be assigned. - - On the other hand, PREPARE assigns select_number values for triggers and - subqueries. - - In order for select_number values from EXECUTE not to conflict with - select_number values from PREPARE, we keep the number and set it at each - execution. - */ - uint select_number_after_prepare; char last_error[MYSQL_ERRMSG_SIZE]; my_bool iterations; my_bool start_param; @@ -3796,9 +3782,9 @@ void Prepared_statement::cleanup_stmt() DBUG_ENTER("Prepared_statement::cleanup_stmt"); DBUG_PRINT("enter",("stmt: %p", this)); thd->restore_set_statement_var(); + thd->rollback_item_tree_changes(); cleanup_items(free_list); thd->cleanup_after_query(); - thd->rollback_item_tree_changes(); DBUG_VOID_RETURN; } @@ -3883,6 +3869,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) if (! (lex= new (mem_root) st_lex_local)) DBUG_RETURN(TRUE); + stmt_lex= lex; if (set_db(thd->db, thd->db_length)) DBUG_RETURN(TRUE); @@ -3988,8 +3975,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) trans_rollback_implicit(thd); thd->mdl_context.release_transactional_locks(); } - - select_number_after_prepare= thd->select_number; /* Preserve CHANGE MASTER attributes */ lex_end_stage1(lex); @@ -4126,7 +4111,6 @@ Prepared_statement::execute_loop(String *expanded_query, */ DBUG_ASSERT(thd->free_list == NULL); - thd->select_number= select_number_after_prepare; /* Check if we got an error when sending long data */ if (state == Query_arena::STMT_ERROR) { @@ -4269,7 +4253,6 @@ Prepared_statement::execute_bulk_loop(String *expanded_query, #ifndef DBUG_OFF Item *free_list_state= thd->free_list; #endif - thd->select_number= select_number_after_prepare; thd->set_bulk_execution((void *)this); /* Check if we got an error when sending long data */ if (state == Query_arena::STMT_ERROR) |