dbo.QER_TIHardwareInBaseTree
Database TriggerSQL_TRIGGERSandbox DB
Interpretation
- Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
- DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.
Relations
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 11
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: HardwareInBaseTree
Typed Edges
- queues DBQueue task QER_ZAllForOneHardware at line 11 Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 11
- trigger on table HardwareInBaseTree Trigger parent table: HardwareInBaseTree
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QER_PAssignmentCheckValid source text reference
- references source dbo.QER_TIHardware source text reference
References
- dbo.QBM_FGISessionContext
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PSessionErrorAdd
- dbo.QER_PAssignmentCheckValid
- dbo.QER_TIHardware
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger QER_TIHardwareInBaseTree2 ON HardwareInBaseTree FOR3INSERT NOT FOR Replication4AS5BEGIN6 BEGIN TRY7 IF EXISTS(8 SELECT TOP 1 19 FROM inserted)10 GOTO start11 RETURN start:12 DECLARE @GenProcID varchar(38)13 SELECT @GenProcID = dbo.QBM_FGISessionContext('')14 DECLARE @AssignCheckValues QBM_YparameterList15 INSERT INTO @AssignCheckValues(Parameter1,16 Parameter2)17 SELECT18 i.UID_Org,19 i.XOrigin20 FROM inserted i21 EXEC QER_PAssignmentCheckValid 'QER-AsgnBT-Hardware',22 @AssignCheckValues,23 @GenProcID24 IF EXISTS(25 SELECT TOP 1 126 FROM BaseTreeExcludesBasetree)27 BEGIN28 IF EXISTS(29 SELECT TOP 1 130 FROM inserted i31 JOIN HardwareinBaseTree pio32 ON i.uid_Hardware = pio.uid_Hardware AND pio.XOrigin > 033 JOIN BaseTreeExcludesBaseTree beb34 ON pio.uid_org = beb.uid_org AND beb.uid_OrgExcluded = i.uid_org35 JOIN BaseTree bex36 ON beb.UID_OrgExcluded = bex.UID_Org37 LEFT38 OUTER39 JOIN DynamicGroup g40 ON g.ObjectKeyBaseTree = bex.XObjectKey41 WHERE42 g.UID_DynamicGroup IS NULL) OR EXISTS(43 SELECT TOP 1 144 FROM inserted i45 JOIN HardwareinBaseTree pio46 ON i.uid_Hardware = pio.uid_Hardware AND pio.XOrigin > 047 JOIN BaseTreeExcludesBaseTree beb48 ON pio.uid_org = beb.uid_orgExcluded AND beb.uid_Org = i.uid_org49 JOIN BaseTree bex50 ON beb.UID_OrgExcluded = bex.UID_Org51 LEFT52 OUTER53 JOIN DynamicGroup g54 ON g.ObjectKeyBaseTree = bex.XObjectKey55 WHERE56 g.UID_DynamicGroup IS NULL)57 BEGIN58 RAISERROR('#LDS#Cannot make assignment because there are already device assignments to roles that exclude the role(s) to be added.|',59 18,60 2)61 WITH nowait62 END63 END64 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw65 INSERT INTO @DBQueueElements_01(object,66 subobject,67 genprocid)68 SELECT69 x.uid,70 NULL,71 @GenProcID72 FROM(73 SELECT74 DISTINCT inserted.uid_Hardware AS uid75 FROM inserted) AS x76 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneHardware',77 @DBQueueElements_0178 END TRY79 BEGIN CATCH80 EXEC QBM_PSessionErrorAdd DEFAULT81 RAISERROR('',82 18,83 1)84 WITH NOWAIT85 END CATCH86 ende:87 RETURN88END
Open raw exported source
1 create trigger QER_TIHardwareInBaseTree on HardwareInBaseTree for Insert not for Replication as begin BEGIN TRY if exists (select top 1 21 from inserted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') declare @AssignCheckValues QBM_YparameterList3 insert into @AssignCheckValues(Parameter1, Parameter2) select i.UID_Org, i.XOrigin from inserted i exec QER_PAssignmentCheckValid 'QER-AsgnBT-Hardware'4, @AssignCheckValues, @GenProcID if exists (select top 1 1 from BaseTreeExcludesBasetree ) begin if exists (select top 1 1 from inserted i join HardwareinBaseTree5 pio on i.uid_Hardware = pio.uid_Hardware and pio.XOrigin > 0 join BaseTreeExcludesBaseTree beb on pio.uid_org = beb.uid_org and beb.uid_OrgExcluded =6 i.uid_org join BaseTree bex on beb.UID_OrgExcluded = bex.UID_Org left outer join DynamicGroup g on g.ObjectKeyBaseTree = bex.XObjectKey where g.UID_DynamicGroup7 is null ) or exists (select top 1 1 from inserted i join HardwareinBaseTree pio on i.uid_Hardware = pio.uid_Hardware and pio.XOrigin > 0 join BaseTreeExcludesBaseTree8 beb on pio.uid_org = beb.uid_orgExcluded and beb.uid_Org = i.uid_org join BaseTree bex on beb.UID_OrgExcluded = bex.UID_Org left outer join DynamicGroup9 g on g.ObjectKeyBaseTree = bex.XObjectKey where g.UID_DynamicGroup is null ) begin raiserror( '#LDS#Cannot make assignment because there are already device assignments to roles that exclude the role(s) to be added.|'10, 18, 2) with nowait end end declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, 11null, @GenProcID from ( select distinct inserted.uid_Hardware as uid from inserted ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneHardware', @DBQueueElements_0112 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 13