summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 6954ffa3a38..af5dde543d4 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -5350,12 +5350,26 @@ public:
Security_context empty_ctx;
ulonglong client_capabilities;
+ my_bool do_log_bin;
+
Protocol_local(THD *thd_arg, THD *new_thd_arg, ulong prealloc) :
Protocol_text(thd_arg, prealloc),
cur_data(0), first_data(0), data_tail(&first_data), alloc(0),
- new_thd(new_thd_arg)
+ new_thd(new_thd_arg), do_log_bin(FALSE)
{}
+ void set_binlog_vars(my_bool *sav_log_bin)
+ {
+ *sav_log_bin= thd->variables.sql_log_bin;
+ thd->variables.sql_log_bin= do_log_bin;
+ thd->set_binlog_bit();
+ }
+ void restore_binlog_vars(my_bool sav_log_bin)
+ {
+ do_log_bin= thd->variables.sql_log_bin;
+ thd->variables.sql_log_bin= sav_log_bin;
+ thd->set_binlog_bit();
+ }
protected:
bool net_store_data(const uchar *from, size_t length);
bool net_store_data_cs(const uchar *from, size_t length,
@@ -5972,6 +5986,9 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command,
Security_context *ctx_orig= p->thd->security_ctx;
ulonglong cap_orig= p->thd->client_capabilities;
MYSQL_LEX_STRING sql_text;
+ my_bool log_bin_orig;
+ p->set_binlog_vars(&log_bin_orig);
+
DBUG_ASSERT(current_thd == p->thd);
sql_text.str= (char *) arg;
sql_text.length= arg_length;
@@ -5980,6 +5997,7 @@ loc_advanced_command(MYSQL *mysql, enum enum_server_command command,
result= con.execute_direct(p, sql_text);
p->thd->client_capabilities= cap_orig;
p->thd->security_ctx= ctx_orig;
+ p->restore_binlog_vars(log_bin_orig);
}
if (skip_check)
result= 0;
@@ -6139,8 +6157,8 @@ extern "C" MYSQL *mysql_real_connect_local(MYSQL *mysql)
new_thd->query_cache_is_applicable= 0;
new_thd->variables.wsrep_on= 0;
new_thd->client_capabilities= client_flag;
- new_thd->variables.option_bits&= ~OPTION_BIN_LOG;
- new_thd->variables.sql_log_bin_off= 1;
+ new_thd->variables.sql_log_bin= 0;
+ new_thd->set_binlog_bit();
/*
TOSO: decide if we should turn the auditing off
for such threads.