summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2009-12-12 23:38:59 +0300
committerAlexander Nozdrin <alik@sun.com>2009-12-12 23:38:59 +0300
commitaceea2342faa7e9a4b8b5cea6d18c0801e6975b6 (patch)
tree2a2432e481d124691d9fa4b39d8a192264178bd1 /sql/sql_delete.cc
parent376cf4275f28f6b8167eaf19b2c66dee41fbc5c5 (diff)
parent567671368723c704d60902b4d0ccff951b414552 (diff)
downloadmariadb-git-aceea2342faa7e9a4b8b5cea6d18c0801e6975b6.tar.gz
Manual merge from mysql-trunk-merge.
Conflicts: - extra/comp_err.c - mysql-test/collections/default.experimental - mysql-test/r/archive.result - mysql-test/r/select.result - mysql-test/suite/binlog/r/binlog_unsafe.result - mysql-test/suite/binlog/t/binlog_unsafe.test - mysql-test/suite/rpl/t/disabled.def - mysql-test/t/archive.test - mysql-test/t/select.test - sql/item.cc - sql/item.h - sql/item_timefunc.cc - sql/sql_base.cc - sql/sql_delete.cc - sql/sql_load.cc - sql/sql_partition.cc - sql/sql_table.cc - storage/innobase/handler/ha_innodb.cc - vio/vio.c
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index abdf545ccb9..8ffc7bd1bc6 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -426,7 +426,8 @@ cleanup:
}
DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
free_underlaid_joins(thd, select_lex);
- if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error))
+ if (error < 0 ||
+ (thd->lex->ignore && !thd->is_error() && !thd->is_fatal_error))
{
/*
If a TRUNCATE TABLE was issued, the number of rows should be reported as
@@ -1090,6 +1091,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
TABLE *table;
bool error;
uint path_length;
+ bool is_temporary_table= false;
DBUG_ENTER("mysql_truncate");
bzero((char*) &create_info,sizeof(create_info));
@@ -1100,6 +1102,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
/* If it is a temporary table, close and regenerate it */
if (!dont_send_ok && (table= find_temporary_table(thd, table_list)))
{
+ is_temporary_table= true;
handlerton *table_type= table->s->db_type();
TABLE_SHARE *share= table->s;
/* Note that a temporary table cannot be partitioned */
@@ -1178,13 +1181,13 @@ end:
{
if (!error)
{
- /*
- TRUNCATE must always be statement-based binlogged (not row-based) so
- we don't test current_stmt_binlog_row_based.
- */
- error= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
- if (!error)
- my_ok(thd); // This should return record count
+ /* In RBR, the statement is not binlogged if the table is temporary. */
+ if (!is_temporary_table || !thd->current_stmt_binlog_row_based)
+ {
+ error= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
+ if (!error)
+ my_ok(thd); // This should return record count
+ }
}
pthread_mutex_lock(&LOCK_open);
unlock_table_name(thd, table_list);