Back to OIM Explorer

dbo.QER_PPersonHasObjectPostProc

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure. Bulk DBQueue insert -> GenProcID at line 21; References QBM_PDBQueueInsert_Bulk

Source: sandbox-db sys.sql_modules

Source size: 3.491 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.
  • DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.

Relations

  • Bulk DBQueue insert -> GenProcID at line 21
  • References QBM_PDBQueueInsert_Bulk

Typed Edges

  • queues DBQueue task GenProcID at line 21 Bulk DBQueue insert -> GenProcID at line 21
  • references source dbo.QBM_FCVElementToObjectKey1 source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PSessionContextSet source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • queues DBQueue task GenProcID -> unresolved procedure QBM_PDBQueueInsert_Bulk @UID_TaskForMasterIdentity, @DBQueueElements_01 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END…

Complete Source

SQL153 lines
1CREATE PROCEDURE QER_PPersonHasObjectPostProc(2  @SlotNumber int,3  @CountDeltaOrigin int,4  @CountDeltaQantity int,5  @UID_TaskForMasterIdentity varchar(38)6)7AS8BEGIN9  DECLARE @ElementCount int10  DECLARE @ElementIndex int11  DECLARE @ElementLast int12  DECLARE @GenProcID varchar(38)13  DECLARE @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('')14  SET XACT_ABORT OFF15  BEGIN TRY16    IF @CountDeltaOrigin > 017    BEGIN18      DECLARE @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer19      INSERT INTO @GenProcIDs_CountDeltaOrigin(UID1)20      SELECT21        DISTINCT de.GenProcID22      FROM #QBMDeltaOrigin de23      SELECT @ElementCount = @@ROWCOUNT24      SELECT @ElementIndex = @@IDENTITY - @ElementCount +125      SELECT @ElementLast = @@IDENTITY26      WHILE @ElementIndex <= @ElementLast27      BEGIN28        SELECT TOP 1 @GenProcID = bu.UID129        FROM @GenProcIDs_CountDeltaOrigin bu30        WHERE31          bu.ElementIndex = @ElementIndex32        EXEC QBM_PSessionContextSet 'GenProcID',33          @GenProcID34        UPDATE PersonHasObject35        SET InheritInfo = di.XOrigin36        FROM PersonHasObject bho37        JOIN #QBMDeltaOrigin di38          ON bho.uid_Person = di.Element AND bho.Objectkey = di.AssignedElement39        WHERE40          di.GenProcID = @GenProcID41        SELECT @ElementIndex += 142      END43    END44    IF @CountDeltaQantity > 045    BEGIN46      UPDATE #QBMDeltaInsert47      SET NewPK = newid()48      DECLARE @GenProcIDs_CountDeltaQuantity QBM_YCursorBuffer49      INSERT INTO @GenProcIDs_CountDeltaQuantity(UID1)50      SELECT de.GenProcID51      FROM #QBMDeltaDelete de52      UNION53      SELECT de.GenProcID54      FROM #QBMDeltaInsert de55      SELECT @ElementCount = @@ROWCOUNT56      SELECT @ElementIndex = @@IDENTITY - @ElementCount +157      SELECT @ElementLast = @@IDENTITY58      WHILE @ElementIndex <= @ElementLast59      BEGIN60        SELECT TOP 1 @GenProcID = bu.UID161        FROM @GenProcIDs_CountDeltaQuantity bu62        WHERE63          bu.ElementIndex = @ElementIndex64        IF EXISTS(65          SELECT TOP 1 166          FROM #QBMDeltaDelete x67          WHERE68            x.GenProcID = @GenProcID)69        BEGIN70          EXEC QBM_PSessionContextSet 'GenProcID',71            @GenProcID72          DELETE73          FROM PersonHasObject74          WHERE75            EXISTS(76          SELECT TOP 1 177          FROM #QBMDeltaDelete d78          WHERE79            d.Element = PersonHasObject.uid_person AND d.AssignedElement = PersonHasObject.ObjectKey AND d.GenProcID = @GenProcID)80        END81        IF EXISTS(82          SELECT TOP 1 183          FROM #QBMDeltaInsert x84          WHERE85            x.GenProcID = @GenProcID)86        BEGIN87          EXEC QBM_PSessionContextSet 'GenProcID',88            @GenProcID89          INSERT INTO PersonHasObject(UID_PersonHasObject,90          UID_Person,91          ObjectKey,92          XObjectKey,93          InheritInfo)94          SELECT95            di.NewPK,96            di.Element,97            di.AssignedElement,98            dbo.QBM_FCVElementToObjectKey1('PersonHasObject',99            'UID_PersonHasObject',100            di.NewPK),101            XOrigin102          FROM #QBMDeltaInsert di103          WHERE104            di.GenProcID = @GenProcID AND NOT EXISTS(105          SELECT TOP 1 1106          FROM PersonHasObject e107          WHERE108            e.UID_Person = di.Element AND e.ObjectKey = di.AssignedElement)109        END110        SELECT @ElementIndex += 1111      END112    END113    IF @CountDeltaOrigin + @CountDeltaQantity > 0114    BEGIN115      DECLARE @DBQueueElements_01 QBM_YDBQueueRaw116      INSERT INTO @DBQueueElements_01(object,117      subobject,118      genprocid)119      SELECT120        y.uid,121        NULL,122        y.GenProcID123      FROM(124      SELECT125        DISTINCT s.UID_PersonMasterIdentity AS uid,126        x.GenProcID AS GenProcID127      FROM(128      SELECT129        d.Element AS uid, d.GenProcID130      FROM #QBMDeltaQuantity d131      UNION132      SELECT133        d.Element AS uid, d.GenProcID134      FROM #QBMDeltaOrigin d) AS x135      JOIN person s136        ON s.uid_person = x.uid AND s.UID_PersonMasterIdentity > ' ') AS y137      EXEC QBM_PDBQueueInsert_Bulk @UID_TaskForMasterIdentity,138        @DBQueueElements_01139    END140  END TRY141  BEGIN CATCH142    EXEC QBM_PSessionErrorAdd DEFAULT143    DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()144    RAISERROR(@Rethrow,145    18,146    1)147      WITH NOWAIT148  END CATCH149  ende:150  EXEC QBM_PSessionContextSet 'GenProcID',151    @GenProcID_R152  RETURN153END
Open raw exported source
SQL · Raw24 lines
1   create   procedure QER_PPersonHasObjectPostProc ( @SlotNumber int , @CountDeltaOrigin int , @CountDeltaQantity int , @UID_TaskForMasterIdentity2 varchar(38) ) as begin declare @ElementCount int declare @ElementIndex int declare @ElementLast int declare @GenProcID varchar(38) declare @GenProcID_R3 varchar(38) = dbo.QBM_FGISessionContext('') SET XACT_ABORT OFF BEGIN TRY if @CountDeltaOrigin > 0 begin declare @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer4 insert into @GenProcIDs_CountDeltaOrigin (UID1) select distinct de.GenProcID from #QBMDeltaOrigin de select @ElementCount = @@ROWCOUNT select @ElementIndex5 = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CountDeltaOrigin6 bu where bu.ElementIndex = @ElementIndex exec QBM_PSessionContextSet 'GenProcID', @GenProcID update PersonHasObject set InheritInfo = di.XOrigin from 7PersonHasObject bho join #QBMDeltaOrigin di on bho.uid_Person = di.Element and bho.Objectkey = di.AssignedElement where di.GenProcID = @GenProcID select8 @ElementIndex += 1 end  end  if @CountDeltaQantity > 0 begin  update #QBMDeltaInsert set NewPK = newid() declare @GenProcIDs_CountDeltaQuantity QBM_YCursorBuffer9 insert into @GenProcIDs_CountDeltaQuantity (UID1) select de.GenProcID from #QBMDeltaDelete de union select de.GenProcID from #QBMDeltaInsert de select10 @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin11 select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CountDeltaQuantity bu where bu.ElementIndex = @ElementIndex if exists (select top 1 1 from #QBMDeltaDelete12 x where x.GenProcID = @GenProcID ) begin exec QBM_PSessionContextSet 'GenProcID', @GenProcID delete from PersonHasObject where exists (select top 1 1 13from #QBMDeltaDelete d where d.Element = PersonHasObject.uid_person and d.AssignedElement = PersonHasObject.ObjectKey and d.GenProcID = @GenProcID ) end14  if exists (select top 1 1 from #QBMDeltaInsert x where x.GenProcID = @GenProcID ) begin exec QBM_PSessionContextSet 'GenProcID', @GenProcID insert into15 PersonHasObject (UID_PersonHasObject, UID_Person ,ObjectKey , XObjectKey, InheritInfo) select di.NewPK, di.Element, di.AssignedElement, dbo.QBM_FCVElementToObjectKey116('PersonHasObject', 'UID_PersonHasObject', di.NewPK), XOrigin from #QBMDeltaInsert di where di.GenProcID = @GenProcID and not exists (select top 1 1 from17 PersonHasObject e where e.UID_Person = di.Element and e.ObjectKey = di.AssignedElement ) end  select @ElementIndex += 1 end  end  if @CountDeltaOrigin18 + @CountDeltaQantity > 0 begin  declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01 (object, subobject, genprocid) select y.uid19, null, y.GenProcID from ( select distinct s.UID_PersonMasterIdentity as uid, x.GenProcID as GenProcID from ( select d.Element as uid, d.GenProcID from20 #QBMDeltaQuantity d union select d.Element as uid, d.GenProcID from #QBMDeltaOrigin d ) as x join person s on s.uid_person = x.uid and s.UID_PersonMasterIdentity21 > ' ' ) as y exec QBM_PDBQueueInsert_Bulk @UID_TaskForMasterIdentity, @DBQueueElements_01 end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default declare22 @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT END CATCH ende: exec QBM_PSessionContextSet 'GenProcID'23, @GenProcID_R return end 24