Back to OIM Explorer

dbo.RPS_TIBaseTreeHasRPSReport

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on BaseTreeHasRPSReport. Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 12; Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 12; Bulk DBQueue insert -> RPS-K-BaseTreeHasObject / RPS_ZBaseTreeHasObject at line 12; Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 12

Source: sandbox-db sys.sql_modules

Source size: 3.218 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 -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 12
  • Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 12
  • Bulk DBQueue insert -> RPS-K-BaseTreeHasObject / RPS_ZBaseTreeHasObject at line 12
  • Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 12
  • Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 15
  • Bulk DBQueue insert -> RPS-K-BaseTreeHasObject / RPS_ZBaseTreeHasObject at line 15
  • Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 15
  • Bulk DBQueue insert -> RPS-K-BaseTreeHasObject / RPS_ZBaseTreeHasObject at line 17
  • Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 17
  • Bulk DBQueue insert -> RPS-K-PersonHasRPSReport / RPS_ZPersonHasRPSReport at line 20
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: BaseTreeHasRPSReport

Typed Edges

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

Complete Source

SQL146 lines
1CREATE trigger RPS_TIBaseTreeHasRPSReport2  ON BaseTreeHasRPSReport FOR3INSERT NOT FOR Replication4AS5BEGIN6  DECLARE @QBM_BitPatternXOrigin_Direct int = dbo.QBM_FGIBitPatternXOrigin('|Direct|',7  0)8  DECLARE @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',9  1)10  BEGIN TRY11    IF EXISTS(12      SELECT TOP 1 113      FROM inserted)14    GOTO start15    RETURN start:16    DECLARE @GenProcID varchar(38)17    SELECT @GenProcID = dbo.QBM_FGISessionContext('')18    DECLARE @AssignCheckValues QBM_YparameterList19    INSERT INTO @AssignCheckValues(Parameter1,20    Parameter2)21    SELECT22      i.UID_Org,23      i.XOrigin24    FROM inserted i25    EXEC QER_PAssignmentCheckValid 'RPS-AsgnBT-RPSReport',26      @AssignCheckValues,27      @GenProcID28    IF EXISTS(29      SELECT TOP 1 130      FROM inserted i31      JOIN RPSReport p32        ON i.UID_RPSReport = p.UID_RPSReport AND p.isInactive = 133      JOIN BaseTree b34        ON i.uid_org = b.uid_org AND(b.uid_orgroot < 'QER-V-ITShopOrg' OR b.uid_orgroot > 'QER-V-ITShopOrg'))35    BEGIN36      RAISERROR('#LDS#Assignment cannot take place, because the object to be assigned is disabled.|',37      18,38      3)39        WITH nowait40    END41    DECLARE @ITShopInfo nvarchar(2)42    IF EXISTS(43      SELECT TOP 1 144      FROM inserted i45      JOIN BaseTree dest46        ON i.uid_org = dest.uid_Org47      JOIN RPSReport elem48        ON i.uid_RPSReport = elem.uid_RPSReport49      WHERE50        dbo.QER_FGIITShopFlagCombineValid(dest.XObjectKey, NULL, NULL, elem.XObjectKey, elem.IsForITShop,51    elem.IsITShopOnly) = 0 AND i.XOrigin & @QBM_BitPatternXOrigin_Direct > 0)52    BEGIN53      RAISERROR('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|',54      18,55      2)56        WITH nowait57    END58    DECLARE @DBQueueElements_01 QBM_YDBQueueRaw59    INSERT INTO @DBQueueElements_01(object,60    subobject,61    genprocid)62    SELECT63      x.uid,64      x.subobject,65      @GenProcID66    FROM(67    SELECT68      DISTINCT i.uid_org AS uid,69      'RPS-K-OrgHasRPSReport' AS subobject70    FROM inserted i71    WHERE72      i.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0) AS x73    EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg',74      @DBQueueElements_0175    DECLARE @DBQueueElements_02 QBM_YDBQueueRaw76    INSERT INTO @DBQueueElements_02(object,77    subobject,78    genprocid)79    SELECT80      x.uid,81      NULL,82      @GenProcID83    FROM(84    SELECT85      DISTINCT i.uid_org AS uid86    FROM inserted i87    JOIN BaseTree b88      ON i.uid_Org = b.uid_org89    WHERE90      b.ITShopInfo = 'BO' AND i.XIsInEffect = 1) AS x91    EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild',92      @DBQueueElements_0293    DECLARE @DBQueueElements_03 QBM_YDBQueueRaw94    INSERT INTO @DBQueueElements_03(object,95    subobject,96    genprocid)97    SELECT98      x.uid,99      NULL,100      @GenProcID101    FROM(102    SELECT103      DISTINCT i.uid_org AS uid104    FROM inserted i105    WHERE106      i.XIsInEffect = 1) AS x107    EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-BaseTreeHasObject',108      @DBQueueElements_03109    DECLARE @DBQueueElements_04 QBM_YDBQueueRaw110    INSERT INTO @DBQueueElements_04(object,111    subobject,112    genprocid)113    SELECT114      x.uid,115      NULL,116      @GenProcID117    FROM(118    SELECT119      DISTINCT hpo.uid_person AS uid120    FROM inserted i121    JOIN(122    SELECT123      pio.uid_person, pio.uid_org124    FROM personinBaseTree pio125    WHERE126      pio.XOrigin > 0127    UNION all128    SELECT129      uid_person, uid_org130    FROM helperPersonOrg) hpo131      ON hpo.uid_org = i.uid_org132    WHERE133      i.XIsInEffect = 1) AS x134    EXEC QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport',135      @DBQueueElements_04136  END TRY137  BEGIN CATCH138    EXEC QBM_PSessionErrorAdd DEFAULT139    RAISERROR('',140    18,141    1)142      WITH NOWAIT143  END CATCH144  ende:145  RETURN146END
Open raw exported source
SQL ยท Raw22 lines
1  create   trigger RPS_TIBaseTreeHasRPSReport on BaseTreeHasRPSReport  for Insert not for Replication as begin  declare @QBM_BitPatternXOrigin_Direct2 int = dbo.QBM_FGIBitPatternXOrigin('|Direct|', 0) declare @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 1)  BEGIN3 TRY if exists (select top 1 1 from inserted) goto start return start: declare @GenProcID varchar(38) select @GenProcID = dbo.QBM_FGISessionContext('')4 declare @AssignCheckValues QBM_YparameterList insert into @AssignCheckValues(Parameter1, Parameter2) select i.UID_Org, i.XOrigin from inserted i exec 5QER_PAssignmentCheckValid 'RPS-AsgnBT-RPSReport', @AssignCheckValues, @GenProcID  if exists (select top 1 1 from inserted i join RPSReport p on i.UID_RPSReport6 = p.UID_RPSReport and p.isInactive = 1 join BaseTree b on i.uid_org = b.uid_org and (b.uid_orgroot < 'QER-V-ITShopOrg' or b.uid_orgroot > 'QER-V-ITShopOrg'7 ) ) begin  raiserror( '#LDS#Assignment cannot take place, because the object to be assigned is disabled.|', 18, 3) with nowait end declare @ITShopInfo8 nvarchar(2)  if exists (select top 1 1 from inserted i join BaseTree dest on i.uid_org = dest.uid_Org  join RPSReport elem on i.uid_RPSReport = elem.uid_RPSReport9 where dbo.QER_FGIITShopFlagCombineValid(dest.XObjectKey, null, null, elem.XObjectKey, elem.IsForITShop, elem.IsITShopOnly) = 0 and i.XOrigin & @QBM_BitPatternXOrigin_Direct10 > 0 ) begin  raiserror ('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|', 18, 2) with nowait end  declare @DBQueueElements_0111 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, x.subobject, @GenProcID from ( select distinct i.uid_org 12as uid , 'RPS-K-OrgHasRPSReport' as subobject from inserted i  where i.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0  ) as x exec QBM_PDBQueueInsert_Bulk13 'QER-K-AllChildrenOfOrg', @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid14) select x.uid, null, @GenProcID from ( select distinct i.uid_org as uid from inserted i join BaseTree b on i.uid_Org = b.uid_org where b.ITShopInfo = 15'BO' and i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild', @DBQueueElements_02 declare @DBQueueElements_03 QBM_YDBQueueRaw insert16 into @DBQueueElements_03 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct i.uid_org as uid from inserted i where i.XIsInEffect17 = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-BaseTreeHasObject', @DBQueueElements_03 declare @DBQueueElements_04 QBM_YDBQueueRaw insert into @DBQueueElements_0418 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct hpo.uid_person as uid from inserted i join (select pio.uid_person19, pio.uid_org from personinBaseTree pio where pio.XOrigin > 0 union all select uid_person, uid_org from helperPersonOrg ) hpo on hpo.uid_org = i.uid_org20 where i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'RPS-K-PersonHasRPSReport', @DBQueueElements_04 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd21 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 22