Back to OIM Explorer

dbo.ADS_TIBaseTreeHasADSGroup

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on BaseTreeHasADSGroup. 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 -> ADS-K-ADSAccountInADSGroup / ADS_ZAccountInADSGroup at line 11; Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 11

Source: sandbox-db sys.sql_modules

Source size: 4.865 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 -> ADS-K-ADSAccountInADSGroup / ADS_ZAccountInADSGroup at line 11
  • Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 11
  • Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 11
  • Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 11
  • Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 14
  • Bulk DBQueue insert -> ADS-K-ADSAccountInADSGroup / ADS_ZAccountInADSGroup at line 14
  • Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 14
  • Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 14
  • Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 14
  • Bulk DBQueue insert -> ADS-K-ADSAccountInADSGroup / ADS_ZAccountInADSGroup at line 17
  • Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 17
  • Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 17
  • Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 17
  • Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 21
  • Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 21
  • Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 21
  • Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 23
  • Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 23
  • Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 30
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: BaseTreeHasADSGroup

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 ADS_ZAccountInADSGroup at line 11 Bulk DBQueue insert -> ADS-K-ADSAccountInADSGroup / ADS_ZAccountInADSGroup at line 11
  • queues DBQueue task ADS_ZContactInADSGroup at line 11 Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 11
  • queues DBQueue task ADS_ZBaseTreeHasObject at line 11 Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 11
  • queues DBQueue task ADS_ZADSMachineInADSGroup at line 11 Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 11
  • queues DBQueue task QER_ZITShopProductNodeCheck at line 14 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 14
  • queues DBQueue task ADS_ZAccountInADSGroup at line 14 Bulk DBQueue insert -> ADS-K-ADSAccountInADSGroup / ADS_ZAccountInADSGroup at line 14
  • queues DBQueue task ADS_ZContactInADSGroup at line 14 Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 14
  • queues DBQueue task ADS_ZBaseTreeHasObject at line 14 Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 14
  • queues DBQueue task ADS_ZADSMachineInADSGroup at line 14 Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 14
  • queues DBQueue task ADS_ZAccountInADSGroup at line 17 Bulk DBQueue insert -> ADS-K-ADSAccountInADSGroup / ADS_ZAccountInADSGroup at line 17
  • queues DBQueue task ADS_ZContactInADSGroup at line 17 Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 17
  • queues DBQueue task ADS_ZBaseTreeHasObject at line 17 Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 17
  • queues DBQueue task ADS_ZADSMachineInADSGroup at line 17 Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 17
  • queues DBQueue task ADS_ZContactInADSGroup at line 21 Bulk DBQueue insert -> ADS-K-ADSContactInADSGroup / ADS_ZContactInADSGroup at line 21
  • queues DBQueue task ADS_ZBaseTreeHasObject at line 21 Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 21
  • queues DBQueue task ADS_ZADSMachineInADSGroup at line 21 Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 21
  • queues DBQueue task ADS_ZBaseTreeHasObject at line 23 Bulk DBQueue insert -> ADS-K-BaseTreeHasObject / ADS_ZBaseTreeHasObject at line 23
  • queues DBQueue task ADS_ZADSMachineInADSGroup at line 23 Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 23
  • queues DBQueue task ADS_ZADSMachineInADSGroup at line 30 Bulk DBQueue insert -> ADS-K-ADSMachineInADSGroup / ADS_ZADSMachineInADSGroup at line 30
  • trigger on table BaseTreeHasADSGroup Trigger parent table: BaseTreeHasADSGroup
  • references source dbo.QBM_FGIBitPatternXOrigin source text reference
  • references source dbo.QBM_FGIConfigparmValue 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

