Back to OIM Explorer

dbo.RMS_TIBaseTreeHasESet

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on BaseTreeHasESet. Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 11; Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 11; Bulk DBQueue insert -> RMS-K-BaseTreeHasObject / RMS_ZBaseTreeHasObject at line 11; Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 11

Source: sandbox-db sys.sql_modules

Source size: 4.553 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 11
  • Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 11
  • Bulk DBQueue insert -> RMS-K-BaseTreeHasObject / RMS_ZBaseTreeHasObject at line 11
  • Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 11
  • Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 11
  • Bulk DBQueue insert -> at line 11
  • Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 13
  • Bulk DBQueue insert -> RMS-K-BaseTreeHasObject / RMS_ZBaseTreeHasObject at line 13
  • Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 13
  • Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 13
  • Bulk DBQueue insert -> at line 13
  • Bulk DBQueue insert -> RMS-K-BaseTreeHasObject / RMS_ZBaseTreeHasObject at line 15
  • Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 15
  • Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 15
  • Bulk DBQueue insert -> at line 15
  • Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 18
  • Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 18
  • Bulk DBQueue insert -> at line 18
  • Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 21
  • Bulk DBQueue insert -> at line 21
  • Bulk DBQueue insert -> at line 28
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: BaseTreeHasESet

Typed Edges

  • queues DBQueue task QER_ZAllChildrenOfOrg at line 11 Bulk DBQueue insert -> QER-K-AllChildrenOfOrg / QER_ZAllChildrenOfOrg at line 11
  • queues DBQueue task QER_ZITShopProductNodeCheck at line 11 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 11
  • queues DBQueue task RMS_ZBaseTreeHasObject at line 11 Bulk DBQueue insert -> RMS-K-BaseTreeHasObject / RMS_ZBaseTreeHasObject at line 11
  • queues DBQueue task RMS_ZPersonHasESet at line 11 Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 11
  • queues DBQueue task RMS_ZWorkDeskHasESet at line 11 Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 11
  • queues DBQueue task at line 11 Bulk DBQueue insert -> at line 11
  • queues DBQueue task QER_ZITShopProductNodeCheck at line 13 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 13
  • queues DBQueue task RMS_ZBaseTreeHasObject at line 13 Bulk DBQueue insert -> RMS-K-BaseTreeHasObject / RMS_ZBaseTreeHasObject at line 13
  • queues DBQueue task RMS_ZPersonHasESet at line 13 Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 13
  • queues DBQueue task RMS_ZWorkDeskHasESet at line 13 Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 13
  • queues DBQueue task at line 13 Bulk DBQueue insert -> at line 13
  • queues DBQueue task RMS_ZBaseTreeHasObject at line 15 Bulk DBQueue insert -> RMS-K-BaseTreeHasObject / RMS_ZBaseTreeHasObject at line 15
  • queues DBQueue task RMS_ZPersonHasESet at line 15 Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 15
  • queues DBQueue task RMS_ZWorkDeskHasESet at line 15 Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 15
  • queues DBQueue task at line 15 Bulk DBQueue insert -> at line 15
  • queues DBQueue task RMS_ZPersonHasESet at line 18 Bulk DBQueue insert -> RMS-K-PersonHasESet / RMS_ZPersonHasESet at line 18
  • queues DBQueue task RMS_ZWorkDeskHasESet at line 18 Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 18
  • queues DBQueue task at line 18 Bulk DBQueue insert -> at line 18
  • queues DBQueue task RMS_ZWorkDeskHasESet at line 21 Bulk DBQueue insert -> RMS-K-WorkdeskHasESet / RMS_ZWorkDeskHasESet at line 21
  • queues DBQueue task at line 21 Bulk DBQueue insert -> at line 21
  • queues DBQueue task at line 28 Bulk DBQueue insert -> at line 28
  • trigger on table BaseTreeHasESet Trigger parent table: BaseTreeHasESet
  • 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

