diff options
author | unknown <bar@bar.myoffice.izhnet.ru> | 2007-10-30 12:21:44 +0400 |
---|---|---|
committer | unknown <bar@bar.myoffice.izhnet.ru> | 2007-10-30 12:21:44 +0400 |
commit | c45171b01bdb93ebcffeb08c007a5dcfc0fe40e5 (patch) | |
tree | 8d498b79e065eb55a66f3846f2a97454b8615e18 /sql/sql_update.cc | |
parent | fa0e1d6b6b9f93b7ad84f8ba490d0e2de5a4553d (diff) | |
parent | 2d380a832d60670ec687fa33c25befeec13b99e0 (diff) | |
download | mariadb-git-c45171b01bdb93ebcffeb08c007a5dcfc0fe40e5.tar.gz |
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/bar/mysql-work/mysql-5.0-rpl-merge
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/r/func_regexp.result:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
mysql-test/t/func_regexp.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/ctype_ucs.result:
After merge fix
mysql-test/t/ctype_ucs.test:
After merge fix
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 321d07dec76..5a41235fded 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -580,7 +580,7 @@ int mysql_update(THD *thd, Sometimes we want to binlog even if we updated no rows, in case user used it to be sure master and slave are in same state. */ - if ((error < 0) || (updated && !transactional_table)) + if ((error < 0) || thd->transaction.stmt.modified_non_trans_table) { if (mysql_bin_log.is_open()) { @@ -994,8 +994,8 @@ multi_update::multi_update(TABLE_LIST *table_list, :all_tables(table_list), leaves(leaves_list), update_tables(0), tmp_tables(0), updated(0), found(0), fields(field_list), values(value_list), table_count(0), copy_field(0), - handle_duplicates(handle_duplicates_arg), do_update(1), trans_safe(0), - transactional_tables(1), ignore(ignore_arg) + handle_duplicates(handle_duplicates_arg), do_update(1), trans_safe(1), + transactional_tables(1), ignore(ignore_arg), error_handled(0) {} @@ -1202,7 +1202,6 @@ multi_update::initialize_tables(JOIN *join) if ((thd->options & OPTION_SAFE_UPDATES) && error_if_full_join(join)) DBUG_RETURN(1); main_table=join->join_tab->table; - trans_safe= transactional_tables= main_table->file->has_transactions(); table_to_update= 0; /* Any update has at least one pair (field, value) */ @@ -1484,12 +1483,14 @@ void multi_update::send_error(uint errcode,const char *err) /* First send error what ever it is ... */ my_error(errcode, MYF(0), err); - /* If nothing updated return */ - if (updated == 0) /* the counter might be reset in send_eof */ - return; /* and then the query has been binlogged */ + /* the error was handled or nothing deleted and no side effects return */ + if (error_handled || + !thd->transaction.stmt.modified_non_trans_table && !updated) + return; /* Something already updated so we have to invalidate cache */ - query_cache_invalidate3(thd, update_tables, 1); + if (updated) + query_cache_invalidate3(thd, update_tables, 1); /* If all tables that has been updated are trans safe then just do rollback. If not attempt to do remaining updates. @@ -1525,8 +1526,7 @@ void multi_update::send_error(uint errcode,const char *err) transactional_tables, FALSE); mysql_bin_log.write(&qinfo); } - if (!trans_safe) - thd->transaction.all.modified_non_trans_table= TRUE; + thd->transaction.all.modified_non_trans_table= TRUE; } DBUG_ASSERT(trans_safe || !updated || thd->transaction.stmt.modified_non_trans_table); @@ -1739,8 +1739,6 @@ bool multi_update::send_eof() { if (local_error == 0) thd->clear_error(); - else - updated= 0; /* if there's an error binlog it here not in ::send_error */ Query_log_event qinfo(thd, thd->query, thd->query_length, transactional_tables, FALSE); if (mysql_bin_log.write(&qinfo) && trans_safe) @@ -1749,6 +1747,8 @@ bool multi_update::send_eof() if (thd->transaction.stmt.modified_non_trans_table) thd->transaction.all.modified_non_trans_table= TRUE; } + if (local_error != 0) + error_handled= TRUE; // to force early leave from ::send_error() if (transactional_tables) { |