diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2001-10-19 17:43:30 +0300 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2001-10-19 17:43:30 +0300 |
commit | 7b440a7326886fdd35bcf59ae048194f87cb7cdf (patch) | |
tree | 4fac432f8c94c47d262609dc9627475c5fd8e107 /sql/sql_delete.cc | |
parent | 1211c0a75cba6b45e4b5ace6e77e8a4568d5d3dd (diff) | |
download | mariadb-git-7b440a7326886fdd35bcf59ae048194f87cb7cdf.tar.gz |
Unchecked changes, so that I could run mysql-test.
If I ruined anything, write your complaints to sasha@mysql.com
sql/sql_delete.cc:
Unchecked changes, so that I could run mysql-test
sql/sql_lex.h:
Unchecked changes, so that I could run mysql-test
sql/sql_parse.cc:
Unchecked changes, so that I could run mysql-test
sql/sql_union.cc:
Unchecked changes, so that I could run mysql-test
sql/sql_yacc.yy:
Unchecked changes, so that I could run mysql-test
BitKeeper/etc/ignore:
Added libmysqld/examples/link_sources to the ignore list
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 8ba293c82f9..b8d4f00533e 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -375,7 +375,7 @@ void multi_delete::send_error(uint errcode,const char *err) if ((table_being_deleted->table->file->has_transactions() && table_being_deleted == delete_tables) || !some_table_is_not_transaction_safe(delete_tables->next)) - ha_rollback(thd); + ha_rollback_stmt(thd); else if (do_delete) VOID(do_deletes(true)); } @@ -454,29 +454,45 @@ int multi_delete::do_deletes (bool from_send_error) bool multi_delete::send_eof() { - thd->proc_info="deleting from reference tables"; - int error = do_deletes(false); + thd->proc_info="deleting from reference tables"; /* out: 1 if error, 0 if success */ + int error = do_deletes(false); /* do_deletes returns 0 if success */ /* reset used flags */ delete_tables->table->no_keyread=0; thd->proc_info="end"; - if (error && error != -1) + if (error) { ::send_error(&thd->net); return 1; } + /* Write the SQL statement to the binlog if we deleted + rows and we succeeded, or also in an error case when there + was a non-transaction-safe table involved, since + modifications in it cannot be rolled back. */ + if (deleted && - (error <= 0 || some_table_is_not_transaction_safe(delete_tables))) + (!error || some_table_is_not_transaction_safe(delete_tables))) { mysql_update_log.write(thd,thd->query,thd->query_length); Query_log_event qinfo(thd, thd->query); - if (mysql_bin_log.write(&qinfo) && + + /* mysql_bin_log is not open if binlogging or replication + is not used */ + + if (mysql_bin_log.is_open() && mysql_bin_log.write(&qinfo) && !some_table_is_not_transaction_safe(delete_tables)) - error=1; // Rollback - VOID(ha_autocommit_or_rollback(thd,error >= 0)); + error=1; /* Log write failed: roll back + the SQL statement */ + if (deleted) + { + /* If autocommit is on we do a commit, in an error case we + roll back the current SQL statement */ + VOID(ha_autocommit_or_rollback(thd, error != 0)); + } } + ::send_ok(&thd->net,deleted); return 0; } |