Back to OIM Explorer

dbo.TSB_ZBaseTreeOwnsObject

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.885 characters

Interpretation

  • Database routine. Review parameters, called procedures, DBQueue inserts, and QBM_PJobCreate helper calls before assuming side effects.

Relations

  • No extracted relations.

Typed Edges

  • references source dbo.QER_FGIBitPatternOwnershipInfo source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QER_PBasetreeOwnsObjectPost source text reference
  • references source dbo.QER_PBasetreeOwnsObjectPost_L source text reference

Complete Source

SQL116 lines
1CREATE PROCEDURE TSB_ZBaseTreeOwnsObject(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent10  DECLARE @QER_BitPatternOwnershipInfo_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Top|',11  0)12  DECLARE @QER_BitPatternOwnershipInfo_Lower int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|',13  0)14  DECLARE @QER_BitPatternOwnershipInfo_Higher int = dbo.QER_FGIBitPatternOwnershipInfo('|Higher|',15  0)16  DECLARE @QER_BitPatternOwnershipInfo_Lower_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|Top|',17  0)18  DECLARE @QER_BitPatternOwnershipInfo_Higher_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Higher|Top|',19  0)20  BEGIN TRY21    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,22    UID_Parameter,23    UID_SubParameter,24    GenProcID)25    SELECT26      UID_DialogDBQueue,27      UID_Parameter,28      UID_SubParameter,29      GenProcID30    FROM QBMDBQueueCurrent cu31      WITH(readpast)32    WHERE33      cu.SlotNumber = @SlotNumber34    IF @@rowcount = 035    BEGIN36      GOTO EndLabel37    END38    INSERT INTO @SourceData(IsUpcommingContent,39    XOriginAfter,40    Element,41    AssignedElement,42    XOriginBefore)43    SELECT44      0,45      0,46      bho.uid_Org,47      bho.ObjectKey,48      bho.OwnershipInfo49    FROM BaseTreeOwnsObject bho50    JOIN UNSRootB a51      ON bho.ObjectKey = a.XObjectKey52    JOIN @DBQueueCurrent x53      ON a.UID_UNSRootB = x.uid_parameter54    INSERT INTO @SourceData(IsUpcommingContent,55    XOriginBefore,56    Element,57    AssignedElement,58    XOriginAfter)59    SELECT60      1,61      0,62      bc.UID_ParentOrg,63      d.XObjectKey,64    CASE65      WHEN d.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg = d.UID_AERoleOwner THEN66    @QER_BitPatternOwnershipInfo_Higher67      WHEN d.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg <> d.UID_AERoleOwner THEN68    @QER_BitPatternOwnershipInfo_Higher_Top69    ELSE @QER_BitPatternOwnershipInfo_Top70    END71    FROM UNSRootB d72    JOIN @DBQueueCurrent x73      ON d.UID_UNSRootB = x.uid_parameter CROSS74    JOIN(75    SELECT 'TSB-AEROLE-NAMESPACEADMIN-UNSB' AS TopNode) AS o76    JOIN BaseTree b77      ON b.UID_Org = CASE78    WHEN d.UID_AERoleOwner > ' ' THEN79    d.UID_AERoleOwner80    ELSE o.TopNode81    END82    JOIN BaseTreeCollection bc83      ON bc.UID_Org = b.UID_Org AND EXISTS(84    SELECT TOP 1 185    FROM BaseTreeCollection up86    WHERE87      up.UID_Org = bc.UID_Org AND up.UID_ParentOrg = o.TopNode)88    LEFT89    OUTER90    JOIN BaseTreeCollection up291      ON bc.UID_ParentOrg = up2.UID_ParentOrg AND up2.UID_Org <> up2.UID_ParentOrg AND up2.UID_Org = o.TopNode92    WHERE93      up2.UID_Org IS NULL calculateDifference:94    EXEC QBM_PDBQueueCalculateDelta @SourceData,95      @DeltaQuantity = 0,96      @DeltaDelete = 1,97      @DeltaInsert = 1,98      @DeltaOrigin = 1,99      @CountDeltaQantity = @CountDeltaQantity OUTPUT,100      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,101      @UseIsInEffect = 0,102      @SlotNumber = @SlotNumber,103      @DBQueueCurrentExtern = @DBQueueCurrent104    EXEC QER_PBasetreeOwnsObjectPost_L @CountDeltaOrigin,105      @CountDeltaQantity,106      @DBQueueCurrent107  END TRY108  BEGIN CATCH109    EXEC QBM_PSessionErrorAdd DEFAULT110    RAISERROR('',111    18,112    1)113      WITH NOWAIT114  END CATCH115  endLabel:116END
Open raw exported source
SQL ยท Raw20 lines
1      create   procedure TSB_ZBaseTreeOwnsObject (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin2 int declare @DBQueueCurrent QBM_YDBQueueCurrent declare @QER_BitPatternOwnershipInfo_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Top|', 0) declare 3@QER_BitPatternOwnershipInfo_Lower int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|', 0) declare @QER_BitPatternOwnershipInfo_Higher int = dbo.QER_FGIBitPatternOwnershipInfo4('|Higher|', 0) declare @QER_BitPatternOwnershipInfo_Lower_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|Top|', 0) declare @QER_BitPatternOwnershipInfo_Higher_Top5 int = dbo.QER_FGIBitPatternOwnershipInfo('|Higher|Top|', 0)  BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter,6 GenProcID) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber7 if @@rowcount = 0 begin goto EndLabel end  insert into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore ) select8 0, 0 , bho.uid_Org, bho.ObjectKey, bho.OwnershipInfo from BaseTreeOwnsObject bho join UNSRootB a on bho.ObjectKey = a.XObjectKey join @DBQueueCurrent 9x on a.UID_UNSRootB = x.uid_parameter  insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 100 , bc.UID_ParentOrg, d.XObjectKey, case when d.UID_AERoleOwner > ' ' and bc.UID_ParentOrg = d.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Higher11 when d.UID_AERoleOwner > ' ' and bc.UID_ParentOrg <> d.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Higher_Top else @QER_BitPatternOwnershipInfo_Top12 end from UNSRootB d join @DBQueueCurrent x on d.UID_UNSRootB = x.uid_parameter cross join (select 'TSB-AEROLE-NAMESPACEADMIN-UNSB' as TopNode ) as o  13join BaseTree b on b.UID_Org = case when d.UID_AERoleOwner > ' ' then d.UID_AERoleOwner else o.TopNode end JOIN BaseTreeCollection bc on bc.UID_Org = b.UID_Org14  and exists (select Top 1 1 from BaseTreeCollection up where up.UID_Org = bc.UID_Org and up.UID_ParentOrg = o.TopNode )  left outer join BaseTreeCollection15 up2 on bc.UID_ParentOrg = up2.UID_ParentOrg and up2.UID_Org <> up2.UID_ParentOrg and up2.UID_Org = o.TopNode where up2.UID_Org is null calculateDifference:16 exec QBM_PDBQueueCalculateDelta @SourceData, @DeltaQuantity = 0, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin = 1, @CountDeltaQantity = @CountDeltaQantity17 output , @CountDeltaOrigin = @CountDeltaOrigin output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = @DBQueueCurrent exec 18QER_PBasetreeOwnsObjectPost_L @CountDeltaOrigin, @CountDeltaQantity, @DBQueueCurrent END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR (''19, 18, 1) WITH NOWAIT END CATCH endLabel: end 20