Back to OIM Explorer

dbo.ADS_ZBaseTreeOwnsObject

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

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

SQL174 lines
1CREATE PROCEDURE ADS_ZBaseTreeOwnsObject(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @TopNode varchar(38)10  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent11  DECLARE @QER_BitPatternOwnershipInfo_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Top|',12  0)13  DECLARE @QER_BitPatternOwnershipInfo_Lower int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|',14  0)15  DECLARE @QER_BitPatternOwnershipInfo_Higher int = dbo.QER_FGIBitPatternOwnershipInfo('|Higher|',16  0)17  DECLARE @QER_BitPatternOwnershipInfo_Lower_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|Top|',18  0)19  DECLARE @QER_BitPatternOwnershipInfo_Higher_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Higher|Top|',20  0)21  BEGIN TRY22    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,23    UID_Parameter,24    UID_SubParameter,25    GenProcID)26    SELECT27      UID_DialogDBQueue,28      UID_Parameter,29      UID_SubParameter,30      GenProcID31    FROM QBMDBQueueCurrent cu32      WITH(readpast)33    WHERE34      cu.SlotNumber = @SlotNumber35    IF @@rowcount = 036    BEGIN37      GOTO EndLabel38    END39    SELECT @TopNode = 'ADS-AEROLE-NAMESPACEADMIN-ADS'40    INSERT INTO @SourceData(IsUpcommingContent,41    XOriginAfter,42    Element,43    AssignedElement,44    XOriginBefore)45    SELECT46      0,47      0,48      bho.uid_Org,49      bho.ObjectKey,50      bho.OwnershipInfo51    FROM BaseTreeOwnsObject bho52    JOIN(53    SELECT54      a.XObjectKey,55      a.UID_ADSDomain56    FROM ADSDomain a57    UNION all58    SELECT59      c.XObjectKey,60      c.UID_ADSDomain61    FROM ADSContainer c) AS y62      ON bho.ObjectKey = y.XObjectKey63    JOIN @DBQueueCurrent x64      ON y.UID_ADSDomain = x.uid_parameter65    INSERT INTO @SourceData(IsUpcommingContent,66    XOriginBefore,67    Element,68    AssignedElement,69    XOriginAfter)70    SELECT71      1,72      0,73      x.Element,74      x.AssignedElement,75      x.XOriginAfter76    FROM(77    SELECT78      c.XObjectKey AS AssignedElement,79    CASE80      WHEN c.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg = c.UID_AERoleOwner THEN81    @QER_BitPatternOwnershipInfo_Lower82      WHEN c.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg <> c.UID_AERoleOwner THEN83    @QER_BitPatternOwnershipInfo_Lower_Top84      WHEN d.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg = d.UID_AERoleOwner THEN85    @QER_BitPatternOwnershipInfo_Higher86      WHEN d.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg <> d.UID_AERoleOwner THEN87    @QER_BitPatternOwnershipInfo_Higher_Top88    ELSE @QER_BitPatternOwnershipInfo_Top89    END AS XOriginAfter,90    bc.UID_ParentOrg AS Element91    FROM ADSDomain d92    JOIN @DBQueueCurrent x93      ON d.UID_ADSDomain = x.uid_parameter CROSS94    JOIN(95    SELECT @TopNode AS TopNode) AS o96    JOIN ADSContainer c97      ON c.UID_ADSDomain = d.UID_ADSDomain98    JOIN BaseTree b99      ON b.UID_Org = CASE100    WHEN c.UID_AERoleOwner > ' ' THEN101    c.UID_AERoleOwner102    WHEN d.UID_AERoleOwner > ' ' THEN103    d.UID_AERoleOwner104    ELSE o.TopNode105    END106    JOIN BaseTreeCollection bc107      ON bc.UID_Org = b.UID_Org AND EXISTS(108    SELECT TOP 1 1109    FROM BaseTreeCollection up110    WHERE111      up.UID_Org = bc.UID_Org AND up.UID_ParentOrg = @TopNode)112    LEFT113    OUTER114    JOIN BaseTreeCollection up2115      ON bc.UID_ParentOrg = up2.UID_ParentOrg AND up2.UID_Org <> up2.UID_ParentOrg AND up2.UID_Org = @TopNode116    WHERE117      up2.UID_Org IS NULL118    UNION119    SELECT120      d.XObjectKey AS AssignedElement,121    CASE122      WHEN d.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg = d.UID_AERoleOwner THEN123    @QER_BitPatternOwnershipInfo_Higher124      WHEN d.UID_AERoleOwner > ' ' AND bc.UID_ParentOrg <> d.UID_AERoleOwner THEN125    @QER_BitPatternOwnershipInfo_Higher_Top126    ELSE @QER_BitPatternOwnershipInfo_Top127    END AS XOriginAfter,128    bc.UID_ParentOrg AS Element129    FROM ADSDomain d130    JOIN @DBQueueCurrent x131      ON d.UID_ADSDomain = x.uid_parameter CROSS132    JOIN(133    SELECT @TopNode AS TopNode) AS o134    JOIN BaseTree b135      ON b.UID_Org = CASE136    WHEN d.UID_AERoleOwner > ' ' THEN137    d.UID_AERoleOwner138    ELSE o.TopNode139    END140    JOIN BaseTreeCollection bc141      ON bc.UID_Org = b.UID_Org AND EXISTS(142    SELECT TOP 1 1143    FROM BaseTreeCollection up144    WHERE145      up.UID_Org = bc.UID_Org AND up.UID_ParentOrg = @TopNode)146    LEFT147    OUTER148    JOIN BaseTreeCollection up2149      ON bc.UID_ParentOrg = up2.UID_ParentOrg AND up2.UID_Org <> up2.UID_ParentOrg AND up2.UID_Org = @TopNode150    WHERE151      up2.UID_Org IS NULL) AS x calculateDifference:152    EXEC QBM_PDBQueueCalculateDelta @SourceData,153      @DeltaQuantity = 0,154      @DeltaDelete = 1,155      @DeltaInsert = 1,156      @DeltaOrigin = 1,157      @CountDeltaQantity = @CountDeltaQantity OUTPUT,158      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,159      @UseIsInEffect = 0,160      @SlotNumber = @SlotNumber,161      @DBQueueCurrentExtern = @DBQueueCurrent162    EXEC QER_PBasetreeOwnsObjectPost_L @CountDeltaOrigin,163      @CountDeltaQantity,164      @DBQueueCurrent165  END TRY166  BEGIN CATCH167    EXEC QBM_PSessionErrorAdd DEFAULT168    RAISERROR('',169    18,170    1)171      WITH NOWAIT172  END CATCH173  endLabel:174END
Open raw exported source
SQL ยท Raw30 lines
1      create   procedure ADS_ZBaseTreeOwnsObject (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin2 int declare @TopNode varchar(38) declare @DBQueueCurrent QBM_YDBQueueCurrent declare @QER_BitPatternOwnershipInfo_Top int = dbo.QER_FGIBitPatternOwnershipInfo3('|Top|', 0) declare @QER_BitPatternOwnershipInfo_Lower int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|', 0) declare @QER_BitPatternOwnershipInfo_Higher4 int = dbo.QER_FGIBitPatternOwnershipInfo('|Higher|', 0) declare @QER_BitPatternOwnershipInfo_Lower_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Lower|Top|'5, 0) declare @QER_BitPatternOwnershipInfo_Higher_Top int = dbo.QER_FGIBitPatternOwnershipInfo('|Higher|Top|', 0)  BEGIN TRY insert into @DBQueueCurrent6(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent7 cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount = 0 begin goto EndLabel end select @TopNode = 'ADS-AEROLE-NAMESPACEADMIN-ADS'  insert8 into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore ) select 0, 0 , bho.uid_Org, bho.ObjectKey, bho.OwnershipInfo9 from BaseTreeOwnsObject bho join (select a.XObjectKey, a.UID_ADSDomain from ADSDomain a union all select c.XObjectKey, c.UID_ADSDomain from ADSContainer10 c ) as y on bho.ObjectKey = y.XObjectKey join @DBQueueCurrent x on y.UID_ADSDomain = x.uid_parameter  insert into @SourceData( IsUpcommingContent, XOriginBefore11 , Element, AssignedElement, XOriginAfter ) select 1, 0 , x.Element, x.AssignedElement, x.XOriginAfter from ( select c.XObjectKey as AssignedElement , 12case when c.UID_AERoleOwner > ' ' and bc.UID_ParentOrg = c.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Lower when c.UID_AERoleOwner > ' ' and bc.UID_ParentOrg13 <> c.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Lower_Top when d.UID_AERoleOwner > ' ' and bc.UID_ParentOrg = d.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Higher14 when d.UID_AERoleOwner > ' ' and bc.UID_ParentOrg <> d.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Higher_Top else @QER_BitPatternOwnershipInfo_Top15 end as XOriginAfter , bc.UID_ParentOrg as Element from ADSDomain d join @DBQueueCurrent x on d.UID_ADSDomain = x.uid_parameter cross join (select @TopNode16 as TopNode ) as o join ADSContainer c on c.UID_ADSDomain = d.UID_ADSDomain  join BaseTree b on b.UID_Org = case when c.UID_AERoleOwner > ' ' then c.UID_AERoleOwner17 when d.UID_AERoleOwner > ' ' then d.UID_AERoleOwner else o.TopNode end JOIN BaseTreeCollection bc on bc.UID_Org = b.UID_Org  and exists (select Top 1 181 from BaseTreeCollection up where up.UID_Org = bc.UID_Org and up.UID_ParentOrg = @TopNode )  left outer join BaseTreeCollection up2 on bc.UID_ParentOrg19 = up2.UID_ParentOrg and up2.UID_Org <> up2.UID_ParentOrg and up2.UID_Org = @TopNode where up2.UID_Org is null union select d.XObjectKey as AssignedElement20 , case when d.UID_AERoleOwner > ' ' and bc.UID_ParentOrg = d.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Higher when d.UID_AERoleOwner > ' ' and21 bc.UID_ParentOrg <> d.UID_AERoleOwner then @QER_BitPatternOwnershipInfo_Higher_Top else @QER_BitPatternOwnershipInfo_Top end as XOriginAfter , bc.UID_ParentOrg22 as Element from ADSDomain d join @DBQueueCurrent x on d.UID_ADSDomain = x.uid_parameter cross join (select @TopNode as TopNode ) as o  join BaseTree b23 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_Org  and24 exists (select Top 1 1 from BaseTreeCollection up where up.UID_Org = bc.UID_Org and up.UID_ParentOrg = @TopNode )  left outer join BaseTreeCollection 25up2 on bc.UID_ParentOrg = up2.UID_ParentOrg and up2.UID_Org <> up2.UID_ParentOrg and up2.UID_Org = @TopNode where up2.UID_Org is null ) as x calculateDifference:26 exec QBM_PDBQueueCalculateDelta @SourceData, @DeltaQuantity = 0, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin = 1, @CountDeltaQantity = @CountDeltaQantity27 output , @CountDeltaOrigin = @CountDeltaOrigin output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = @DBQueueCurrent exec 28QER_PBasetreeOwnsObjectPost_L @CountDeltaOrigin, @CountDeltaQantity, @DBQueueCurrent END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR (''29, 18, 1) WITH NOWAIT END CATCH endLabel: end 30