Back to OIM Explorer

dbo.ATT_TUPerson

Database TriggerSQL_TRIGGERSandbox DB

Database Trigger on Person. Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 12; Bulk DBQueue insert -> ATT-K-AttestationHelper / ATT_ZAttestationHelperFill at line 12; Bulk DBQueue insert -> ATT-K-AttestationHelper / ATT_ZAttestationHelperFill at line 25; References QBM_PJobCreate*

Source: sandbox-db sys.sql_modules

Source size: 4.357 characters

Interpretation

  • Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
  • Object-layer bridge detected through QBM_PJobCreate helper usage.
  • DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.

Relations

  • Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 12
  • Bulk DBQueue insert -> ATT-K-AttestationHelper / ATT_ZAttestationHelperFill at line 12
  • Bulk DBQueue insert -> ATT-K-AttestationHelper / ATT_ZAttestationHelperFill at line 25
  • References QBM_PJobCreate*
  • References QBM_PDBQueueInsert_Single
  • References QBM_PDBQueueInsert_Bulk
  • Trigger parent table: Person

Typed Edges

  • queues DBQueue task QBM_ZRecalculate at line 12 Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 12
  • queues DBQueue task ATT_ZAttestationHelperFill at line 12 Bulk DBQueue insert -> ATT-K-AttestationHelper / ATT_ZAttestationHelperFill at line 12
  • queues DBQueue task ATT_ZAttestationHelperFill at line 25 Bulk DBQueue insert -> ATT-K-AttestationHelper / ATT_ZAttestationHelperFill at line 25
  • trigger on table Person Trigger parent table: Person
  • references source dbo.QBM_FCVElementToObjectKey1 source text reference
  • references source dbo.QBM_FCVStringTrimLDSPrefix source text reference
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PDBQueueInsert_Single source text reference
  • references source dbo.QBM_PJobCreate source text reference
  • references source dbo.QBM_PJobCreate_HOUpdate source text reference
  • references source dbo.QBM_PJobCreate_HOUpdate_L source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QER_PITShopHelperFill source text reference
  • references source dbo.QER_PITShopHelperFill_Recalc source text reference

Complete Source

