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

Function EXE_execute_triggers

src/jrd/exe.cpp:1101–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099
1100
1101void EXE_execute_triggers(thread_db* tdbb,
1102 TrigVector** triggers,
1103 record_param* old_rpb,
1104 record_param* new_rpb,
1105 TriggerAction trigger_action,
1106 StmtNode::WhichTrigger which_trig,
1107 int ddl_action)
1108{
1109/**************************************
1110 *
1111 * e x e c u t e _ t r i g g e r s
1112 *
1113 **************************************
1114 *
1115 * Functional description
1116 * Execute group of triggers. Return pointer to failing trigger
1117 * if any blow up.
1118 *
1119 **************************************/
1120 if (!*triggers || (*triggers)->isEmpty())
1121 return;
1122
1123 SET_TDBB(tdbb);
1124
1125 Request* const request = tdbb->getRequest();
1126 jrd_tra* const transaction = request ? request->req_transaction : tdbb->getTransaction();
1127
1128 RefPtr<TrigVector> vector(*triggers);
1129 Record* const old_rec = old_rpb ? old_rpb->rpb_record : NULL;
1130 Record* const new_rec = new_rpb ? new_rpb->rpb_record : NULL;
1131
1132 AutoPtr<Record> null_rec;
1133
1134 const bool is_db_trigger = (!old_rec && !new_rec);
1135
1136 if (!is_db_trigger && (!old_rec || !new_rec))
1137 {
1138 record_param* rpb = old_rpb ? old_rpb : new_rpb;
1139 fb_assert(rpb && rpb->rpb_relation);
1140 // copy the record
1141 MemoryPool& pool = *tdbb->getDefaultPool();
1142 null_rec = FB_NEW_POOL(pool) Record(pool, MET_current(tdbb, rpb->rpb_relation));
1143 // initialize all fields to missing
1144 null_rec->nullify();
1145 }
1146
1147 TimeStamp timestamp;
1148
1149 if (request)
1150 timestamp = request->getGmtTimeStamp();
1151 else
1152 TimeZoneUtil::validateGmtTimeStamp(timestamp);
1153
1154 Request* trigger = NULL;
1155
1156 try
1157 {
1158 for (TrigVector::iterator ptr = vector->begin(); ptr != vector->end(); ++ptr)

Callers 6

eraseMethod · 0.85
modifyMethod · 0.85
storeMethod · 0.85
preModifyEraseTriggersFunction · 0.85
EXE_execute_db_triggersFunction · 0.85
EXE_execute_ddl_triggersFunction · 0.85

Calls 15

SET_TDBBFunction · 0.85
EXE_startFunction · 0.85
EXE_unwindFunction · 0.85
trigger_failureFunction · 0.85
stuff_stack_traceFunction · 0.85
nullifyMethod · 0.80
findRequestMethod · 0.80
setValidMethod · 0.80
getTransactionNumberMethod · 0.80
getDatabaseMethod · 0.80
RecordClass · 0.70
TimeoutTimerClass · 0.70

Tested by

no test coverage detected