Back to OIM Explorer

dbo.LDP_ZGroupInLDAPGroup

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure. Single DBQueue insert -> LDP-K-LDAPGroupInLDAPGroup-Circ / LDP_ZGroupInLDAPGroup_Circ at line 23; References QBM_PDBQueueInsert_Single

Source: sandbox-db sys.sql_modules

Source size: 4.837 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

  • Single DBQueue insert -> LDP-K-LDAPGroupInLDAPGroup-Circ / LDP_ZGroupInLDAPGroup_Circ at line 23
  • References QBM_PDBQueueInsert_Single

Typed Edges

  • queues DBQueue task LDP_ZGroupInLDAPGroup_Circ at line 23 Single DBQueue insert -> LDP-K-LDAPGroupInLDAPGroup-Circ / LDP_ZGroupInLDAPGroup_Circ at line 23
  • references source dbo.QBM_FCVElementToObjectKey2 source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PDBQueueInsert_Single source text reference
  • references source dbo.QBM_PSessionContextSet source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • queues DBQueue task LDP-K-LDAPGroupInLDAPGroup-Circ -> LDP_ZGroupInLDAPGroup_Circ QBM_PDBQueueInsert_Single 'LDP-K-LDAPGroupInLDAPGroup-Circ' , '', '', @GenProcID select @ElementIndex += 1 end end if @CountDeltaOrigin > 0 begin declare @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer insert into @GenProcIDs_CountDeltaOrig…

Complete Source

