diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-02-06 14:50:50 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-02-06 14:50:50 +0100 |
commit | 4771ae4b22d2bdef0aafc563570c71d4636a2493 (patch) | |
tree | d115bd7c68b1e6feab68ff6fcd547e0c86c79296 /sql/sql_prepare.cc | |
parent | 60f51af755ea9d07c20a596ba21de184816fa265 (diff) | |
parent | 0c25e58db6b045df92c209d396031cac5b528bbf (diff) | |
download | mariadb-git-4771ae4b22d2bdef0aafc563570c71d4636a2493.tar.gz |
Merge branch 'github/10.1' into 10.2
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 16c386e5e8f..3e1dcc22acd 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; @@ -3848,9 +3834,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; } @@ -3935,6 +3921,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); @@ -4040,8 +4027,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); @@ -4178,7 +4163,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) { @@ -4321,7 +4305,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) |