summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <mats@kindahl-laptop.dnsalias.net>2007-06-01 00:26:42 +0200
committerunknown <mats@kindahl-laptop.dnsalias.net>2007-06-01 00:26:42 +0200
commit649cea1e049906b150f30544436655aedef135f1 (patch)
treeea6d5f4e5a51a7b0562d45bd03778be5478c66ab /sql/sql_class.cc
parentdb0ce6ff6eb7c7dd16538fc8ce63e9ce8660000d (diff)
parent975c5570206d3003730e2370499c4f58b76768c1 (diff)
downloadmariadb-git-649cea1e049906b150f30544436655aedef135f1.tar.gz
Merge mkindahl@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl sql/sql_class.cc: Auto merged
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc38
1 files changed, 21 insertions, 17 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7f251a8f1af..cc3b281f892 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -3103,6 +3103,27 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query,
if (int error= binlog_flush_pending_rows_event(TRUE))
DBUG_RETURN(error);
+ /*
+ If we are in statement mode and trying to log an unsafe statement,
+ we should print a warning.
+ */
+ if (lex->is_stmt_unsafe() &&
+ variables.binlog_format == BINLOG_FORMAT_STMT)
+ {
+ DBUG_ASSERT(this->query != NULL);
+ push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_BINLOG_UNSAFE_STATEMENT,
+ ER(ER_BINLOG_UNSAFE_STATEMENT));
+ if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
+ {
+ char warn_buf[MYSQL_ERRMSG_SIZE];
+ my_snprintf(warn_buf, MYSQL_ERRMSG_SIZE, "%s Statement: %s",
+ ER(ER_BINLOG_UNSAFE_STATEMENT), this->query);
+ sql_print_warning(warn_buf);
+ binlog_flags|= BINLOG_FLAG_UNSAFE_STMT_PRINTED;
+ }
+ }
+
switch (qtype) {
case THD::ROW_QUERY_TYPE:
if (current_stmt_binlog_row_based)
@@ -3118,23 +3139,6 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query,
to how you treat this.
*/
case THD::STMT_QUERY_TYPE:
- if (lex->is_stmt_unsafe())
- {
- DBUG_ASSERT(this->query != NULL);
- push_warning(this, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_BINLOG_UNSAFE_STATEMENT,
- ER(ER_BINLOG_UNSAFE_STATEMENT));
- if (!(binlog_flags & BINLOG_FLAG_UNSAFE_STMT_PRINTED))
- {
-
- char warn_buf[MYSQL_ERRMSG_SIZE];
- my_snprintf(warn_buf, MYSQL_ERRMSG_SIZE, "%s Statement: %s",
- ER(ER_BINLOG_UNSAFE_STATEMENT), this->query);
- sql_print_warning(warn_buf);
- binlog_flags|= BINLOG_FLAG_UNSAFE_STMT_PRINTED;
- }
- }
-
/*
The MYSQL_LOG::write() function will set the STMT_END_F flag and
flush the pending rows event if necessary.