| 478 | } |
| 479 | |
| 480 | static 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 | |
| 521 | void Jrd::Attachment::resetSession(thread_db* tdbb, jrd_tra** traHandle) |
| 522 | { |
no test coverage detected