mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Replace individual public functions by moment/type execute categories.
This commit is contained in:
parent
ff16556325
commit
f947d0bb17
@ -26,6 +26,7 @@
|
||||
#include "../jrd/SystemTriggers.h"
|
||||
#include "../jrd/constants.h"
|
||||
#include "../jrd/ids.h"
|
||||
#include "../jrd/ini.h"
|
||||
#include "../jrd/req.h"
|
||||
#include "../jrd/dpm_proto.h"
|
||||
#include "../jrd/err_proto.h"
|
||||
@ -41,7 +42,10 @@ using namespace Firebird;
|
||||
using namespace Jrd;
|
||||
|
||||
|
||||
void SystemTriggers::beforeDeleteCheckConstraint(thread_db* tdbb, Record* record)
|
||||
namespace
|
||||
{
|
||||
|
||||
void beforeDeleteCheckConstraint(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -62,7 +66,7 @@ void SystemTriggers::beforeDeleteCheckConstraint(thread_db* tdbb, Record* record
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::afterDeleteCheckConstraint(thread_db* tdbb, Record* record)
|
||||
void afterDeleteCheckConstraint(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -122,7 +126,7 @@ void SystemTriggers::afterDeleteCheckConstraint(thread_db* tdbb, Record* record)
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeUpdateCheckConstraint(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
void beforeUpdateCheckConstraint(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -144,7 +148,7 @@ void SystemTriggers::beforeUpdateCheckConstraint(thread_db* tdbb, Record* orgRec
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeDeleteIndex(thread_db* tdbb, Record* record)
|
||||
void beforeDeleteIndex(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -165,7 +169,7 @@ void SystemTriggers::beforeDeleteIndex(thread_db* tdbb, Record* record)
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeUpdateIndex(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
void beforeUpdateIndex(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -267,7 +271,7 @@ void SystemTriggers::beforeUpdateIndex(thread_db* tdbb, Record* orgRecord, Recor
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeDeleteIndexSegment(thread_db* tdbb, Record* record)
|
||||
void beforeDeleteIndexSegment(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -288,7 +292,7 @@ void SystemTriggers::beforeDeleteIndexSegment(thread_db* tdbb, Record* record)
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeUpdateIndexSegment(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
void beforeUpdateIndexSegment(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -334,7 +338,7 @@ void SystemTriggers::beforeUpdateIndexSegment(thread_db* tdbb, Record* orgRecord
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeUpdateField(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
void beforeUpdateField(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -397,7 +401,7 @@ void SystemTriggers::beforeUpdateField(thread_db* tdbb, Record* orgRecord, Recor
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeInsertRefConstraint(thread_db* tdbb, Record* record)
|
||||
void beforeInsertRefConstraint(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -444,7 +448,7 @@ void SystemTriggers::beforeInsertRefConstraint(thread_db* tdbb, Record* record)
|
||||
ERR_post(Arg::Gds(isc_foreign_key_notfound));
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeDeleteRelationConstraint(thread_db* tdbb, Record* record)
|
||||
void beforeDeleteRelationConstraint(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -525,7 +529,7 @@ void SystemTriggers::beforeDeleteRelationConstraint(thread_db* tdbb, Record* rec
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::afterDeleteRelationConstraint(thread_db* tdbb, Record* record)
|
||||
void afterDeleteRelationConstraint(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -649,7 +653,7 @@ void SystemTriggers::afterDeleteRelationConstraint(thread_db* tdbb, Record* reco
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeInsertRelationConstraint(thread_db* tdbb, Record* record)
|
||||
void beforeInsertRelationConstraint(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -693,7 +697,7 @@ void SystemTriggers::beforeInsertRelationConstraint(thread_db* tdbb, Record* rec
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeDeleteRelationField(thread_db* tdbb, Record* record)
|
||||
void beforeDeleteRelationField(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -772,7 +776,7 @@ void SystemTriggers::beforeDeleteRelationField(thread_db* tdbb, Record* record)
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::afterDeleteRelationField(thread_db* tdbb, Record* record)
|
||||
void afterDeleteRelationField(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -804,7 +808,7 @@ void SystemTriggers::afterDeleteRelationField(thread_db* tdbb, Record* record)
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeUpdateRelationField(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
void beforeUpdateRelationField(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
|
||||
@ -860,7 +864,7 @@ void SystemTriggers::beforeUpdateRelationField(thread_db* tdbb, Record* orgRecor
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeDeleteTrigger(thread_db* tdbb, Record* record)
|
||||
void beforeDeleteTrigger(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -887,7 +891,7 @@ void SystemTriggers::beforeDeleteTrigger(thread_db* tdbb, Record* record)
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeUpdateTrigger(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
void beforeUpdateTrigger(thread_db* tdbb, Record* orgRecord, Record* newRecord)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -961,7 +965,7 @@ void SystemTriggers::beforeUpdateTrigger(thread_db* tdbb, Record* orgRecord, Rec
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeDeleteUserPrivilege(thread_db* tdbb, Record* record)
|
||||
void beforeDeleteUserPrivilege(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
dsc desc;
|
||||
@ -998,7 +1002,7 @@ void SystemTriggers::beforeDeleteUserPrivilege(thread_db* tdbb, Record* record)
|
||||
END_FOR
|
||||
}
|
||||
|
||||
void SystemTriggers::beforeInsertUserPrivilege(thread_db* tdbb, Record* record)
|
||||
void beforeInsertUserPrivilege(thread_db* tdbb, Record* record)
|
||||
{
|
||||
const auto attachment = tdbb->getAttachment();
|
||||
const auto transaction = tdbb->getTransaction();
|
||||
@ -1273,3 +1277,106 @@ void SystemTriggers::beforeInsertUserPrivilege(thread_db* tdbb, Record* record)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous
|
||||
|
||||
|
||||
void SystemTriggers::executeBeforeDeleteTriggers(thread_db* tdbb, jrd_rel* relation, Record* record)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
{
|
||||
case rel_ccon:
|
||||
beforeDeleteCheckConstraint(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_indices:
|
||||
beforeDeleteIndex(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_priv:
|
||||
beforeDeleteUserPrivilege(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_rcon:
|
||||
beforeDeleteRelationConstraint(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_rfr:
|
||||
beforeDeleteRelationField(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_segments:
|
||||
beforeDeleteIndexSegment(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_triggers:
|
||||
beforeDeleteTrigger(tdbb, record);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::executeAfterDeleteTriggers(thread_db* tdbb, jrd_rel* relation, Record* record)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
{
|
||||
case rel_ccon:
|
||||
afterDeleteCheckConstraint(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_rcon:
|
||||
afterDeleteRelationConstraint(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_rfr:
|
||||
afterDeleteRelationField(tdbb, record);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::executeBeforeInsertTriggers(thread_db* tdbb, jrd_rel* relation, Record* record)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
{
|
||||
case rel_priv:
|
||||
beforeInsertUserPrivilege(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_rcon:
|
||||
beforeInsertRelationConstraint(tdbb, record);
|
||||
break;
|
||||
|
||||
case rel_refc:
|
||||
beforeInsertRefConstraint(tdbb, record);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTriggers::executeBeforeUpdateTriggers(thread_db* tdbb, jrd_rel* relation, Record* orgRecord, Record* newRecord)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
{
|
||||
case rel_ccon:
|
||||
beforeUpdateCheckConstraint(tdbb, orgRecord, newRecord);
|
||||
break;
|
||||
|
||||
case rel_fields:
|
||||
beforeUpdateField(tdbb, orgRecord, newRecord);
|
||||
break;
|
||||
|
||||
case rel_indices:
|
||||
beforeUpdateIndex(tdbb, orgRecord, newRecord);
|
||||
break;
|
||||
|
||||
case rel_rfr:
|
||||
beforeUpdateRelationField(tdbb, orgRecord, newRecord);
|
||||
break;
|
||||
|
||||
case rel_segments:
|
||||
beforeUpdateIndexSegment(tdbb, orgRecord, newRecord);
|
||||
break;
|
||||
|
||||
case rel_triggers:
|
||||
beforeUpdateTrigger(tdbb, orgRecord, newRecord);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -27,31 +27,17 @@
|
||||
|
||||
namespace Jrd
|
||||
{
|
||||
class jrd_rel;
|
||||
class thread_db;
|
||||
class Record;
|
||||
} // namespace Jrd
|
||||
|
||||
namespace Jrd::SystemTriggers
|
||||
{
|
||||
void beforeDeleteCheckConstraint(thread_db* tdbb, Record* record);
|
||||
void afterDeleteCheckConstraint(thread_db* tdbb, Record* record);
|
||||
void beforeUpdateCheckConstraint(thread_db* tdbb, Record* orgRecord, Record* newRecord);
|
||||
void beforeDeleteIndex(thread_db* tdbb, Record* record);
|
||||
void beforeUpdateIndex(thread_db* tdbb, Record* orgRecord, Record* newRecord);
|
||||
void beforeDeleteIndexSegment(thread_db* tdbb, Record* record);
|
||||
void beforeUpdateIndexSegment(thread_db* tdbb, Record* orgRecord, Record* newRecord);
|
||||
void beforeUpdateField(thread_db* tdbb, Record* orgRecord, Record* newRecord);
|
||||
void beforeInsertRefConstraint(thread_db* tdbb, Record* record);
|
||||
void beforeDeleteRelationConstraint(thread_db* tdbb, Record* record);
|
||||
void afterDeleteRelationConstraint(thread_db* tdbb, Record* record);
|
||||
void beforeInsertRelationConstraint(thread_db* tdbb, Record* record);
|
||||
void beforeDeleteRelationField(thread_db* tdbb, Record* record);
|
||||
void afterDeleteRelationField(thread_db* tdbb, Record* record);
|
||||
void beforeUpdateRelationField(thread_db* tdbb, Record* orgRecord, Record* newRecord);
|
||||
void beforeDeleteTrigger(thread_db* tdbb, Record* record);
|
||||
void beforeUpdateTrigger(thread_db* tdbb, Record* orgRecord, Record* newRecord);
|
||||
void beforeDeleteUserPrivilege(thread_db* tdbb, Record* record);
|
||||
void beforeInsertUserPrivilege(thread_db* tdbb, Record* record);
|
||||
void executeBeforeDeleteTriggers(thread_db* tdbb, jrd_rel* relation, Record* record);
|
||||
void executeAfterDeleteTriggers(thread_db* tdbb, jrd_rel* relation, Record* record);
|
||||
void executeBeforeInsertTriggers(thread_db* tdbb, jrd_rel* relation, Record* record);
|
||||
void executeBeforeUpdateTriggers(thread_db* tdbb, jrd_rel* relation, Record* orgRecord, Record* newRecord);
|
||||
} // namespace Jrd::SystemTriggers
|
||||
|
||||
#endif // JRD_SYSTEM_TRIGGERS_H
|
||||
|
112
src/jrd/exe.cpp
112
src/jrd/exe.cpp
@ -1306,101 +1306,35 @@ void EXE_execute_triggers(thread_db* tdbb,
|
||||
if (const auto relation = old_rpb ? old_rpb->rpb_relation : new_rpb->rpb_relation;
|
||||
relation->rel_flags & REL_system)
|
||||
{
|
||||
if (which_trig == StmtNode::PRE_TRIG && trigger_action == TriggerAction::TRIGGER_DELETE)
|
||||
switch (which_trig)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
case StmtNode::PRE_TRIG:
|
||||
{
|
||||
case rel_ccon:
|
||||
SystemTriggers::beforeDeleteCheckConstraint(tdbb, old_rec);
|
||||
break;
|
||||
switch (trigger_action)
|
||||
{
|
||||
case TriggerAction::TRIGGER_DELETE:
|
||||
SystemTriggers::executeBeforeDeleteTriggers(tdbb, relation, old_rec);
|
||||
break;
|
||||
|
||||
case rel_indices:
|
||||
SystemTriggers::beforeDeleteIndex(tdbb, old_rec);
|
||||
break;
|
||||
case TriggerAction::TRIGGER_UPDATE:
|
||||
SystemTriggers::executeBeforeUpdateTriggers(tdbb, relation, old_rec, new_rec);
|
||||
break;
|
||||
|
||||
case rel_priv:
|
||||
SystemTriggers::beforeDeleteUserPrivilege(tdbb, old_rec);
|
||||
break;
|
||||
|
||||
case rel_rcon:
|
||||
SystemTriggers::beforeDeleteRelationConstraint(tdbb, old_rec);
|
||||
break;
|
||||
|
||||
case rel_rfr:
|
||||
SystemTriggers::beforeDeleteRelationField(tdbb, old_rec);
|
||||
break;
|
||||
|
||||
case rel_segments:
|
||||
SystemTriggers::beforeDeleteIndexSegment(tdbb, old_rec);
|
||||
break;
|
||||
|
||||
case rel_triggers:
|
||||
SystemTriggers::beforeDeleteTrigger(tdbb, old_rec);
|
||||
break;
|
||||
case TriggerAction::TRIGGER_INSERT:
|
||||
SystemTriggers::executeBeforeInsertTriggers(tdbb, relation, new_rec);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (which_trig == StmtNode::PRE_TRIG && trigger_action == TriggerAction::TRIGGER_UPDATE)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
{
|
||||
case rel_ccon:
|
||||
SystemTriggers::beforeUpdateCheckConstraint(tdbb, old_rec, new_rec);
|
||||
break;
|
||||
|
||||
case rel_fields:
|
||||
SystemTriggers::beforeUpdateField(tdbb, old_rec, new_rec);
|
||||
break;
|
||||
|
||||
case rel_indices:
|
||||
SystemTriggers::beforeUpdateIndex(tdbb, old_rec, new_rec);
|
||||
break;
|
||||
|
||||
case rel_rfr:
|
||||
SystemTriggers::beforeUpdateRelationField(tdbb, old_rec, new_rec);
|
||||
break;
|
||||
|
||||
case rel_segments:
|
||||
SystemTriggers::beforeUpdateIndexSegment(tdbb, old_rec, new_rec);
|
||||
break;
|
||||
|
||||
case rel_triggers:
|
||||
SystemTriggers::beforeUpdateTrigger(tdbb, old_rec, new_rec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (which_trig == StmtNode::PRE_TRIG && trigger_action == TriggerAction::TRIGGER_INSERT)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
{
|
||||
case rel_priv:
|
||||
SystemTriggers::beforeInsertUserPrivilege(tdbb, new_rec);
|
||||
break;
|
||||
|
||||
case rel_rcon:
|
||||
SystemTriggers::beforeInsertRelationConstraint(tdbb, new_rec);
|
||||
break;
|
||||
|
||||
case rel_refc:
|
||||
SystemTriggers::beforeInsertRefConstraint(tdbb, new_rec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (which_trig == StmtNode::POST_TRIG && trigger_action == TriggerAction::TRIGGER_DELETE)
|
||||
{
|
||||
switch ((RIDS) relation->rel_id)
|
||||
{
|
||||
case rel_ccon:
|
||||
SystemTriggers::afterDeleteCheckConstraint(tdbb, old_rec);
|
||||
break;
|
||||
|
||||
case rel_rcon:
|
||||
SystemTriggers::afterDeleteRelationConstraint(tdbb, old_rec);
|
||||
break;
|
||||
|
||||
case rel_rfr:
|
||||
SystemTriggers::afterDeleteRelationField(tdbb, old_rec);
|
||||
break;
|
||||
}
|
||||
case StmtNode::POST_TRIG:
|
||||
switch (trigger_action)
|
||||
{
|
||||
case TriggerAction::TRIGGER_DELETE:
|
||||
SystemTriggers::executeAfterDeleteTriggers(tdbb, relation, old_rec);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user