SQL219 lines
1CREATE PROCEDURE LDP_ZGroupInLDAPGroup(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @lauf int10  DECLARE @GenProcID varchar(38)11  DECLARE @ElementCount int12  DECLARE @ElementIndex int13  DECLARE @ElementLast int14  DECLARE @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('')15  DECLARE @QBMDeltaHelper QBM_YDBQueueDeltaHelper16  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent17  BEGIN TRY18    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,19    UID_Parameter,20    UID_SubParameter,21    GenProcID)22    SELECT23      UID_DialogDBQueue,24      UID_Parameter,25      UID_SubParameter,26      GenProcID27    FROM QBMDBQueueCurrent cu28      WITH(readpast)29    WHERE30      cu.SlotNumber = @SlotNumber31    IF @@rowcount = 032    BEGIN33      GOTO EndLabel34    END35    INSERT INTO @SourceData(IsUpcommingContent,36    XOriginAfter,37    Element,38    AssignedElement,39    XOriginBefore)40    SELECT41      0,42      0,43      UID_LDAPGroupParent,44      UID_LDAPGroupChild,45      levelnumber + 146    FROM LDAPGroupCollection47    JOIN @DBQueueCurrent x48      ON UID_LDAPGroupParent = x.uid_parameter49    INSERT INTO @QBMDeltaHelper(Element,50    AssignedElement,51    XOrigin)52    SELECT53      uid_parameter,54      uid_parameter,55      156    FROM @DBQueueCurrent p57    SELECT @lauf = 158    WHILE @lauf > 059    BEGIN60      INSERT INTO @QBMDeltaHelper(Element,61      AssignedElement,62      XOrigin)63      SELECT64        DISTINCT a.Element,65        gig.uid_LDAPGroupChild,66        a.XOrigin +167      FROM @QBMDeltaHelper a68      JOIN LDAPGroupInLDAPGroup gig69        ON a.AssignedElement = gig.uid_LDAPGroupParent70      WHERE71        NOT EXISTS(72      SELECT TOP 1 173      FROM @QBMDeltaHelper e74      WHERE75        e.Element = a.Element AND e.AssignedElement = gig.uid_LDAPGroupChild)76      SELECT @lauf = @@rowcount77    END78    INSERT INTO @SourceData(IsUpcommingContent,79    XOriginBefore,80    XOriginAfter,81    Element,82    AssignedElement)83    SELECT84      1,85      0,86      XOrigin,87      Element,88      AssignedElement89    FROM @QBMDeltaHelper90    EXEC QBM_PDBQueueCalculateDelta @SourceData,91      @DeltaQuantity = 0,92      @DeltaDelete = 1,93      @DeltaInsert = 1,94      @DeltaOrigin = 1,95      @CountDeltaQantity = @CountDeltaQantity OUTPUT,96      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,97      @UseIsInEffect = 0,98      @SlotNumber = @SlotNumber,99      @DBQueueCurrentExtern = @DBQueueCurrent100    IF @CountDeltaQantity > 0101    BEGIN102      DECLARE @GenProcIDs_CountDeltaQuantity QBM_YCursorBuffer103      INSERT INTO @GenProcIDs_CountDeltaQuantity(UID1)104      SELECT de.GenProcID105      FROM #QBMDeltaDelete de106      UNION107      SELECT de.GenProcID108      FROM #QBMDeltaInsert de109      SELECT @ElementCount = @@ROWCOUNT110      SELECT @ElementIndex = @@IDENTITY - @ElementCount +1111      SELECT @ElementLast = @@IDENTITY112      WHILE @ElementIndex <= @ElementLast113      BEGIN114        SELECT TOP 1 @GenProcID = bu.UID1115        FROM @GenProcIDs_CountDeltaQuantity bu116        WHERE117          bu.ElementIndex = @ElementIndex118        IF EXISTS(119          SELECT TOP 1 1120          FROM #QBMDeltaDelete x121          WHERE122            x.GenProcID = @GenProcID)123        BEGIN124          EXEC QBM_PSessionContextSet 'GenProcID',125            @GenProcID126          DELETE LDAPGroupCollection127          WHERE128            EXISTS(129          SELECT TOP 1 1130          FROM #QBMDeltaDelete d131          WHERE132            d.AssignedElement = LDAPGroupCollection.uid_LDAPGroupChild AND d.Element = LDAPGroupCollection.uid_LDAPGroupParent AND d.GenProcID = @GenProcID133          )134        END135        IF EXISTS(136          SELECT TOP 1 1137          FROM #QBMDeltaInsert x138          WHERE139            x.GenProcID = @GenProcID)140        BEGIN141          EXEC QBM_PSessionContextSet 'GenProcID',142            @GenProcID143          INSERT INTO LDAPGroupCollection(UID_LDAPGroupParent,144          UID_LDAPGroupChild,145          LevelNumber,146          XObjectKey)147          SELECT148            x.uid_LDAPGroupParent,149            x.uid_LDAPGroupChild,150            x.LevelNumber -1,151            dbo.QBM_FCVElementToObjectKey2('LDAPGroupCollection',152            'UID_LDAPGroupParent',153            x.UID_LDAPGroupParent,154            'UID_LDAPGroupChild',155            x.UID_LDAPGroupChild)156          FROM(157          SELECT158            Element AS uid_LDAPGroupParent,159            AssignedElement AS uid_LDAPGroupChild,160            XOrigin AS Levelnumber161          FROM #QBMDeltaInsert162          WHERE163            GenProcID = @GenProcID) AS x164        END165        EXEC QBM_PDBQueueInsert_Single 'LDP-K-LDAPGroupInLDAPGroup-Circ',166        '',167        '',168          @GenProcID169        SELECT @ElementIndex += 1170      END171    END172    IF @CountDeltaOrigin > 0173    BEGIN174      DECLARE @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer175      INSERT INTO @GenProcIDs_CountDeltaOrigin(UID1)176      SELECT177        DISTINCT de.GenProcID178      FROM #QBMDeltaOrigin de179      SELECT @ElementCount = @@ROWCOUNT180      SELECT @ElementIndex = @@IDENTITY - @ElementCount +1181      SELECT @ElementLast = @@IDENTITY182      WHILE @ElementIndex <= @ElementLast183      BEGIN184        SELECT TOP 1 @GenProcID = bu.UID1185        FROM @GenProcIDs_CountDeltaOrigin bu186        WHERE187          bu.ElementIndex = @ElementIndex188        EXEC QBM_PSessionContextSet 'GenProcID',189          @GenProcID190        UPDATE LDAPGroupCollection191        SET Levelnumber = x.LevelNumber -1192        FROM LDAPGroupCollection co193        JOIN(194        SELECT195          Element AS uid_LDAPGroupParent,196          AssignedElement AS uid_LDAPGroupChild,197          XOrigin AS LevelNumber198        FROM #QBMDeltaOrigin199        WHERE200          GenProcID = @GenProcID) AS x201          ON co.UID_LDAPGroupParent = x.uid_LDAPGroupParent AND co.UID_LDAPGroupChild = x.uid_LDAPGroupChild202        WHERE203          co.LevelNumber <> x.Levelnumber -1204        SELECT @ElementIndex += 1205      END206    END207  END TRY208  BEGIN CATCH209    EXEC QBM_PSessionErrorAdd DEFAULT210    RAISERROR('',211    18,212    1)213      WITH NOWAIT214  END CATCH215  endLabel:216  EXEC QBM_PSessionContextSet 'GenProcID',217    @GenProcID_R218  RETURN219END
Open raw exported source
SQL · Raw32 lines
1   create   procedure LDP_ZGroupInLDAPGroup (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin2 int declare @lauf int declare @GenProcID varchar(38) declare @ElementCount int declare @ElementIndex int declare @ElementLast int declare @GenProcID_R3 varchar(38) = dbo.QBM_FGISessionContext('') declare @QBMDeltaHelper QBM_YDBQueueDeltaHelper declare @DBQueueCurrent QBM_YDBQueueCurrent BEGIN TRY insert4 into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID5 from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount = 0 begin goto EndLabel end insert into @SourceData( IsUpcommingContent6, XOriginAfter , Element, AssignedElement, XOriginBefore ) select 0, 0 , UID_LDAPGroupParent, UID_LDAPGroupChild, levelnumber + 1  from LDAPGroupCollection7 join @DBQueueCurrent x on UID_LDAPGroupParent = x.uid_parameter   insert into @QBMDeltaHelper( Element, AssignedElement, XOrigin) select uid_parameter8, uid_parameter, 1  from @DBQueueCurrent p  select @lauf = 1 while @lauf > 0 begin insert into @QBMDeltaHelper (Element, AssignedElement, XOrigin) select9 distinct a.Element, gig.uid_LDAPGroupChild, a.XOrigin +1 from @QBMDeltaHelper a join LDAPGroupInLDAPGroup gig on a.AssignedElement = gig.uid_LDAPGroupParent10 where Not exists (select top 1 1 from @QBMDeltaHelper e where e.Element = a.Element and e.AssignedElement = gig.uid_LDAPGroupChild ) select @lauf = @@rowcount11 end insert into @SourceData( IsUpcommingContent, XOriginBefore, XOriginAfter , Element, AssignedElement ) select 1, 0, XOrigin , Element, AssignedElement12 from @QBMDeltaHelper exec QBM_PDBQueueCalculateDelta @SourceData, @DeltaQuantity = 0, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin = 1,  @CountDeltaQantity13 = @CountDeltaQantity output , @CountDeltaOrigin = @CountDeltaOrigin output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = 14@DBQueueCurrent if @CountDeltaQantity > 0 begin declare @GenProcIDs_CountDeltaQuantity QBM_YCursorBuffer insert into @GenProcIDs_CountDeltaQuantity (UID115) select de.GenProcID from #QBMDeltaDelete de union select de.GenProcID from #QBMDeltaInsert de select @ElementCount = @@ROWCOUNT select @ElementIndex 16= @@IDENTITY - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CountDeltaQuantity17 bu where bu.ElementIndex = @ElementIndex if exists (select top 1 1 from #QBMDeltaDelete x where x.GenProcID = @GenProcID ) begin exec QBM_PSessionContextSet18 'GenProcID', @GenProcID delete LDAPGroupCollection where exists (select top 1 1 from #QBMDeltaDelete d where d.AssignedElement = LDAPGroupCollection.uid_LDAPGroupChild19 and d.Element = LDAPGroupCollection.uid_LDAPGroupParent and d.GenProcID = @GenProcID ) end  if exists (select top 1 1 from #QBMDeltaInsert x where x.GenProcID20 = @GenProcID ) begin exec QBM_PSessionContextSet 'GenProcID', @GenProcID insert into LDAPGroupCollection ( UID_LDAPGroupParent, UID_LDAPGroupChild, LevelNumber21 , XObjectKey ) select x.uid_LDAPGroupParent, x.uid_LDAPGroupChild, x.LevelNumber -1  ,dbo.QBM_FCVElementToObjectKey2('LDAPGroupCollection', 'UID_LDAPGroupParent'22, x.UID_LDAPGroupParent, 'UID_LDAPGroupChild', x.UID_LDAPGroupChild) from ( select Element as uid_LDAPGroupParent, AssignedElement as uid_LDAPGroupChild23, XOrigin as Levelnumber from #QBMDeltaInsert where GenProcID = @GenProcID ) as x end  exec QBM_PDBQueueInsert_Single 'LDP-K-LDAPGroupInLDAPGroup-Circ'24, '', '', @GenProcID select @ElementIndex += 1 end  end  if @CountDeltaOrigin > 0 begin declare @GenProcIDs_CountDeltaOrigin QBM_YCursorBuffer insert into25 @GenProcIDs_CountDeltaOrigin (UID1) select distinct de.GenProcID from #QBMDeltaOrigin de select @ElementCount = @@ROWCOUNT select @ElementIndex = @@IDENTITY26 - @ElementCount +1 select @ElementLast = @@IDENTITY while @ElementIndex <= @ElementLast begin select top 1 @GenProcID = bu.UID1 from @GenProcIDs_CountDeltaOrigin27 bu where bu.ElementIndex = @ElementIndex exec QBM_PSessionContextSet 'GenProcID', @GenProcID update LDAPGroupCollection set Levelnumber = x.LevelNumber28 -1  from LDAPGroupCollection co join ( select Element as uid_LDAPGroupParent, AssignedElement as uid_LDAPGroupChild, XOrigin as LevelNumber from #QBMDeltaOrigin29 where GenProcID = @GenProcID ) as x on co.UID_LDAPGroupParent = x.uid_LDAPGroupParent and co.UID_LDAPGroupChild = x.uid_LDAPGroupChild where co.LevelNumber30 <> x.Levelnumber -1  select @ElementIndex += 1 end  end  END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH31  endLabel: exec QBM_PSessionContextSet 'GenProcID', @GenProcID_R return end 32