diff options
| author | Alfranio Correia <alfranio.correia@sun.com> | 2009-12-17 00:47:39 +0000 |
|---|---|---|
| committer | Alfranio Correia <alfranio.correia@sun.com> | 2009-12-17 00:47:39 +0000 |
| commit | 7c2c655ccfb163737ded33559d1942aeddec2970 (patch) | |
| tree | e7d2073fc03c4d483a2006572c2db6a9fdee7ec1 /sql/sql_delete.cc | |
| parent | 8a82a568b3ff8c485fa9c78c59bef3bba5007f96 (diff) | |
| parent | 013cc668df5e553cc93527ae002ef1be3b6cdf10 (diff) | |
| download | mariadb-git-7c2c655ccfb163737ded33559d1942aeddec2970.tar.gz | |
merge mysql-5.1-rep+2 --> mysql-5.1-rep+2-delivery1
Diffstat (limited to 'sql/sql_delete.cc')
| -rw-r--r-- | sql/sql_delete.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index b80138af7f2..6b9a83e695b 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 @@ -1089,6 +1090,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)); @@ -1099,6 +1101,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; if (!ha_check_storage_engine_flag(table_type, HTON_CAN_RECREATE)) @@ -1162,11 +1165,9 @@ end: { if (!error) { - /* - TRUNCATE must always be statement-based binlogged (not row-based) so - we don't test current_stmt_binlog_row_based. - */ - write_bin_log(thd, TRUE, thd->query(), thd->query_length()); + /* In RBR, the statement is not binlogged if the table is temporary. */ + if (!is_temporary_table || !thd->current_stmt_binlog_row_based) + write_bin_log(thd, TRUE, thd->query(), thd->query_length()); my_ok(thd); // This should return record count } VOID(pthread_mutex_lock(&LOCK_open)); |
