summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorGuangbao Ni <gni@mysql.com>2009-03-05 18:39:02 +0000
committerGuangbao Ni <gni@mysql.com>2009-03-05 18:39:02 +0000
commit4f0f021c3387d621a3334c97ff3a0ee394ced040 (patch)
tree4a34d85213232465f79f705a4e0e5e1c7dbd0aac /sql/sql_class.cc
parent16c0631f0b785e82aef63429b5a4e7179b8aa52e (diff)
downloadmariadb-git-4f0f021c3387d621a3334c97ff3a0ee394ced040.tar.gz
BUG#41980 SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0 !
When binlog_format is STATEMENT and the statement is unsafe before, the unsafe warning/error message was issued without checking whether the SQL_LOG_BIN was turned on or not. Fixed with adding a sql_log_bin_toplevel flag in THD to check whether SQL_LOG_BIN is ON in current session whatever the current is in sp or not. mysql-test/suite/binlog/r/binlog_unsafe.result: Test case result for unsafe warning/error message mysql-test/suite/binlog/t/binlog_unsafe.test: Test case for unsafe message warning/error sql/set_var.cc: Adding a function set_option_log_bin_bit() which specailly handles to the change of SQL_LOG_BIN bit in order to set sql_log_bin_toplevel according to SQL_LOG_BIN current value at the same time. sql/sql_class.cc: Initialize the flag sql_log_bin_toplevel in THD::init(), and add the condition to check whether unsafe ror message was issued. sql/sql_class.h: Add a sql_log_bin_toplevel flag in THD to indicate whether the toplevel SQL_LOG_BIN is
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 597478933d6..cd00d0e20f1 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -538,6 +538,7 @@ THD::THD()
Open_tables_state(refresh_version), rli_fake(0),
lock_id(&main_lock_id),
user_time(0), in_sub_stmt(0),
+ sql_log_bin_toplevel(false),
binlog_table_maps(0), binlog_flags(0UL),
table_map_for_update(0),
arg_of_last_insert_id_function(FALSE),
@@ -787,6 +788,7 @@ void THD::init(void)
update_charset();
reset_current_stmt_binlog_row_based();
bzero((char *) &status_var, sizeof(status_var));
+ sql_log_bin_toplevel= options & OPTION_BIN_LOG;
}
@@ -3662,7 +3664,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
If we are in statement mode and trying to log an unsafe statement,
we should print a warning.
*/
- if (lex->is_stmt_unsafe() &&
+ if (sql_log_bin_toplevel && lex->is_stmt_unsafe() &&
variables.binlog_format == BINLOG_FORMAT_STMT)
{
push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN,