dbo.QER_TUBaseTreeHasQERReuse
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-BaseTreeHasObject / QER_ZBaseTreeHasObject at line 6
- Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 6
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 6
- Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 6
- Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 8
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 8
- Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 8
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 10
- Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 10
- Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 13
- References QBM_PDBQueueInsert_Bulk
- Trigger parent table: BaseTreeHasQERReuse
Typed Edges
- queues DBQueue task QER_ZBaseTreeHasObject at line 6 Bulk DBQueue insert -> QER-K-BaseTreeHasObject / QER_ZBaseTreeHasObject at line 6
- queues DBQueue task QER_ZAllChildrenOfOrg at line 6 Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 6
- queues DBQueue task QER_ZITShopProductNodeCheck at line 6 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 6
- queues DBQueue task QER_ZPersonHasQERReuse at line 6 Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 6
- queues DBQueue task QER_ZAllChildrenOfOrg at line 8 Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 8
- queues DBQueue task QER_ZITShopProductNodeCheck at line 8 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 8
- queues DBQueue task QER_ZPersonHasQERReuse at line 8 Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 8
- queues DBQueue task QER_ZITShopProductNodeCheck at line 10 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 10
- queues DBQueue task QER_ZPersonHasQERReuse at line 10 Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 10
- queues DBQueue task QER_ZPersonHasQERReuse at line 13 Bulk DBQueue insert -> QER-K-PersonHasQERReuse / QER_ZPersonHasQERReuse at line 13
- trigger on table BaseTreeHasQERReuse Trigger parent table: BaseTreeHasQERReuse
- references source dbo.QBM_FGISessionContext source text reference
- references source dbo.QBM_FGIXOriginChanged_Effect source text reference
- references source dbo.QBM_PDBQueueInsert_Bulk source text reference
- references source dbo.QBM_PSessionErrorAdd source text reference
- references source dbo.QER_TUBaseTree source text reference
Complete Source
1CREATE trigger QER_TUBaseTreeHasQERReuse2 ON BaseTreeHasQERReuse FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @ChangedOrg QBM_YSingleGUID7 BEGIN TRY8 IF EXISTS(9 SELECT TOP 1 110 FROM inserted)11 GOTO start12 IF EXISTS(13 SELECT TOP 1 114 FROM deleted)15 GOTO start16 RETURN start:17 DECLARE @GenProcID varchar(38)18 SELECT @GenProcID = dbo.QBM_FGISessionContext('')19 IF20 UPDATE(XOrigin) OR21 UPDATE(XIsInEffect)22 BEGIN23 INSERT INTO @ChangedOrg(UID_SingleGuid)24 SELECT25 DISTINCT d.UID_Org AS uid26 FROM BaseTreeHasQERReuse a27 JOIN deleted d28 ON a.XObjectKey = d.XObjectKey29 WHERE30 dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin,31 a.XOrigin,32 d.XIsInEffect,33 a.XIsInEffect) = 134 IF @@ROWCOUNT > 035 BEGIN36 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw37 INSERT INTO @DBQueueElements_01(object,38 subobject,39 genprocid)40 SELECT41 x.uid,42 NULL,43 @GenProcID44 FROM(45 SELECT c.UID_SingleGuid AS uid46 FROM @ChangedOrg c) AS x47 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeHasObject',48 @DBQueueElements_0149 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw50 INSERT INTO @DBQueueElements_02(object,51 subobject,52 genprocid)53 SELECT54 x.uid,55 'QER-K-OrgHasQERReuse',56 @GenProcID57 FROM(58 SELECT c.UID_SingleGuid AS uid59 FROM @ChangedOrg c) AS x60 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg',61 @DBQueueElements_0262 DECLARE @DBQueueElements_03 QBM_YDBQueueRaw63 INSERT INTO @DBQueueElements_03(object,64 subobject,65 genprocid)66 SELECT67 x.uid,68 NULL,69 @GenProcID70 FROM(71 SELECT b.UID_Org AS uid72 FROM @ChangedOrg c73 JOIN BaseTree b74 ON c.UID_SingleGuid = b.UID_Org75 WHERE76 b.ITShopInfo = 'BO') AS x77 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild',78 @DBQueueElements_0379 DECLARE @DBQueueElements_04 QBM_YDBQueueRaw80 INSERT INTO @DBQueueElements_04(object,81 subobject,82 genprocid)83 SELECT84 x.uid,85 NULL,86 @GenProcID87 FROM(88 SELECT pio.UID_Person AS uid89 FROM @ChangedOrg c90 JOIN PersoninBaseTree pio91 ON c.UID_SingleGuid = pio.UID_Org AND pio.XOrigin > 092 UNION93 SELECT hpo.UID_Person AS uid94 FROM @ChangedOrg c95 JOIN HelperPersonOrg hpo96 ON c.UID_SingleGuid = hpo.UID_Org) AS x97 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-PersonHasQERReuse',98 @DBQueueElements_0499 END100 END101 END TRY102 BEGIN CATCH103 EXEC QBM_PSessionErrorAdd DEFAULT104 RAISERROR('',105 18,106 1)107 WITH NOWAIT108 END CATCH109 ende:110 RETURN111END
Open raw exported source
1create trigger QER_TUBaseTreeHasQERReuse on BaseTreeHasQERReuse for Update not for Replication as begin declare @ChangedOrg QBM_YSingleGUID 2BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar3(38) select @GenProcID = dbo.QBM_FGISessionContext('') if update(XOrigin) or update(XIsInEffect) begin insert into @ChangedOrg (UID_SingleGuid) select 4distinct d.UID_Org as uid from BaseTreeHasQERReuse a join deleted d on a.XObjectKey = d.XObjectKey where dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin5, d.XIsInEffect, a.XIsInEffect) = 1 if @@ROWCOUNT > 0 begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject6, genprocid) select x.uid, null, @GenProcID from ( select c.UID_SingleGuid as uid from @ChangedOrg c ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeHasObject'7, @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, 'QER-K-OrgHasQERReuse'8, @GenProcID from ( select c.UID_SingleGuid as uid from @ChangedOrg c ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg', @DBQueueElements_029 declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select10 b.UID_Org as uid from @ChangedOrg c join BaseTree b on c.UID_SingleGuid = b.UID_Org where b.ITShopInfo = 'BO' ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild'11, @DBQueueElements_03 declare @DBQueueElements_04 QBM_YDBQueueRaw insert into @DBQueueElements_04 (object, subobject, genprocid) select x.uid, null, @GenProcID12 from ( select pio.UID_Person as uid from @ChangedOrg c join PersoninBaseTree pio on c.UID_SingleGuid = pio.UID_Org and pio.XOrigin > 0 union select hpo.UID_Person13 as uid from @ChangedOrg c join HelperPersonOrg hpo on c.UID_SingleGuid = hpo.UID_Org ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-PersonHasQERReuse', @DBQueueElements_0414 end end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 15