SQL224 lines
1CREATE trigger ATT_TUPerson2  ON Person FOR3UPDATE NOT FOR Replication4AS5BEGIN6  DECLARE @Elements QBM_YParameterList7  DECLARE @XUser nvarchar(64) = object_name(@@procid)8  DECLARE @Xdate datetime = getutcdate()9  BEGIN TRY10    IF EXISTS(11      SELECT TOP 1 112      FROM inserted)13    GOTO start14    IF EXISTS(15      SELECT TOP 1 116      FROM deleted)17    GOTO start18    RETURN start:19    DECLARE @GenProcID varchar(38) = dbo.QBM_FGISessionContext('')20    IF21    UPDATE(UID_Department)22    BEGIN23      DECLARE @RecalcParameter_01 QBM_YCursorBuffer24      INSERT INTO @RecalcParameter_01(ObjectKey1,25      UID1,26      Ident1)27      SELECT28        dep.XObjectKey,29        'ATT-PWODecisionRule-DM',30        'A'31      FROM inserted i32      JOIN BaseTree dep33        ON i.UID_Department = dep.UID_Org34      UNION all35      SELECT36        dep.XObjectKey,37        'ATT-PWODecisionRule-DM',38        'A'39      FROM deleted d40      JOIN BaseTree dep41        ON d.UID_Department = dep.UID_Org42      UNION all43      SELECT44        i.XObjectKey,45        'ATT-PWODecisionRule-ED',46        'A'47      FROM inserted i48      UNION all49      SELECT50        i.XObjectKey,51        'ATT-PWODecisionRule-AD',52        'A'53      FROM inserted i54      EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_01,55        @GenprocID56    END57    IF58    UPDATE(UID_Locality)59    BEGIN60      DECLARE @RecalcParameter_02 QBM_YCursorBuffer61      INSERT INTO @RecalcParameter_02(ObjectKey1,62      UID1,63      Ident1)64      SELECT65        i.XObjectKey,66        'ATT-PWODecisionRule-LM',67        'A'68      FROM inserted i69      UNION all70      SELECT71        i.XObjectKey,72        'ATT-PWODecisionRule-AL',73        'A'74      FROM inserted i75      EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_02,76        @GenprocID77    END78    IF79    UPDATE(UID_Profitcenter)80    BEGIN81      DECLARE @RecalcParameter_03 QBM_YCursorBuffer82      INSERT INTO @RecalcParameter_03(ObjectKey1,83      UID1,84      Ident1)85      SELECT86        i.XObjectKey,87        'ATT-PWODecisionRule-PM',88        'A'89      FROM inserted i90      UNION all91      SELECT92        i.XObjectKey,93        'ATT-PWODecisionRule-AP',94        'A'95      FROM inserted i96      EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_03,97        @GenprocID98    END99    IF100    UPDATE(UID_PersonMasterIdentity)101    BEGIN102      EXEC QBM_PDBQueueInsert_Single 'QBM-K-CommonReCalculate',103      'ATT-K-AttestationHelper-Cfg',104      '',105        @GenProcID106    END107    IF108    UPDATE(IsInActive)109    BEGIN110      IF dbo.QBM_FGIConfigparmValue('QER\Attestation\AutoCloseInactivePerson') > ' '111      BEGIN112        INSERT INTO @Elements(Parameter1,113        Parameter3)114        SELECT115          DISTINCT ac.XObjectKey,116          ac.UID_AttestationCase117        FROM Person p118        JOIN deleted d119          ON p.UID_Person = d.UID_Person AND p.IsInActive = 1 AND d.IsInActive = 0120        JOIN AttestationCase ac121          ON p.XObjectKey IN(ac.ObjectKey1,122        ac.ObjectKeyBase,123        ac.ObjectKey2,124        ac.ObjectKey3)125        WHERE126          ac.IsClosed = 0127        EXEC QBM_PJobCreate_HOUpdate_L 'AttestationCase',128          @elements,129          @GenProcID,130        DEFAULT,131          @p1 = 'IsClosed',132          @v1 = '1'133        UPDATE AttestationCase134        SET ReasonHead = '#LDS#Automatic system approval: Case closed due to identity becoming inactive.|',135        DateHead = @Xdate,136        XDateUpdated = @Xdate,137        XUserUpdated = @XUser138        FROM AttestationCase ac139        JOIN @Elements e140          ON ac.XObjectKey = e.Parameter1141        UPDATE @Elements142        SET Parameter2 = NEWID()143        INSERT INTO AttestationHistory(DecisionType,144        IsDecisionBySystem,145        UID_AttestationHistory,146        UID_PersonHead,147        UID_AttestationCase,148        DisplayPersonHead,149        ReasonHead,150        DateHead,151        XDateInserted,152        XDateUpdated,153        XUserInserted,154        XUserUpdated,155        DecisionLevel,156        XTouched,157        XObjectKey)158        SELECT159          'Abort',160          1,161          e.Parameter2 AS UID_AttestationHistory,162          NULL,163          e.Parameter3 AS UID_AttestationCase,164          dbo.QBM_FCVStringTrimLDSPrefix('#LDS#Automatic system approval.|'),165          dbo.QBM_FCVStringTrimLDSPrefix('#LDS#Automatic system approval: Case closed due to identity becoming inactive.|'),166          GetUTCDate(),167          @Xdate,168          @Xdate,169          @XUser,170          @XUser,171          0,172          '',173          dbo.QBM_FCVElementToObjectKey1('AttestationHistory',174          'UID_AttestationHistory',175          e.Parameter2)176        FROM @Elements e177      END178      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw179      INSERT INTO @DBQueueElements_01(object,180      subobject,181      genprocid)182      SELECT183        x.uid,184        NULL,185        @GenProcID186      FROM(187      SELECT188        DISTINCT ph.UID_AttestationCase AS uid189      FROM deleted d190      JOIN Person p191        ON d.UID_Person = p.UID_Person192      JOIN AttestationHelper ph193        ON ph.UID_PersonHead = p.UID_Person194      WHERE195        d.IsInActive = 0 AND p.IsInActive = 1) AS x196      EXEC QBM_PDBQueueInsert_Bulk 'ATT-K-AttestationHelper',197        @DBQueueElements_01198    END199    IF200    UPDATE(UID_PersonHead)201    BEGIN202      DECLARE @RecalcParameter_04 QBM_YCursorBuffer203      INSERT INTO @RecalcParameter_04(ObjectKey1,204      UID1,205      Ident1)206      SELECT207        i.XObjectKey,208        'ATT-PWODecisionRule-XM',209        'A'210      FROM inserted i211      EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_04,212        @GenprocID213    END214  END TRY215  BEGIN CATCH216    EXEC QBM_PSessionErrorAdd DEFAULT217    RAISERROR('',218    18,219    1)220      WITH NOWAIT221  END CATCH222  ende:223  RETURN224END
Open raw exported source
SQL ยท Raw29 lines
1    create   trigger ATT_TUPerson on Person  for Update not for Replication as begin  declare @Elements QBM_YParameterList declare @XUser nvarchar2(64) = object_name(@@procid) declare @Xdate datetime = getutcdate() BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top3 1 1 from deleted) goto start return start: declare @GenProcID varchar(38) = dbo.QBM_FGISessionContext('')    if UPDATE(UID_Department) begin declare @RecalcParameter_014 QBM_YCursorBuffer insert into @RecalcParameter_01 (ObjectKey1, UID1, Ident1) select dep.XObjectKey , 'ATT-PWODecisionRule-DM', 'A' from inserted i join5 BaseTree dep on i.UID_Department = dep.UID_Org union all select dep.XObjectKey , 'ATT-PWODecisionRule-DM', 'A' from deleted d join BaseTree dep on d.UID_Department6 = dep.UID_Org union all  select i.XObjectKey, 'ATT-PWODecisionRule-ED', 'A' from inserted i union all select i.XObjectKey, 'ATT-PWODecisionRule-AD', 'A'7 from inserted i exec QER_PITShopHelperFill_Recalc @RecalcParameter_01, @GenprocID end if UPDATE(UID_Locality) begin declare @RecalcParameter_02 QBM_YCursorBuffer8  insert into @RecalcParameter_02 (ObjectKey1, UID1, Ident1) select i.XObjectKey, 'ATT-PWODecisionRule-LM', 'A' from inserted i union all select i.XObjectKey9, 'ATT-PWODecisionRule-AL', 'A' from inserted i exec QER_PITShopHelperFill_Recalc @RecalcParameter_02, @GenprocID end if UPDATE(UID_Profitcenter) begin10 declare @RecalcParameter_03 QBM_YCursorBuffer  insert into @RecalcParameter_03 (ObjectKey1, UID1, Ident1) select i.XObjectKey, 'ATT-PWODecisionRule-PM'11, 'A' from inserted i union all select i.XObjectKey, 'ATT-PWODecisionRule-AP', 'A' from inserted i exec QER_PITShopHelperFill_Recalc @RecalcParameter_0312, @GenprocID end  if update(UID_PersonMasterIdentity) begin   exec QBM_PDBQueueInsert_Single 'QBM-K-CommonReCalculate', 'ATT-K-AttestationHelper-Cfg', 13'', @GenProcID end if update(IsInActive) begin if dbo.QBM_FGIConfigparmValue('QER\Attestation\AutoCloseInactivePerson') > ' ' begin insert into @Elements14(Parameter1, Parameter3) select distinct ac.XObjectKey, ac.UID_AttestationCase from Person p join deleted d on p.UID_Person = d.UID_Person and p.IsInActive15 = 1 and d.IsInActive = 0 join AttestationCase ac on p.XObjectKey in (ac.ObjectKey1, ac.ObjectKeyBase , ac.ObjectKey2 , ac.ObjectKey3 ) where ac.IsClosed16 = 0  exec QBM_PJobCreate_HOUpdate_L 'AttestationCase', @elements, @GenProcID , DEFAULT , @p1 = 'IsClosed' , @v1 = '1'  update AttestationCase set ReasonHead17 = '#LDS#Automatic system approval: Case closed due to identity becoming inactive.|' , DateHead = @Xdate , XDateUpdated = @Xdate , XUserUpdated = @XUser18 from AttestationCase ac join @Elements e on ac.XObjectKey = e.Parameter1 update @Elements set Parameter2 = NEWID()  insert into AttestationHistory (DecisionType19, IsDecisionBySystem, UID_AttestationHistory, UID_PersonHead, UID_AttestationCase, DisplayPersonHead, ReasonHead, DateHead, XDateInserted, XDateUpdated20, XUserInserted, XUserUpdated, DecisionLevel, XTouched, XObjectKey) select 'Abort', 1, e.Parameter2 as UID_AttestationHistory, null, e.Parameter3 as UID_AttestationCase21, dbo.QBM_FCVStringTrimLDSPrefix('#LDS#Automatic system approval.|') , dbo.QBM_FCVStringTrimLDSPrefix('#LDS#Automatic system approval: Case closed due to identity becoming inactive.|'22), GetUTCDate(), @Xdate, @Xdate, @XUser, @XUser, 0, '', dbo.QBM_FCVElementToObjectKey1('AttestationHistory', 'UID_AttestationHistory', e.Parameter2) from23 @Elements e  end  declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, @GenProcID24 from ( select distinct ph.UID_AttestationCase as uid from deleted d join Person p on d.UID_Person = p.UID_Person join AttestationHelper ph on ph.UID_PersonHead25 = p.UID_Person where d.IsInActive = 0 and p.IsInActive = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'ATT-K-AttestationHelper', @DBQueueElements_01  end  if26 UPDATE(UID_PersonHead) begin declare @RecalcParameter_04 QBM_YCursorBuffer insert into @RecalcParameter_04 (ObjectKey1, UID1, Ident1)  select i.XObjectKey27, 'ATT-PWODecisionRule-XM', 'A' from inserted i exec QER_PITShopHelperFill_Recalc @RecalcParameter_04, @GenprocID end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd28 default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH ende: return end 29