MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / runDBTriggers

Function runDBTriggers

src/jrd/Attachment.cpp:480–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478}
479
480static void runDBTriggers(thread_db* tdbb, TriggerAction action)
481{
482 fb_assert(action == TRIGGER_CONNECT || action == TRIGGER_DISCONNECT);
483
484 Database* dbb = tdbb->getDatabase();
485 Attachment* att = tdbb->getAttachment();
486 fb_assert(dbb);
487 fb_assert(att);
488
489 const unsigned trgKind = (action == TRIGGER_CONNECT) ? DB_TRIGGER_CONNECT : DB_TRIGGER_DISCONNECT;
490
491 const TrigVector* const triggers = att->att_triggers[trgKind];
492 if (!triggers || triggers->isEmpty())
493 return;
494
495 ThreadStatusGuard temp_status(tdbb);
496 jrd_tra* transaction = NULL;
497
498 try
499 {
500 transaction = TRA_start(tdbb, 0, NULL);
501 EXE_execute_db_triggers(tdbb, transaction, action);
502 TRA_commit(tdbb, transaction, false);
503 return;
504 }
505 catch (const Exception& /*ex*/)
506 {
507 if (!(dbb->dbb_flags & DBB_bugcheck) && transaction)
508 {
509 try
510 {
511 TRA_rollback(tdbb, transaction, false, false);
512 }
513 catch (const Exception& /*ex2*/)
514 {
515 }
516 }
517 throw;
518 }
519}
520
521void Jrd::Attachment::resetSession(thread_db* tdbb, jrd_tra** traHandle)
522{

Callers 1

resetSessionMethod · 0.85

Calls 7

TRA_startFunction · 0.85
EXE_execute_db_triggersFunction · 0.85
TRA_commitFunction · 0.85
TRA_rollbackFunction · 0.85
getDatabaseMethod · 0.80
getAttachmentMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected