dbo.QER_TUPersonInBaseTree
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
- HOCallMethod -> personwantsorg.Abort at line 13
- Bulk DBQueue insert -> QER-K-AllForPersonInBaseTree / QER_ZAllForPersonInBasetree at line 13
- Bulk DBQueue insert -> QER-K-AllForPersonInBaseTree / QER_ZAllForPersonInBasetree at line 20
- References QBM_PJobCreate*
- References QBM_PJobCreate_HOCallMethod*
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: PersonInBaseTree
Typed Edges
- calls object method personwantsorg.Abort HOCallMethod -> personwantsorg.Abort at line 13
- queues DBQueue task QER_ZAllForPersonInBasetree at line 13 Bulk DBQueue insert -> QER-K-AllForPersonInBaseTree / QER_ZAllForPersonInBasetree at line 13
- queues DBQueue task QER_ZAllForPersonInBasetree at line 20 Bulk DBQueue insert -> QER-K-AllForPersonInBaseTree / QER_ZAllForPersonInBasetree at line 20
- trigger on table PersonInBaseTree Trigger parent table: PersonInBaseTree
- references source dbo.QBM_FCVStringToBit source text reference
- references source dbo.QBM_FGIConfigparmValue source text reference
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_FGIXOriginChanged_Effect source text reference
- references source dbo.QER_FGIGenProcIDForPWO source text reference
- references source dbo.QER_FGIPWOStateFinalError 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_HOCallMethod source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QER_TUPerson source text reference
References
- dbo.QBM_FCVStringToBit
- dbo.QBM_FGIConfigparmValue
- dbo.QBM_FGISessionContext
- dbo.QBM_FGIXOriginChanged_Effect
- dbo.QER_FGIGenProcIDForPWO
- dbo.QER_FGIPWOStateFinalError
- dbo.QBM_PDBQueueInsert_Bulk
- dbo.QBM_PJobCreate
- dbo.QBM_PJobCreate_HOCallMethod
- dbo.QBM_PSessionErrorAdd
- dbo.QER_TUPerson
Referenced By
- No direct source references extracted.
Complete Source
1CREATE trigger QER_TUPersonInBaseTree2 ON PersonInBaseTree FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @CfgUseGenProcID BIT = dbo.QBM_FCVStringToBit(dbo.QBM_FGIConfigparmValue('Common\ProcessState\UseGenProcIDFromPWO'))7 DECLARE @uid_personwantsorg varchar(38)8 DECLARE @BasisObjectKey varchar(138)9 DECLARE @GenProcIDToUse varchar(38)10 DECLARE @SQLcmd nvarchar(1000)11 DECLARE @UID_PWOStateFinalError nvarchar(64)12 DECLARE @ElementBuffer QBM_YCursorBuffer13 DECLARE @ElementCount int14 DECLARE @ElementIndex int15 BEGIN TRY16 IF EXISTS(17 SELECT TOP 1 118 FROM deleted)19 GOTO start20 IF EXISTS(21 SELECT TOP 1 122 FROM inserted)23 GOTO start24 RETURN start:25 DECLARE @GenProcID varchar(38)26 SELECT @GenProcID = dbo.QBM_FGISessionContext('')27 IF28 UPDATE(XOrigin)29 BEGIN30 IF EXISTS(31 SELECT TOP 1 132 FROM deleted d33 JOIN PersonInBaseTree i34 ON i.XObjectKey = d.XObjectKey35 JOIN Delegation dl36 ON d.XObjectKey = dl.ObjectKeyDelegated37 WHERE38 i.XOrigin = 0 AND d.XOrigin > 0)39 BEGIN40 INSERT INTO @ElementBuffer(UID1,41 ObjectKey1,42 UID2)43 SELECT44 pwo.uid_personwantsorg,45 pwo.XObjectKey,46 dbo.QER_FGIGenProcIDForPWO(pwo.GenProcID,47 @GenProcID,48 @CfgUseGenProcID) AS GenProcID49 FROM deleted d50 JOIN PersonInBaseTree i51 ON i.XObjectKey = d.XObjectKey52 JOIN Delegation dl53 ON d.XObjectKey = dl.ObjectKeyDelegated54 JOIN PersonWantsOrg pwo55 ON dl.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg56 WHERE57 pwo.OrderState IN('Assigned',58 'Granted',59 'New',60 'OrderProduct',61 'OrderProlongate',62 'OrderUnsubscribe',63 'Waiting') AND i.XOrigin = 0 AND d.XOrigin > 064 SELECT @ElementCount = @@ROWCOUNT65 SELECT @ElementIndex = 166 WHILE @ElementIndex <= @ElementCount67 BEGIN68 SELECT69 TOP 1 @uid_personwantsorg = bu.UID1,70 @BasisObjectKey = bu.ObjectKey1,71 @GenProcIDToUse = bu.UID272 FROM @ElementBuffer bu73 WHERE74 bu.ElementIndex = @ElementIndex75 SELECT @SQLcmd = N 'uid_personwantsorg = ''' + rtrim(@uid_personwantsorg) + N ''''76 SELECT @UID_PWOStateFinalError = dbo.QER_FGIPWOStateFinalError(@UID_PersonWantsOrg)77 EXEC QBM_PJobCreate_HOCallMethod @objecttype = 'personwantsorg',78 @whereclause = @SQLcmd,79 @save = 1,80 @MethodName = 'Abort',81 @GenProcID = @GenProcIDToUse,82 @ObjectKeysAffected = DEFAULT,83 @param1 = '#LDS#Closing delegation because its source was deleted.|',84 @param2 = @UID_PWOStateFinalError,85 @Retries = 3,86 @isToFreezeOnError = 1,87 @BasisObjectKey = @BasisObjectKey,88 @checkForExisting = 1,89 @WhereClauseAdditional = ' OrderState in (''Assigned'', ''Granted'', ''New'', ''OrderProduct'', ''OrderProlongate'', ''OrderUnsubscribe'', ''Waiting'')'90 SELECT @ElementIndex += 191 END92 DELETE Delegation93 FROM deleted d94 JOIN PersonInBaseTree i95 ON i.XObjectKey = d.XObjectKey96 JOIN Delegation dl97 ON d.XObjectKey = dl.ObjectKeyDelegated98 WHERE99 i.XOrigin = 0 AND d.XOrigin > 0100 END101 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw102 INSERT INTO @DBQueueElements_02(object,103 subobject,104 genprocid)105 SELECT106 x.uid_parameter,107 x.uid_SubParameter,108 @GenProcID109 FROM(110 SELECT111 d.uid_person AS uid_parameter,112 d.uid_org AS uid_subparameter113 FROM deleted d114 JOIN PersonInBaseTree a115 ON d.XObjectKey = a.XObjectKey116 WHERE117 dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, 1, 1) = 1) AS x118 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllForPersonInBaseTree',119 @DBQueueElements_02120 END121 END TRY122 BEGIN CATCH123 EXEC QBM_PSessionErrorAdd DEFAULT124 RAISERROR('',125 18,126 1)127 WITH NOWAIT128 END CATCH129 ende:130 RETURN131END
Open raw exported source
1create trigger QER_TUPersonInBaseTree on PersonInBaseTree for Update not for Replication as begin declare @CfgUseGenProcID bit = dbo.QBM_FCVStringToBit2(dbo.QBM_FGIConfigparmValue('Common\ProcessState\UseGenProcIDFromPWO')) declare @uid_personwantsorg varchar(38) declare @BasisObjectKey varchar(138) declare3 @GenProcIDToUse varchar(38) declare @SQLcmd nvarchar(1000) declare @UID_PWOStateFinalError nvarchar(64) declare @ElementBuffer QBM_YCursorBuffer declare4 @ElementCount int declare @ElementIndex int BEGIN TRY if exists (select top 1 1 from deleted) goto start if exists (select top 1 1 from inserted) goto5 start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('') if update(XOrigin) begin if exists (select top 61 1 from deleted d join PersonInBaseTree i on i.XObjectKey = d.XObjectKey join Delegation dl on d.XObjectKey = dl.ObjectKeyDelegated where i.XOrigin = 70 and d.XOrigin > 0 ) begin insert into @ElementBuffer(UID1, ObjectKey1, UID2) select pwo.uid_personwantsorg, pwo.XObjectKey , dbo.QER_FGIGenProcIDForPWO8(pwo.GenProcID, @GenProcID, @CfgUseGenProcID) as GenProcID from deleted d join PersonInBaseTree i on i.XObjectKey = d.XObjectKey join Delegation dl on 9d.XObjectKey = dl.ObjectKeyDelegated join PersonWantsOrg pwo on dl.UID_PersonWantsOrg = pwo.UID_PersonWantsOrg where pwo.OrderState in ('Assigned', 10'Granted', 'New', 'OrderProduct', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') and i.XOrigin = 0 and d.XOrigin > 0 select @ElementCount = @@ROWCOUNT11 select @ElementIndex = 1 while @ElementIndex <= @ElementCount begin select top 1 @uid_personwantsorg = bu.UID1 , @BasisObjectKey = bu.ObjectKey1 , @GenProcIDToUse12 = bu.UID2 from @ElementBuffer bu where bu.ElementIndex = @ElementIndex select @SQLcmd = N'uid_personwantsorg = ''' + rtrim(@uid_personwantsorg) + N''''13 select @UID_PWOStateFinalError = dbo.QER_FGIPWOStateFinalError(@UID_PersonWantsOrg) exec QBM_PJobCreate_HOCallMethod @objecttype = 'personwantsorg' ,14 @whereclause = @SQLcmd , @save = 1 , @MethodName = 'Abort' , @GenProcID = @GenProcIDToUse , @ObjectKeysAffected = default , @param1 = '#LDS#Closing delegation because its source was deleted.|'15 , @param2 = @UID_PWOStateFinalError , @Retries = 3 , @isToFreezeOnError = 1 , @BasisObjectKey = @BasisObjectKey , @checkForExisting = 1 , @WhereClauseAdditional16 = ' OrderState in (''Assigned'', ''Granted'', ''New'', ''OrderProduct'', ''OrderProlongate'', ''OrderUnsubscribe'', ''Waiting'')' select @ElementIndex17 += 1 end delete Delegation from deleted d join PersonInBaseTree i on i.XObjectKey = d.XObjectKey join Delegation dl on d.XObjectKey = dl.ObjectKeyDelegated18 where i.XOrigin = 0 and d.XOrigin > 0 end declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid)19 select x.uid_parameter, x.uid_SubParameter, @GenProcID from ( select d.uid_person as uid_parameter, d.uid_org as uid_subparameter from deleted d join 20PersonInBaseTree a on d.XObjectKey = a.XObjectKey where dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, 1, 1) = 1 ) as x exec QBM_PDBQueueInsert_Bulk21 'QER-K-AllForPersonInBaseTree', @DBQueueElements_02 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH22 ende: return end 23