8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00

Fix problems with COMMIT triggers:

1) Fix a problem when the transaction could not be commited due to errors in DFW.
2) Run triggers inside a savepoint when "preparing" the transaction.
3) More doc.
This commit is contained in:
asfernandes 2007-01-06 23:54:23 +00:00
parent 36a0d0afac
commit 9493f2fb66
2 changed files with 8 additions and 2 deletions

View File

@ -59,7 +59,9 @@ exceptions are returned to the client and the transaction is rolled-back.
- TRANSACTION COMMIT
Triggers are fired in the committing transaction - uncaught exceptions
rollback the triggers savepoint, the commit command is aborted and the
exception is returned to the client
exception is returned to the client.
Note: for two-phase transactions the triggers are fired in "prepare"
and not in commit.
- TRANSACTION ROLLBACK
Triggers are fired in the rolling-back transaction - changes done will

View File

@ -5993,7 +5993,7 @@ static ISC_STATUS prepare(thread_db* tdbb,
if (!(transaction->tra_flags & TRA_prepared))
{
// run ON TRANSACTION COMMIT triggers
EXE_execute_db_triggers(tdbb, transaction, jrd_req::req_trigger_trans_commit);
run_commit_triggers(tdbb, transaction);
}
for (; transaction; transaction = transaction->tra_sibling) {
@ -6986,6 +6986,9 @@ static void run_commit_triggers(thread_db* tdbb, jrd_tra* transaction)
**************************************/
SET_TDBB(tdbb);
if (transaction == tdbb->tdbb_database->dbb_sys_trans)
return;
// start a savepoint to rollback changes of all triggers
VIO_start_save_point(tdbb, transaction);
@ -6993,6 +6996,7 @@ static void run_commit_triggers(thread_db* tdbb, jrd_tra* transaction)
{
// run ON TRANSACTION COMMIT triggers
EXE_execute_db_triggers(tdbb, transaction, jrd_req::req_trigger_trans_commit);
VIO_verb_cleanup(tdbb, transaction);
}
catch (const Firebird::Exception&)
{