SQL223 lines
1CREATE trigger ADS_TIBaseTreeHasADSGroup2  ON BaseTreeHasADSGroup 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 'ADS-AsgnBT-ADSGroup',26      @AssignCheckValues,27      @GenProcID28    IF EXISTS(29      SELECT TOP 1 130      FROM inserted i31      JOIN BaseTree dest32        ON i.uid_Org = dest.uid_Org33      JOIN ADSGroup elem34        ON i.uid_ADSGroup = elem.uid_ADSGroup35      WHERE36        dbo.QER_FGIITShopFlagCombineValid(dest.XObjectKey, NULL, NULL, elem.XObjectKey, elem.IsForITShop,37    elem.IsITShopOnly) = 0 AND i.XOrigin & @QBM_BitPatternXOrigin_Direct > 0)38    BEGIN39      RAISERROR('#LDS#Assignment is not permitted due to the combination of IT Shop flags.|',40      18,41      2)42        WITH nowait43    END44    IF EXISTS(45      SELECT TOP 1 146      FROM inserted i47      JOIN ADSGroup t48        ON i.UID_ADSGroup = t.UID_ADSGroup AND 1 = t.HasReadOnlyMemberships)49    BEGIN50      RAISERROR('#LDS#Cannot make assignment because it involves a group with read only memberships.|',51      18,52      2)53        WITH nowait54    END55    DECLARE @DBQueueElements_01 QBM_YDBQueueRaw56    INSERT INTO @DBQueueElements_01(object,57    subobject,58    genprocid)59    SELECT60      x.uid,61      'ADS-K-OrgHasADSGroup',62      @GenProcID63    FROM(64    SELECT65      DISTINCT d.uid_org AS uid66    FROM inserted d67    WHERE68      d.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0) AS x69    EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg',70      @DBQueueElements_0171    DECLARE @DBQueueElements_02 QBM_YDBQueueRaw72    INSERT INTO @DBQueueElements_02(object,73    subobject,74    genprocid)75    SELECT76      x.uid,77      NULL,78      @GenProcID79    FROM(80    SELECT81      DISTINCT b.uid_org AS uid82    FROM inserted d83    JOIN BaseTree b84      ON d.uid_org = b.uid_org85    WHERE86      b.ITShopInfo = 'BO' AND d.XIsInEffect = 1) AS x87    EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild',88      @DBQueueElements_0289    DECLARE @DBQueueElements_03 QBM_YDBQueueRaw90    INSERT INTO @DBQueueElements_03(object,91    subobject,92    genprocid)93    SELECT94      x.uid,95      NULL,96      @GenProcID97    FROM(98    SELECT99      DISTINCT ADS.uid_ADSaccount AS uid100    FROM inserted i101    JOIN(102    SELECT103      pio.uid_person, pio.uid_org104    FROM personinBaseTree pio105    WHERE106      pio.XOrigin > 0107    UNION all108    SELECT109      uid_person, uid_org110    FROM helperPersonOrg) hpo111      ON i.uid_org = hpo.uid_org112    JOIN ADSaccount ADS113      ON ADS.uid_person = hpo.uid_person AND ADS.isgroupaccount = 1114    WHERE115      i.XIsInEffect = 1) AS x116    EXEC QBM_PDBQueueInsert_Bulk 'ADS-K-ADSAccountInADSGroup',117      @DBQueueElements_03118    DECLARE @DBQueueElements_04 QBM_YDBQueueRaw119    INSERT INTO @DBQueueElements_04(object,120    subobject,121    genprocid)122    SELECT123      x.uid,124      NULL,125      @GenProcID126    FROM(127    SELECT128      DISTINCT ADS.uid_ADSContact AS uid129    FROM inserted i130    JOIN(131    SELECT132      pio.uid_person, pio.uid_org133    FROM personinBaseTree pio134    WHERE135      pio.XOrigin > 0136    UNION all137    SELECT138      uid_person, uid_org139    FROM helperPersonOrg) hpo140      ON i.uid_org = hpo.uid_org141    JOIN ADSContact ADS142      ON ADS.uid_person = hpo.uid_person AND ADS.isgroupaccount = 1143    WHERE144      i.XIsInEffect = 1) AS x145    EXEC QBM_PDBQueueInsert_Bulk 'ADS-K-ADSContactInADSGroup',146      @DBQueueElements_04147    DECLARE @DBQueueElements_05 QBM_YDBQueueRaw148    INSERT INTO @DBQueueElements_05(object,149    subobject,150    genprocid)151    SELECT152      x.uid,153      NULL,154      @GenProcID155    FROM(156    SELECT157      DISTINCT i.uid_org AS uid158    FROM inserted i159    WHERE160      i.XIsInEffect = 1) AS x161    EXEC QBM_PDBQueueInsert_Bulk 'ADS-K-BaseTreeHasObject',162      @DBQueueElements_05163    DECLARE @DBQueueElements_06 QBM_YDBQueueRaw164    INSERT INTO @DBQueueElements_06(object,165    subobject,166    genprocid)167    SELECT168      x.uid,169      NULL,170      @GenProcID171    FROM(172    SELECT m.uid_ADSMachine AS uid173    FROM inserted i174    JOIN(175    SELECT176      pio.uid_WorkDesk, pio.uid_org177    FROM WorkDeskinBaseTree pio178    WHERE179      pio.XOrigin > 0180    UNION all181    SELECT182      uid_WorkDesk, uid_org183    FROM helperWorkDeskOrg) hwo184      ON hwo.uid_org = i.uid_org185    JOIN Hardware ADS186      ON ADS.uid_WorkDesk = hwo.uid_WorkDesk187    JOIN ADSMachine m188      ON ADS.uid_Hardware = m.uid_Hardware AND '1' = dbo.QBM_FGIConfigparmValue('TargetSystem\ADS\HardwareInGroupFromOrg')189    WHERE190      i.XIsInEffect = 1191    UNION192    SELECT m.uid_ADSMachine193    FROM inserted i194    JOIN(195    SELECT196      pio.uid_Hardware, pio.uid_org197    FROM HardwareinBaseTree pio198    WHERE199      pio.XOrigin > 0200    UNION all201    SELECT202      uid_Hardware, uid_org203    FROM helperHardwareOrg) hho204      ON hho.uid_org = i.uid_org205    JOIN Hardware ADS206      ON hho.uid_Hardware = ADS.uid_Hardware207    JOIN ADSMachine m208      ON m.uid_Hardware = ads.uid_Hardware209    WHERE210      '1' = dbo.QBM_FGIConfigparmValue('TargetSystem\ADS\HardwareInGroupFromOrg') AND i.XIsInEffect = 1) AS x211    EXEC QBM_PDBQueueInsert_Bulk 'ADS-K-ADSMachineInADSGroup',212      @DBQueueElements_06213  END TRY214  BEGIN CATCH215    EXEC QBM_PSessionErrorAdd DEFAULT216    RAISERROR('',217    18,218    1)219      WITH NOWAIT220  END CATCH221  ende:222  RETURN223END
Open raw exported source
SQL · Raw32 lines
1  create   trigger ADS_TIBaseTreeHasADSGroup on BaseTreeHasADSGroup  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 'ADS-AsgnBT-ADSGroup', @AssignCheckValues, @GenProcID   if exists (select top 1 1 from inserted i join BaseTree dest on i.uid_Org6 = dest.uid_Org  join ADSGroup elem on i.uid_ADSGroup = elem.uid_ADSGroup where dbo.QER_FGIITShopFlagCombineValid(dest.XObjectKey, null, null, elem.XObjectKey7, 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.|'8, 18, 2) with nowait end   if exists (select top 1 1 from inserted i join ADSGroup t on i.UID_ADSGroup = t.UID_ADSGroup and 1 = t.HasReadOnlyMemberships9 ) begin raiserror( '#LDS#Cannot make assignment because it involves a group with read only memberships.|', 18, 2) with nowait end    declare @DBQueueElements_0110 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, 'ADS-K-OrgHasADSGroup', @GenProcID from ( select distinct11 d.uid_org as uid from inserted d  where d.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0  ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-AllChildrenOfOrg'12, @DBQueueElements_01 declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02 (object, subobject, genprocid) select x.uid, null, @GenProcID13 from ( select distinct b.uid_org as uid from inserted d join BaseTree b on d.uid_org = b.uid_org where b.ITShopInfo = 'BO' and d.XIsInEffect = 1 ) as 14x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild', @DBQueueElements_02 declare @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object15, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct ADS.uid_ADSaccount as uid from inserted i join (select pio.uid_person, pio.uid_org16 from personinBaseTree pio where pio.XOrigin > 0 union all select uid_person, uid_org from helperPersonOrg ) hpo on i.uid_org = hpo.uid_org join ADSaccount17 ADS on ADS.uid_person = hpo.uid_person and ADS.isgroupaccount = 1 where i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'ADS-K-ADSAccountInADSGroup'18, @DBQueueElements_03 declare @DBQueueElements_04 QBM_YDBQueueRaw insert into @DBQueueElements_04 (object, subobject, genprocid) select x.uid, null, @GenProcID19 from ( select distinct ADS.uid_ADSContact as uid from inserted i join (select pio.uid_person, pio.uid_org from personinBaseTree pio where pio.XOrigin 20> 0 union all select uid_person, uid_org from helperPersonOrg ) hpo on i.uid_org = hpo.uid_org join ADSContact ADS on ADS.uid_person = hpo.uid_person and21 ADS.isgroupaccount = 1 where i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'ADS-K-ADSContactInADSGroup', @DBQueueElements_04 declare @DBQueueElements_0522 QBM_YDBQueueRaw insert into @DBQueueElements_05 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct i.uid_org as uid 23from inserted i where i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'ADS-K-BaseTreeHasObject', @DBQueueElements_05 declare @DBQueueElements_06 24QBM_YDBQueueRaw insert into @DBQueueElements_06 (object, subobject, genprocid) select x.uid, null, @GenProcID from (  select m.uid_ADSMachine as uid from25 inserted i join (select pio.uid_WorkDesk, pio.uid_org from WorkDeskinBaseTree pio where pio.XOrigin > 0 union all select uid_WorkDesk, uid_org from helperWorkDeskOrg26 ) hwo on hwo.uid_org = i.uid_org join Hardware ADS on ADS.uid_WorkDesk = hwo.uid_WorkDesk join ADSMachine m on ADS.uid_Hardware = m.uid_Hardware and '1'27 = dbo.QBM_FGIConfigparmValue('TargetSystem\ADS\HardwareInGroupFromOrg') where i.XIsInEffect = 1 union   select m.uid_ADSMachine from inserted i join (select28 pio.uid_Hardware, pio.uid_org from HardwareinBaseTree pio where pio.XOrigin > 0 union all select uid_Hardware, uid_org from helperHardwareOrg ) hho on29 hho.uid_org = i.uid_org join Hardware ADS on hho.uid_Hardware = ADS.uid_Hardware join ADSMachine m on m.uid_Hardware = ads.uid_Hardware where '1' = dbo.QBM_FGIConfigparmValue30('TargetSystem\ADS\HardwareInGroupFromOrg') and i.XIsInEffect = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'ADS-K-ADSMachineInADSGroup', @DBQueueElements_0631 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 32