dbo.RPS_TURPSReport
Database TriggerSQL_TRIGGERSandbox DB
Interpretation
- Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
- Object-layer bridge detected through QBM_PJobCreate helper usage.
- DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.
Relations
- Bulk DBQueue insert -> RPS-K-AllForOneRPSReport / RPS_ZAllForOneRPSReport at line 31
- Bulk DBQueue insert -> RPS-K-PrepropRPSReport / RPS_ZPrePropRPSReport at line 31
- Bulk DBQueue insert -> RPS-K-PrepropRPSReport / RPS_ZPrePropRPSReport at line 34
- References QBM_PJobCreate*
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: RPSReport
Typed Edges
- queues DBQueue task RPS_ZAllForOneRPSReport at line 31 Bulk DBQueue insert -> RPS-K-AllForOneRPSReport / RPS_ZAllForOneRPSReport at line 31
- queues DBQueue task RPS_ZPrePropRPSReport at line 31 Bulk DBQueue insert -> RPS-K-PrepropRPSReport / RPS_ZPrePropRPSReport at line 31
- queues DBQueue task RPS_ZPrePropRPSReport at line 34 Bulk DBQueue insert -> RPS-K-PrepropRPSReport / RPS_ZPrePropRPSReport at line 34
- trigger on table RPSReport Trigger parent table: RPSReport
- references source dbo.QBM_FCVBigIntToString source text reference
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PJobCreate source text reference
- references source dbo.QBM_PJobCreate_HOUpdate source text reference
- references source dbo.QBM_PJobCreate_HOUpdate_B source text reference
- references source dbo.QBM_PPrePropCheckSyntax source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QER_PIsForITShopFlagCheck source text reference
- references source dbo.QER_PITShopHelperFill source text reference
- references source dbo.QER_PITShopHelperFill_Recalc source text reference
References
- dbo.QBM_FCVBigIntToString
- dbo.QBM_FGISessionContext
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PJobCreate
- dbo.QBM_PJobCreate_HOUpdate
- dbo.QBM_PJobCreate_HOUpdate_B
- dbo.QBM_PPrePropCheckSyntax
- dbo.QBM_PSessionErrorAdd
- dbo.QER_PIsForITShopFlagCheck
- dbo.QER_PITShopHelperFill
- dbo.QER_PITShopHelperFill_Recalc
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger RPS_TURPSReport2 ON RPSReport FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @ObjectkeyOrdered varchar(138)7 DECLARE @uid_accproduct varchar(38)8 DECLARE @whereclauseOrg nvarchar(max)9 DECLARE @whereclauseMuster nvarchar(max) = ' UID_ITShopOrg in ( select UID_OrgPR 10 from QER_VPWOProductNodesSlim11 where ObjectkeyOrdered = ''@ObjectkeyOrdered'' 12 and isnull(UID_AccProduct, '''') <> ''@UID_AccProduct''13 )14'15 DECLARE @ElementBuffer QBM_YCursorBuffer16 DECLARE @ElementCount int17 DECLARE @ElementIndex int18 DECLARE @ConditionsToCheck QBM_YParameterList19 BEGIN TRY20 IF EXISTS(21 SELECT TOP 1 122 FROM inserted)23 GOTO start24 IF EXISTS(25 SELECT TOP 1 126 FROM deleted)27 GOTO start28 RETURN start:29 DECLARE @GenProcID varchar(38)30 SELECT @GenProcID = dbo.QBM_FGISessionContext('')31 DECLARE @uid_RPSReport varchar(38)32 IF33 UPDATE(isForITShop) OR34 UPDATE(isITShopOnly)35 BEGIN36 DECLARE @FlagTest QBM_YParameterlist37 INSERT INTO @FlagTest(Parameter1,38 Parameter2,39 HasContentFull,40 e.Parameter3)41 SELECT42 i.UID_RPSReport,43 i.XObjectKey,44 i.IsForITShop,45 dbo.QBM_FCVBigIntToString(i.IsITShopOnly)46 FROM inserted i47 EXEC QER_PIsForITShopFlagCheck 'RPSReport',48 @FlagTest49 END50 IF51 UPDATE(uid_accproduct)52 BEGIN53 INSERT INTO @ElementBuffer(ObjectKey1,54 UID1)55 SELECT56 x.XObjectKey,57 isnull(x.uid_accproduct,58 '')59 FROM RPSReport x60 JOIN deleted d61 ON x.uid_RPSReport = d.uid_RPSReport AND d.uid_accproduct > ' ' AND isnull(x.uid_accproduct,62 '') <> isnull(d.uid_accproduct,63 '')64 JOIN dialogColumn c65 ON c.UID_DialogTable = 'QER-T-ITShopOrg' AND c.columnname = 'uid_ACCProduct' AND c.IsDeactivatedByPreProcessor = 066 SELECT @ElementCount = @@rowcount67 SELECT @ElementIndex = 168 WHILE @ElementIndex <= @ElementCount69 BEGIN70 SELECT71 TOP 1 @ObjectkeyOrdered = bu.ObjectKey1,72 @UID_AccProduct = bu.UID173 FROM @ElementBuffer bu74 WHERE75 bu.ElementIndex = @ElementIndex76 SELECT @whereclauseOrg = @whereclauseMuster77 SELECT78 @whereclauseOrg = replace(@whereclauseOrg,79 N '@ObjectkeyOrdered',80 @ObjectkeyOrdered)81 SELECT82 @whereclauseOrg = replace(@whereclauseOrg,83 N '@uid_accproduct',84 rtrim(@uid_accproduct))85 EXEC QBM_PJobCreate_HOUpdate_B 'ITShopOrg',86 @whereclauseOrg,87 @GenProcID,88 @p1 = 'uid_ACCProduct',89 @v1 = @uid_accproduct,90 @AdditionalObjectKeysAffected = DEFAULT91 SELECT @ElementIndex += 192 END93 END94 IF95 UPDATE(UID_AccProduct)96 BEGIN97 DECLARE @RecalcParameter_OA QBM_YCursorBuffer98 INSERT INTO @RecalcParameter_OA(UID1,99 ObjectKey1,100 Ident1)101 SELECT102 'QER-PWODecisionRule-OA',103 a.XObjectKey,104 'I'105 FROM inserted i106 JOIN RPSReport g107 ON i.UID_RPSReport = g.UID_RPSReport108 JOIN QERAccProductUsage u109 ON g.XObjectKey = u.XObjectKey110 JOIN AccProduct a111 ON u.UID_AccProduct = a.UID_AccProduct112 UNION113 SELECT114 'QER-PWODecisionRule-OA',115 a.XObjectKey,116 'I'117 FROM deleted d118 JOIN RPSReport g119 ON d.UID_RPSReport = g.UID_RPSReport120 JOIN QERAccProductUsage u121 ON g.XObjectKey = u.XObjectKey122 JOIN AccProduct a123 ON u.UID_AccProduct = a.UID_AccProduct124 EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_OA,125 @GenprocID126 DECLARE @RecalcParameter_OA2 QBM_YCursorBuffer127 INSERT INTO @RecalcParameter_OA2(UID1,128 ObjectKey1,129 Ident1)130 SELECT131 'QER-PWODecisionRule-OA',132 pwo.XObjectKey,133 'I'134 FROM inserted i135 JOIN RPSReport g136 ON i.UID_RPSReport = g.UID_RPSReport137 JOIN AccProduct a138 ON i.UID_AccProduct = a.UID_AccProduct139 JOIN PersonWantsOrg pwo140 ON g.XObjectKey = pwo.ObjectKeyElementUsedInAssign141 UNION142 SELECT143 'QER-PWODecisionRule-OA',144 pwo.XObjectKey,145 'I'146 FROM deleted d147 JOIN RPSReport g148 ON d.UID_RPSReport = g.UID_RPSReport149 JOIN AccProduct a150 ON d.UID_AccProduct = a.UID_AccProduct151 JOIN PersonWantsOrg pwo152 ON g.XObjectKey = pwo.ObjectKeyElementUsedInAssign153 EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_OA2,154 @GenprocID155 END156 IF157 UPDATE(IsInactive) OR158 UPDATE(IsDeactivatedByPreProcessor)159 BEGIN160 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw161 INSERT INTO @DBQueueElements_01(object,162 subobject,163 genprocid)164 SELECT165 x.uid,166 NULL,167 @GenProcID168 FROM(169 SELECT d.uid_RPSReport AS uid170 FROM deleted d171 JOIN RPSReport r172 ON d.uid_RPSReport = r.UID_RPSReport173 WHERE174 d.IsInactive <> r.IsInactive OR d.IsDeactivatedByPreProcessor <> r.IsDeactivatedByPreProcessor) AS x175 EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-AllForOneRPSReport',176 @DBQueueElements_01177 END178 IF179 UPDATE(PreProcessorCondition)180 BEGIN181 INSERT INTO @ConditionsToCheck(ContentFull)182 SELECT i.PreProcessorCondition183 FROM inserted i184 EXEC QBM_PPrePropCheckSyntax @ConditionsToCheck185 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw186 INSERT INTO @DBQueueElements_02(object,187 subobject,188 genprocid)189 SELECT190 x.uid,191 NULL,192 @GenProcID193 FROM(194 SELECT ao.UID_RPSReport AS uid195 FROM deleted i196 JOIN RPSReport ao197 ON ao.UID_RPSReport = i.UID_RPSReport198 WHERE199 isnull(i.PreProcessorCondition, N '') <> isnull(ao.PreProcessorCondition, N '')) AS x200 EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PrepropRPSReport',201 @DBQueueElements_02202 END203 END TRY204 BEGIN CATCH205 EXEC QBM_PSessionErrorAdd DEFAULT206 RAISERROR('',207 18,208 1)209 WITH NOWAIT210 END CATCH211 ende:212 RETURN213END
Open raw exported source
1create trigger RPS_TURPSReport on RPSReport for Update not for Replication as begin declare @ObjectkeyOrdered varchar(138) declare @uid_accproduct2 varchar(38) declare @whereclauseOrg nvarchar(max) declare @whereclauseMuster nvarchar(max) = ' UID_ITShopOrg in ( select UID_OrgPR 3 from QER_VPWOProductNodesSlim4 where ObjectkeyOrdered = ''@ObjectkeyOrdered'' 5 and isnull(UID_AccProduct, '''') <> ''@UID_AccProduct''6 )7'8 declare @ElementBuffer QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int declare @ConditionsToCheck QBM_YParameterList BEGIN TRY if9 exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) select10 @GenProcID = dbo.QBM_FGISessionContext('') declare @uid_RPSReport varchar(38) if update(isForITShop) or update(isITShopOnly) begin declare @FlagTest 11QBM_YParameterlist insert into @FlagTest(Parameter1, Parameter2, HasContentFull, e.Parameter3) select i.UID_RPSReport, i.XObjectKey, i.IsForITShop, dbo.QBM_FCVBigIntToString12(i.IsITShopOnly) from inserted i exec QER_PIsForITShopFlagCheck 'RPSReport', @FlagTest end if update(uid_accproduct) begin insert into @ElementBuffer13(ObjectKey1, UID1) select x.XObjectKey, isnull(x.uid_accproduct,'') from RPSReport x join deleted d on x.uid_RPSReport = d.uid_RPSReport and d.uid_accproduct14 > ' ' and isnull(x.uid_accproduct,'') <> isnull(d.uid_accproduct,'') join dialogColumn c on c.UID_DialogTable = 'QER-T-ITShopOrg' and c.columnname = 15'uid_ACCProduct' and c.IsDeactivatedByPreProcessor = 0 select @ElementCount = @@rowcount select @ElementIndex = 1 while @ElementIndex <= @ElementCount16 begin select top 1 @ObjectkeyOrdered = bu.ObjectKey1 , @UID_AccProduct = bu.UID1 from @ElementBuffer bu where bu.ElementIndex = @ElementIndex select @whereclauseOrg17 = @whereclauseMuster select @whereclauseOrg = replace(@whereclauseOrg, N'@ObjectkeyOrdered' , @ObjectkeyOrdered) select @whereclauseOrg = replace(@whereclauseOrg18, N'@uid_accproduct' , rtrim(@uid_accproduct)) exec QBM_PJobCreate_HOUpdate_B 'ITShopOrg', @whereclauseOrg, @GenProcID , @p1 = 'uid_ACCProduct', @v119 = @uid_accproduct , @AdditionalObjectKeysAffected = DEFAULT select @ElementIndex += 1 end end if update (UID_AccProduct) begin declare @RecalcParameter_OA20 QBM_YCursorBuffer insert into @RecalcParameter_OA (UID1, ObjectKey1, Ident1) select 'QER-PWODecisionRule-OA', a.XObjectKey, 'I' from inserted i join RPSReport21 g on i.UID_RPSReport = g.UID_RPSReport join QERAccProductUsage u on g.XObjectKey = u.XObjectKey join AccProduct a on u.UID_AccProduct = a.UID_AccProduct22 union select 'QER-PWODecisionRule-OA', a.XObjectKey, 'I' from deleted d join RPSReport g on d.UID_RPSReport = g.UID_RPSReport join QERAccProductUsage 23u on g.XObjectKey = u.XObjectKey join AccProduct a on u.UID_AccProduct = a.UID_AccProduct exec QER_PITShopHelperFill_Recalc @RecalcParameter_OA, @GenprocID24 declare @RecalcParameter_OA2 QBM_YCursorBuffer insert into @RecalcParameter_OA2 (UID1, ObjectKey1, Ident1) select 'QER-PWODecisionRule-OA', pwo.XObjectKey25, 'I' from inserted i join RPSReport g on i.UID_RPSReport = g.UID_RPSReport join AccProduct a on i.UID_AccProduct = a.UID_AccProduct join PersonWantsOrg26 pwo on g.XObjectKey = pwo.ObjectKeyElementUsedInAssign union select 'QER-PWODecisionRule-OA', pwo.XObjectKey, 'I' from deleted d join RPSReport g on d.UID_RPSReport27 = g.UID_RPSReport join AccProduct a on d.UID_AccProduct = a.UID_AccProduct join PersonWantsOrg pwo on g.XObjectKey = pwo.ObjectKeyElementUsedInAssign 28exec QER_PITShopHelperFill_Recalc @RecalcParameter_OA2, @GenprocID end if update(IsInactive) or update(IsDeactivatedByPreProcessor) begin declare @DBQueueElements_0129 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select d.uid_RPSReport as uid from30 deleted d join RPSReport r on d.uid_RPSReport = r.UID_RPSReport where d.IsInactive <> r.IsInactive or d.IsDeactivatedByPreProcessor <> r.IsDeactivatedByPreProcessor31 ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-AllForOneRPSReport', @DBQueueElements_01 end if update(PreProcessorCondition) begin insert into @ConditionsToCheck32 (ContentFull) select i.PreProcessorCondition from inserted i exec QBM_PPrePropCheckSyntax @ConditionsToCheck declare @DBQueueElements_02 QBM_YDBQueueRaw33 insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select ao.UID_RPSReport as uid from deleted i join34 RPSReport ao on ao.UID_RPSReport = i.UID_RPSReport where isnull(i.PreProcessorCondition, N'') <> isnull(ao.PreProcessorCondition, N'') ) as x exec QBM_PDBQueueInsert_Bulk35 'RPS-K-PrepropRPSReport', @DBQueueElements_02 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende:36 return end 37