summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/event_data_objects.cc2
-rw-r--r--sql/log_event.cc16
-rw-r--r--sql/log_event_old.cc5
-rw-r--r--sql/rpl_gtid.cc2
-rw-r--r--sql/rpl_rli.cc2
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_parse.cc17
-rw-r--r--sql/sql_parse.h1
-rw-r--r--sql/sql_prepare.cc8
-rw-r--r--sql/wsrep_thd.cc2
10 files changed, 24 insertions, 33 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index ca8439aa386..571652de861 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1337,7 +1337,7 @@ Event_job_data::execute(THD *thd, bool drop)
DBUG_ENTER("Event_job_data::execute");
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
/*
MySQL parser currently assumes that current database is either
diff --git a/sql/log_event.cc b/sql/log_event.cc
index aa349960ea7..017220e2bdd 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -5796,7 +5796,7 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
*/
lex_start(thd);
thd->lex->local_file= local_fname;
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
/*
We test replicate_*_db rules. Note that we have already prepared
@@ -6539,7 +6539,7 @@ Gtid_log_event::do_apply_event(rpl_group_info *rgi)
thd->variables.gtid_domain_id= this->domain_id;
thd->variables.gtid_seq_no= this->seq_no;
rgi->gtid_ev_flags2= flags2;
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
if (opt_gtid_strict_mode && opt_bin_log && opt_log_slave_updates)
{
@@ -7347,9 +7347,9 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
mysql.gtid_slave_pos table with the GTID of the current transaction.
Therefore, it acts much like a normal SQL statement, so we need to do
- mysql_reset_thd_for_next_command() as if starting a new statement.
+ THD::reset_for_next_command() as if starting a new statement.
*/
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
/*
Record any GTID in the same transaction, so slave state is transactionally
consistent.
@@ -8578,7 +8578,7 @@ int Append_block_log_event::do_apply_event(rpl_group_info *rgi)
as the present method does not call mysql_parse().
*/
lex_start(thd);
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
/* old copy may exist already */
mysql_file_delete(key_file_log_event_data, fname, MYF(0));
if ((fd= mysql_file_create(key_file_log_event_data,
@@ -9640,18 +9640,18 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
Lock_tables() reads the contents of thd->lex, so they must be
initialized.
- We also call the mysql_reset_thd_for_next_command(), since this
+ We also call the THD::reset_for_next_command(), since this
is the logical start of the next "statement". Note that this
call might reset the value of current_stmt_binlog_format, so
we need to do any changes to that value after this function.
*/
delete_explain_query(thd->lex);
lex_start(thd);
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
/*
The current statement is just about to begin and
has not yet modified anything. Note, all.modified is reset
- by mysql_reset_thd_for_next_command.
+ by THD::reset_for_next_command().
*/
thd->transaction.stmt.modified_non_trans_table= FALSE;
thd->transaction.stmt.m_unsafe_rollback_flags&= ~THD_TRANS::DID_WAIT;
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 3fbf44bba85..3ad5c2177f5 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -24,7 +24,6 @@
#include "sql_base.h" // close_tables_for_reopen
#include "key.h" // key_copy
#include "lock.h" // mysql_unlock_tables
-#include "sql_parse.h" // mysql_reset_thd_for_next_command
#include "rpl_rli.h"
#include "rpl_utility.h"
#endif
@@ -82,14 +81,14 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi)
Lock_tables() reads the contents of ev_thd->lex, so they must be
initialized.
- We also call the mysql_reset_thd_for_next_command(), since this
+ We also call the THD::reset_for_next_command(), since this
is the logical start of the next "statement". Note that this
call might reset the value of current_stmt_binlog_format, so
we need to do any changes to that value after this function.
*/
delete_explain_query(thd->lex);
lex_start(ev_thd);
- mysql_reset_thd_for_next_command(ev_thd);
+ ev_thd->reset_for_next_command();
/*
This is a row injection, so we flag the "statement" as
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index 2e453b8dcf8..30f73b673f9 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -533,7 +533,7 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
}
if (!in_statement)
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
DBUG_EXECUTE_IF("gtid_inject_record_gtid",
{
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 2c98cc681f5..b8e44b5634e 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1485,7 +1485,7 @@ rpl_load_gtid_slave_state(THD *thd)
goto end;
array_inited= true;
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
tlist.init_one_table(STRING_WITH_LEN("mysql"),
rpl_gtid_slave_state_table_name.str,
diff --git a/sql/sql_class.h b/sql/sql_class.h
index fb563281d88..357558cf54b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2685,7 +2685,7 @@ public:
can not continue. In particular, disables activation of
CONTINUE or EXIT handlers of stored routines.
Reset in the end of processing of the current user request, in
- @see mysql_reset_thd_for_next_command().
+ @see THD::reset_for_next_command().
*/
bool is_fatal_error;
/**
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 5eca972def3..a66e436ea9c 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1593,7 +1593,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break;
}
packet= arg_end + 1;
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
lex_start(thd);
/* Must be before we init the table list. */
if (lower_case_table_names)
@@ -6723,15 +6723,8 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
(prepared or conventional). It is not called by substatements of
routines.
- @todo Remove mysql_reset_thd_for_next_command and only use the
- member function.
-
@todo Call it after we use THD for queries, not before.
*/
-void mysql_reset_thd_for_next_command(THD *thd)
-{
- thd->reset_for_next_command();
-}
void THD::reset_for_next_command()
{
@@ -7005,7 +6998,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
if (thd->wsrep_conflict_state == ABORTED ||
thd->wsrep_conflict_state == CERT_FAILURE)
{
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
thd->killed= NOT_KILLED;
if (is_autocommit &&
thd->lex->sql_command != SQLCOM_SELECT &&
@@ -7101,13 +7094,13 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
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()
+ - THD::reset_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_start(thd);
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
if (query_cache_send_result_to_client(thd, rawbuf, length) <= 0)
{
@@ -7221,7 +7214,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *rawbuf, uint length)
if (!(error= parser_state.init(thd, rawbuf, length)))
{
lex_start(thd);
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
if (!parse_sql(thd, & parser_state, NULL, true) &&
all_tables_not_ok(thd, lex->select_lex.table_list.first))
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 5e1d867347c..76e1b7a797a 100644
--- a/sql/sql_parse.h
+++ b/sql/sql_parse.h
@@ -88,7 +88,6 @@ bool alloc_query(THD *thd, const char *packet, uint packet_length);
void mysql_init_select(LEX *lex);
void mysql_parse(THD *thd, char *rawbuf, uint length,
Parser_state *parser_state);
-void mysql_reset_thd_for_next_command(THD *thd);
bool mysql_new_select(LEX *lex, bool move_down);
void create_select_for_variable(const char *var_name);
void create_table_set_open_action_and_adjust_tables(LEX *lex);
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 9c2aaa36bc8..31a352f3455 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2309,7 +2309,7 @@ void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length)
DBUG_PRINT("prep_query", ("%s", packet));
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
if (! (stmt= new Prepared_statement(thd)))
goto end; /* out of memory: error is set in Sql_alloc */
@@ -2700,7 +2700,7 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
packet+= 9; /* stmt_id + 5 bytes of flags */
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
if (!(stmt= find_prepared_statement(thd, stmt_id)))
{
@@ -2799,7 +2799,7 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
DBUG_ENTER("mysqld_stmt_fetch");
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
status_var_increment(thd->status_var.com_stmt_fetch);
if (!(stmt= find_prepared_statement(thd, stmt_id)))
@@ -2859,7 +2859,7 @@ void mysqld_stmt_reset(THD *thd, char *packet)
DBUG_ENTER("mysqld_stmt_reset");
/* First of all clear possible warnings from the previous command */
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
status_var_increment(thd->status_var.com_stmt_reset);
if (!(stmt= find_prepared_statement(thd, stmt_id)))
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 7ef31171846..2baee3a252d 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -192,7 +192,7 @@ void wsrep_replay_transaction(THD *thd)
thd->wsrep_conflict_state= REPLAYING;
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
- mysql_reset_thd_for_next_command(thd);
+ thd->reset_for_next_command();
thd->killed= NOT_KILLED;
close_thread_tables(thd);
if (thd->locked_tables_mode && thd->lock)