Back to OIM Explorer

dbo.RPS_TUBaseTreeHasRPSReport

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on BaseTreeHasRPSReport. Bulk DBQueue insert -> RPS-K-BaseTreeHasObject / RPS_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 -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 6

Source: sandbox-db sys.sql_modules

Source size: 2.459 characters

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 -> RPS-K-BaseTreeHasObject / RPS_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 -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 6
  • Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 10
  • Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 10
  • Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 10
  • Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 12
  • Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 12
  • Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 15
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: BaseTreeHasRPSReport

Typed Edges

  • queues DBQueue task RPS_ZBaseTreeHasObject at line 6 Bulk DBQueue insert -> RPS-K-BaseTreeHasObject / RPS_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 RPS_ZPersonHasRPSReport at line 6 Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 6
  • queues DBQueue task QER_ZAllChildrenOfOrg at line 10 Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 10
  • queues DBQueue task QER_ZITShopProductNodeCheck at line 10 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 10
  • queues DBQueue task RPS_ZPersonHasRPSReport at line 10 Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 10
  • queues DBQueue task QER_ZITShopProductNodeCheck at line 12 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 12
  • queues DBQueue task RPS_ZPersonHasRPSReport at line 12 Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 12
  • queues DBQueue task RPS_ZPersonHasRPSReport at line 15 Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 15
  • trigger on table BaseTreeHasRPSReport Trigger parent table: BaseTreeHasRPSReport
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_FGIXOriginChanged_Effect source text reference
  • references source dbo.QER_FCVXOriginToInheritInfo source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL117 lines
1CREATE trigger RPS_TUBaseTreeHasRPSReport2  ON BaseTreeHasRPSReport 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      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw24      INSERT INTO @DBQueueElements_01(object,25      subobject,26      genprocid)27      SELECT28        x.uid,29        NULL,30        @GenProcID31      FROM(32      SELECT33        DISTINCT a.UID_Org AS uid34      FROM BaseTreeHasRPSReport a35      JOIN deleted d36        ON a.XObjectKey = d.XObjectKey37      WHERE38        (dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 OR dbo.QER_FCVXOriginToInheritInfo(d.XOrigin) <>39      dbo.QER_FCVXOriginToInheritInfo(a.XOrigin))) AS x40      EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-BaseTreeHasObject',41        @DBQueueElements_0142      INSERT INTO @ChangedOrg(UID_SingleGuid)43      SELECT44        DISTINCT d.UID_Org AS uid45      FROM BaseTreeHasRPSReport a46      JOIN deleted d47        ON a.XObjectKey = d.XObjectKey48      WHERE49        dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin,50      a.XOrigin,51      d.XIsInEffect,52      a.XIsInEffect) = 153      IF @@ROWCOUNT > 054      BEGIN55        DECLARE @DBQueueElements_02 QBM_YDBQueueRaw56        INSERT INTO @DBQueueElements_02(object,57        subobject,58        genprocid)59        SELECT60          x.uid,61          'RPS-K-OrgHasRPSReport',62          @GenProcID63        FROM(64        SELECT c.UID_SingleGuid AS uid65        FROM @ChangedOrg c) AS x66        EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg',67          @DBQueueElements_0268        DECLARE @DBQueueElements_03 QBM_YDBQueueRaw69        INSERT INTO @DBQueueElements_03(object,70        subobject,71        genprocid)72        SELECT73          x.uid,74          NULL,75          @GenProcID76        FROM(77        SELECT b.UID_Org AS uid78        FROM @ChangedOrg c79        JOIN BaseTree b80          ON c.UID_SingleGuid = b.UID_Org81        WHERE82          b.ITShopInfo = 'BO') AS x83        EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild',84          @DBQueueElements_0385        DECLARE @DBQueueElements_04 QBM_YDBQueueRaw86        INSERT INTO @DBQueueElements_04(object,87        subobject,88        genprocid)89        SELECT90          x.uid,91          NULL,92          @GenProcID93        FROM(94        SELECT pio.UID_Person AS uid95        FROM @ChangedOrg c96        JOIN PersoninBaseTree pio97          ON c.UID_SingleGuid = pio.UID_Org AND pio.XOrigin > 098        UNION99        SELECT hpo.UID_Person AS uid100        FROM @ChangedOrg c101        JOIN HelperPersonOrg hpo102          ON c.UID_SingleGuid = hpo.UID_Org) AS x103        EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport',104          @DBQueueElements_04105      END106    END107  END TRY108  BEGIN CATCH109    EXEC QBM_PSessionErrorAdd DEFAULT110    RAISERROR('',111    18,112    1)113      WITH NOWAIT114  END CATCH115  ende:116  RETURN117END
Open raw exported source
SQL ยท Raw17 lines
1create   trigger RPS_TUBaseTreeHasRPSReport on BaseTreeHasRPSReport  for Update not for Replication as begin  declare @ChangedOrg QBM_YSingleGUID2 BEGIN 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 declare @DBQueueElements_01 QBM_YDBQueueRaw insert4 into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct a.UID_Org as uid from BaseTreeHasRPSReport5 a join deleted d on a.XObjectKey = d.XObjectKey where ( dbo.QBM_FGIXOriginChanged_Effect(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 or dbo.QER_FCVXOriginToInheritInfo6(d.XOrigin) <> dbo.QER_FCVXOriginToInheritInfo(a.XOrigin) ) ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-BaseTreeHasObject', @DBQueueElements_01 insert into7 @ChangedOrg (UID_SingleGuid) select distinct d.UID_Org as uid from BaseTreeHasRPSReport a join deleted d on a.XObjectKey = d.XObjectKey where dbo.QBM_FGIXOriginChanged_Effect8(d.XOrigin, a.XOrigin, d.XIsInEffect, a.XIsInEffect) = 1 if @@ROWCOUNT > 0  begin declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_029 (object, subobject, genprocid) select x.uid, 'RPS-K-OrgHasRPSReport', @GenProcID from ( select c.UID_SingleGuid as uid from @ChangedOrg c ) as x exec 10QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg', @DBQueueElements_02 declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object11, subobject, genprocid) select x.uid, null, @GenProcID from ( select b.UID_Org as uid from @ChangedOrg c join BaseTree b on c.UID_SingleGuid = b.UID_Org12 where b.ITShopInfo = 'BO' ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild', @DBQueueElements_03 declare @DBQueueElements_04 QBM_YDBQueueRaw insert13 into @DBQueueElements_04 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select pio.UID_Person as uid from @ChangedOrg c join PersoninBaseTree14 pio on c.UID_SingleGuid = pio.UID_Org and pio.XOrigin > 0 union select hpo.UID_Person as uid from @ChangedOrg c join HelperPersonOrg hpo on c.UID_SingleGuid15 = hpo.UID_Org ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport', @DBQueueElements_04 end  end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd16 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 17