SQL208 lines
1CREATE trigger RMS_TIBaseTreeHasESet2  ON BaseTreeHasESet FOR3INSERT NOT FOR Replication4AS5BEGIN6  DECLARE @EsetOperation varchar(38)7  DECLARE @EsetTable varchar(30)8  DECLARE @ElementBuffer QBM_YCursorBuffer9  DECLARE @ElementCount int10  DECLARE @ElementIndex int11  DECLARE @QBM_BitPatternXOrigin_Direct int = dbo.QBM_FGIBitPatternXOrigin('|Direct|',12  0)13  DECLARE @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',14  1)15  DECLARE @DBQueueElements_spezial QBM_YDBQueueRaw16  BEGIN TRY17    IF EXISTS(18      SELECT TOP 1 119      FROM inserted)20    GOTO start21    RETURN start:22    DECLARE @GenProcID varchar(38)23    SELECT @GenProcID = dbo.QBM_FGISessionContext('')24    DECLARE @AssignCheckValues QBM_YparameterList25    INSERT INTO @AssignCheckValues(Parameter1,26    Parameter2)27    SELECT28      i.UID_Org,29      i.XOrigin30    FROM inserted i31    EXEC QER_PAssignmentCheckValid 'RMS-AsgnBT-Eset',32      @AssignCheckValues,33      @GenProcID34    IF EXISTS(35      SELECT TOP 1 136      FROM inserted i37      JOIN BaseTree dest38        ON i.uid_Org = dest.uid_Org39      JOIN ESet elem40        ON i.uid_ESet = elem.uid_ESet41      WHERE42        dbo.QER_FGIITShopFlagCombineValid(dest.XObjectKey, NULL, NULL, elem.XObjectKey, elem.IsForITShop,43    elem.IsITShopOnly) = 0 AND i.XOrigin & @QBM_BitPatternXOrigin_Direct > 0)44    BEGIN45      RAISERROR('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|',46      18,47      2)48        WITH nowait49    END50    DECLARE @DBQueueElements_01 QBM_YDBQueueRaw51    INSERT INTO @DBQueueElements_01(object,52    subobject,53    genprocid)54    SELECT55      x.uid,56      'RMS-K-OrgHasESet',57      @GenProcID58    FROM(59    SELECT60      DISTINCT d.UID_Org AS uid61    FROM inserted d62    WHERE63      d.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0) AS x64    EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg',65      @DBQueueElements_0166    DECLARE @DBQueueElements_02 QBM_YDBQueueRaw67    INSERT INTO @DBQueueElements_02(object,68    subobject,69    genprocid)70    SELECT71      x.uid,72      NULL,73      @GenProcID74    FROM(75    SELECT76      DISTINCT d.UID_Org AS uid77    FROM inserted d78    JOIN BaseTree b79      ON d.uid_Org = b.uid_Org80    WHERE81      b.ITShopInfo = 'BO' AND d.XIsInEffect = 1) AS x82    EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild',83      @DBQueueElements_0284    DECLARE @DBQueueElements_03 QBM_YDBQueueRaw85    INSERT INTO @DBQueueElements_03(object,86    subobject,87    genprocid)88    SELECT89      x.uid,90      NULL,91      @GenProcID92    FROM(93    SELECT94      DISTINCT i.uid_org AS uid95    FROM inserted i96    WHERE97      i.XIsInEffect = 1) AS x98    EXEC QBM_PDBQueueInsert_Bulk 'RMS-K-BaseTreeHasObject',99      @DBQueueElements_03100    DECLARE @DBQueueElements_04 QBM_YDBQueueRaw101    INSERT INTO @DBQueueElements_04(object,102    subobject,103    genprocid)104    SELECT105      x.uid,106      NULL,107      @GenProcID108    FROM(109    SELECT110      DISTINCT hpo.uid_person AS uid111    FROM inserted i112    JOIN(113    SELECT114      pio.uid_person, pio.uid_org115    FROM personinBaseTree pio116    WHERE117      pio.XOrigin > 0118    UNION all119    SELECT120      uid_person, uid_org121    FROM helperPersonOrg) hpo122      ON hpo.uid_org = i.uid_org123    WHERE124      i.XIsInEffect = 1) AS x125    EXEC QBM_PDBQueueInsert_Bulk 'RMS-K-PersonHasESet',126      @DBQueueElements_04127    DECLARE @DBQueueElements_05 QBM_YDBQueueRaw128    INSERT INTO @DBQueueElements_05(object,129    subobject,130    genprocid)131    SELECT132      x.uid,133      NULL,134      @GenProcID135    FROM(136    SELECT137      DISTINCT hwo.uid_WorkDesk AS uid138    FROM inserted i139    JOIN(140    SELECT141      pio.uid_WorkDesk, pio.uid_org142    FROM WorkDeskinBaseTree pio143    WHERE144      pio.XOrigin > 0145    UNION all146    SELECT147      uid_WorkDesk, uid_org148    FROM helperWorkDeskOrg) hwo149      ON hwo.uid_org = i.uid_org150    WHERE151      i.XIsInEffect = 1) AS x152    EXEC QBM_PDBQueueInsert_Bulk 'RMS-K-WorkdeskHasESet',153      @DBQueueElements_05154    INSERT INTO @ElementBuffer(UID1,155    Ident1)156    SELECT157      DISTINCT v.UID_TaskBaseTree,158      t.TableName159    FROM inserted i160    JOIN ESetHasEntitlement ehe161      ON i.uid_ESet = ehe.uid_ESet AND ehe.XOrigin > 0162    JOIN DialogTable t163      ON ehe.Entitlement LIKE '<Key><T>' + t.TableName + '</T>%' AND t.TableName <> 'ESet'164    JOIN BaseTreeAssign v165      ON t.UID_DialogTable = v.UID_DialogTableElement166    WHERE167      v.UID_TaskBaseTree > ' '168    SELECT @ElementCount = @@rowcount169    SELECT @ElementIndex = 1170    WHILE @ElementIndex <= @ElementCount171    BEGIN172      SELECT173        TOP 1 @EsetOperation = bu.UID1,174        @EsetTable = bu.Ident1175      FROM @ElementBuffer bu176      WHERE177        bu.ElementIndex = @ElementIndex178      DELETE @DBQueueElements_spezial179      INSERT INTO @DBQueueElements_spezial(object,180      subobject,181      genprocid)182      SELECT183        x.uid,184        NULL,185        @GenProcID186      FROM(187      SELECT188        DISTINCT i.uid_org AS uid189      FROM inserted i190      JOIN ESetHasEntitlement ehe191        ON i.uid_ESet = ehe.uid_ESet AND ehe.XOrigin > 0192      WHERE193        ehe.Entitlement LIKE '<Key><T>' + @EsetTable + '</T>%' AND i.XIsInEffect = 1) AS x194      EXEC QBM_PDBQueueInsert_Bulk @EsetOperation,195        @DBQueueElements_spezial196      SELECT @ElementIndex += 1197    END198  END TRY199  BEGIN CATCH200    EXEC QBM_PSessionErrorAdd DEFAULT201    RAISERROR('',202    18,203    1)204      WITH NOWAIT205  END CATCH206  ende:207  RETURN208END
Open raw exported source
SQL ยท Raw30 lines
1  create   trigger RMS_TIBaseTreeHasESet on BaseTreeHasESet  for Insert not for Replication as begin  declare @EsetOperation varchar(38) declare2 @EsetTable varchar(30) declare @ElementBuffer QBM_YCursorBuffer declare @ElementCount int declare @ElementIndex int declare @QBM_BitPatternXOrigin_Direct3 int = dbo.QBM_FGIBitPatternXOrigin('|Direct|', 0) declare @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 1) declare4 @DBQueueElements_spezial QBM_YDBQueueRaw BEGIN TRY if exists (select top 1 1 from inserted) goto start return start: declare @GenProcID varchar(38) select5 @GenProcID = dbo.QBM_FGISessionContext('')  declare @AssignCheckValues QBM_YparameterList insert into @AssignCheckValues(Parameter1, Parameter2) select6 i.UID_Org, i.XOrigin from inserted i exec QER_PAssignmentCheckValid 'RMS-AsgnBT-Eset', @AssignCheckValues, @GenProcID  if exists (select top 1 1 from 7inserted i join BaseTree dest on i.uid_Org = dest.uid_Org  join ESet elem on i.uid_ESet = elem.uid_ESet where dbo.QER_FGIITShopFlagCombineValid(dest.XObjectKey8, null, null, elem.XObjectKey, elem.IsForITShop, elem.IsITShopOnly) = 0 and i.XOrigin & @QBM_BitPatternXOrigin_Direct > 0 ) begin  raiserror ('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|'9, 18, 2) with nowait end         declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01(object, subobject, genprocid) select x.uid10, 'RMS-K-OrgHasESet', @GenProcID from ( select distinct d.UID_Org as uid from inserted d where d.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0  ) as11 x exec QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg', @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_0212 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct d.UID_Org as uid from inserted d join BaseTree b on d.uid_Org = b.uid_Org13 where b.ITShopInfo = 'BO' and d.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild', @DBQueueElements_02 declare @DBQueueElements_0314 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct i.uid_org as uid 15from inserted i where i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'RMS-K-BaseTreeHasObject', @DBQueueElements_03 declare @DBQueueElements_04 16QBM_YDBQueueRaw insert into @DBQueueElements_04 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct hpo.uid_person as 17uid from inserted i join (select pio.uid_person, pio.uid_org from personinBaseTree pio where pio.XOrigin > 0 union all select uid_person, uid_org from 18helperPersonOrg ) hpo on hpo.uid_org = i.uid_org where i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'RMS-K-PersonHasESet', @DBQueueElements_0419 declare @DBQueueElements_05 QBM_YDBQueueRaw insert into @DBQueueElements_05 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select20 distinct hwo.uid_WorkDesk as uid from inserted i join (select pio.uid_WorkDesk, pio.uid_org from WorkDeskinBaseTree pio where pio.XOrigin > 0 union all21 select uid_WorkDesk, uid_org from helperWorkDeskOrg ) hwo on hwo.uid_org = i.uid_org where i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'RMS-K-WorkdeskHasESet'22, @DBQueueElements_05   insert into @ElementBuffer(UID1, Ident1) select distinct v.UID_TaskBaseTree, t.TableName from inserted i join ESetHasEntitlement23 ehe on i.uid_ESet = ehe.uid_ESet and ehe.XOrigin > 0  join DialogTable t on  ehe.Entitlement like '<Key><T>' + t.TableName + '</T>%' and t.TableName <>24 'ESet' join BaseTreeAssign v on t.UID_DialogTable = v.UID_DialogTableElement where v.UID_TaskBaseTree > ' ' select @ElementCount = @@rowcount select @ElementIndex25 = 1 while @ElementIndex <= @ElementCount begin select top 1 @EsetOperation = bu.UID1 , @EsetTable = bu.Ident1 from @ElementBuffer bu where bu.ElementIndex26 = @ElementIndex   delete  @DBQueueElements_spezial insert into @DBQueueElements_spezial (object, subobject, genprocid) select x.uid, null, @GenProcID 27from ( select distinct i.uid_org as uid from inserted i join ESetHasEntitlement ehe on i.uid_ESet = ehe.uid_ESet and ehe.XOrigin > 0  where  ehe.Entitlement28 like '<Key><T>' + @EsetTable + '</T>%' and i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk @EsetOperation, @DBQueueElements_spezial select @ElementIndex29 += 1 end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 30