Back to OIM Explorer

dbo.TSB_ZBaseTreeHasObject

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 6.340 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.QBM_FGIBitPatternXOrigin source text reference
  • references source dbo.QBM_FGIModuleExists source text reference
  • references source dbo.QER_FCVXOriginToInheritInfo source text reference
  • references source dbo.QER_FGIBitPatternInheritInfo source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QER_PBasetreeHasObjectPostProc source text reference

Complete Source

SQL251 lines
1CREATE PROCEDURE TSB_ZBaseTreeHasObject(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @Sourcedata QBM_YDataForDelta,7  @CountDeltaQantity int,8  @CountDeltaOrigin int9  DECLARE @QER_BitPattern_Inherit_0 int = dbo.QER_FGIBitPatternInheritInfo('|Inherit|',10  0)11  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent12  DECLARE @QBM_BitPatternXOrigin_Inherit int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',13  0)14  BEGIN TRY15    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,16    UID_Parameter,17    UID_SubParameter,18    GenProcID)19    SELECT20      UID_DialogDBQueue,21      UID_Parameter,22      UID_SubParameter,23      GenProcID24    FROM QBMDBQueueCurrent cu25      WITH(readpast)26    WHERE27      cu.SlotNumber = @SlotNumber28    IF @@rowcount = 029    BEGIN30      GOTO EndLabel31    END32    INSERT INTO @SourceData(IsUpcommingContent,33    XOriginAfter,34    Element,35    AssignedElement,36    XOriginBefore)37    SELECT38      0,39      0,40      uid_Org,41      ObjectKey,42      InheritInfo43    FROM BaseTreeHasObject bho44    JOIN @DBQueueCurrent x45      ON uid_Org = x.uid_parameter46    WHERE47      bho.ObjectKey LIKE '<Key><T>UNSGroupB</T>%' OR bho.ObjectKey LIKE '<Key><T>UNSGroupB1</T>%' OR bho.ObjectKey LIKE '<Key><T>UNSGroupB2</T>%' OR48    bho.ObjectKey LIKE '<Key><T>UNSGroupB3</T>%' OR bho.ObjectKey LIKE '<Key><T>TSBAccountDef</T>%'49    INSERT INTO @SourceData(IsUpcommingContent,50    XOriginBefore,51    Element,52    AssignedElement,53    XOriginAfter)54    SELECT55      1,56      0,57      y.UID_Org,58      z.XObjectKey,59      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)60    FROM BaseTreeHasUNSGroupB y61    JOIN @DBQueueCurrent x62      ON y.UID_Org= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 163    JOIN UNSGroupB z64      ON z.uid_UNSGroupB = y.uid_UNSGroupB65    UNION all66    SELECT67      1,68      0,69      y.UID_Org,70      z.XObjectKey,71      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)72    FROM BaseTreeHasUNSGroupB1 y73    JOIN @DBQueueCurrent x74      ON y.UID_Org= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 175    JOIN UNSGroupB1 z76      ON z.uid_UNSGroupB1 = y.uid_UNSGroupB177    UNION all78    SELECT79      1,80      0,81      y.UID_Org,82      z.XObjectKey,83      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)84    FROM BaseTreeHasUNSGroupB2 y85    JOIN @DBQueueCurrent x86      ON y.UID_Org= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 187    JOIN UNSGroupB2 z88      ON z.uid_UNSGroupB2 = y.uid_UNSGroupB289    UNION all90    SELECT91      1,92      0,93      y.UID_Org,94      z.XObjectKey,95      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)96    FROM BaseTreeHasUNSGroupB3 y97    JOIN @DBQueueCurrent x98      ON y.UID_Org= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 199    JOIN UNSGroupB3 z100      ON z.uid_UNSGroupB3 = y.uid_UNSGroupB3101    INSERT INTO @SourceData(IsUpcommingContent,102    XOriginBefore,103    Element,104    AssignedElement,105    XOriginAfter)106    SELECT107      1,108      0,109      y.UID_Org,110      z.XObjectKey,111      dbo.QER_FCVXOriginToInheritInfo(y.XOrigin)112    FROM BaseTreeHasTSBAccountDef y113    JOIN @DBQueueCurrent x114      ON y.UID_Org= x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 1115    JOIN TSBAccountDef z116      ON z.UID_TSBAccountDef = y.UID_TSBAccountDef117    IF dbo.QBM_FGIModuleExists('RMS') = 1118    BEGIN119      INSERT INTO @SourceData(IsUpcommingContent,120      XOriginBefore,121      Element,122      AssignedElement,123      XOriginAfter)124      SELECT125        1,126        0,127        y.UID_Org,128        ehe.Entitlement,129        dbo.QER_FCVXOriginToInheritInfo(@QBM_BitPatternXOrigin_Inherit)130      FROM BaseTreeHasESet y131      JOIN @DBQueueCurrent x132        ON y.UID_Org = x.uid_parameter AND y.XOrigin > 0 AND y.XIsInEffect = 1133      JOIN ESetHasEntitlement ehe134        ON ehe.UID_ESet = y.UID_ESet AND ehe.XOrigin > 0 AND ehe.XIsInEffect = 1135      JOIN BaseTree b136        ON y.UID_Org = b.UID_Org AND NOT(b.UID_OrgRoot IN('QER-V-ITShopOrg', 'QER-V-ITShopSrc') AND b.ITShopInfo IN('BO',137      'PR', 'BG', 'BT'))138      JOIN OrgRootAssign oa139        ON oa.UID_OrgRoot = b.UID_OrgRoot AND oa.IsAssignmentAllowed = 1140      WHERE141        ((ehe.Entitlement LIKE '<Key><T>UNSGroupB</T>%' AND oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB') OR(ehe.Entitlement LIKE '<Key><T>UNSGroupB1</T>%' AND142      oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB1') OR(ehe.Entitlement LIKE '<Key><T>UNSGroupB2</T>%' AND oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB2'143      ) OR(ehe.Entitlement LIKE '<Key><T>UNSGroupB3</T>%' AND oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB3') OR(ehe.Entitlement LIKE '<Key><T>TSBAccountDef</T>%' AND144      oa.UID_BaseTreeAssign = 'TSB-AsgnBT-TSBAccountDef'))145    END146    INSERT INTO @SourceData(IsUpcommingContent,147    XOriginBefore,148    Element,149    AssignedElement,150    XOriginAfter)151    SELECT152      1,153      0,154      t.Element,155      t.XObjectKey,156      @QER_BitPattern_Inherit_0157    FROM(158    SELECT159      DISTINCT ho.Element,160      p.XObjectKey161    FROM @SourceData ho162    JOIN UNSGroupB g163      ON ho.AssignedElement = g.XObjectKey164    JOIN UNSGroupBCollection co165      ON co.UID_UNSGroupBChild = g.uid_UNSGroupB166    JOIN UNSGroupB p167      ON co.UID_UNSGroupBParent = p.UID_UNSGroupB168    WHERE169      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupBChild <> co.UID_UNSGroupBParent) AS t170    UNION all171    SELECT172      1,173      0,174      t.Element,175      t.XObjectKey,176      @QER_BitPattern_Inherit_0177    FROM(178    SELECT179      DISTINCT ho.Element,180      p.XObjectKey181    FROM @SourceData ho182    JOIN UNSGroupB1 g183      ON ho.AssignedElement = g.XObjectKey184    JOIN UNSGroupB1Collection co185      ON co.UID_UNSGroupB1Child = g.uid_UNSGroupB1186    JOIN UNSGroupB1 p187      ON co.UID_UNSGroupB1Parent = p.UID_UNSGroupB1188    WHERE189      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupB1Child <> co.UID_UNSGroupB1Parent) AS t190    UNION all191    SELECT192      1,193      0,194      t.Element,195      t.XObjectKey,196      @QER_BitPattern_Inherit_0197    FROM(198    SELECT199      DISTINCT ho.Element,200      p.XObjectKey201    FROM @SourceData ho202    JOIN UNSGroupB2 g203      ON ho.AssignedElement = g.XObjectKey204    JOIN UNSGroupB2Collection co205      ON co.UID_UNSGroupB2Child = g.uid_UNSGroupB2206    JOIN UNSGroupB2 p207      ON co.UID_UNSGroupB2Parent = p.UID_UNSGroupB2208    WHERE209      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupB2Child <> co.UID_UNSGroupB2Parent) AS t210    UNION all211    SELECT212      1,213      0,214      t.Element,215      t.XObjectKey,216      @QER_BitPattern_Inherit_0217    FROM(218    SELECT219      DISTINCT ho.Element,220      p.XObjectKey221    FROM @SourceData ho222    JOIN UNSGroupB3 g223      ON ho.AssignedElement = g.XObjectKey224    JOIN UNSGroupB3Collection co225      ON co.UID_UNSGroupB3Child = g.uid_UNSGroupB3226    JOIN UNSGroupB3 p227      ON co.UID_UNSGroupB3Parent = p.UID_UNSGroupB3228    WHERE229      ho.IsUpcommingContent = 1 AND co.UID_UNSGroupB3Child <> co.UID_UNSGroupB3Parent) AS t berechnen:230    EXEC QBM_PDBQueueCalculateDelta @SourceData,231      @DeltaQuantity = 0,232      @DeltaDelete = 1,233      @DeltaInsert = 1,234      @DeltaOrigin = 1,235      @CountDeltaQantity = @CountDeltaQantity OUTPUT,236      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,237      @UseIsInEffect = 0,238      @SlotNumber = @SlotNumber,239      @DBQueueCurrentExtern = @DBQueueCurrent240    EXEC QER_PBasetreeHasObjectPostProc @CountDeltaOrigin,241      @CountDeltaQantity242  END TRY243  BEGIN CATCH244    EXEC QBM_PSessionErrorAdd DEFAULT245    RAISERROR('',246    18,247    1)248      WITH NOWAIT249  END CATCH250  endLabel:251END
Open raw exported source
SQL ยท Raw41 lines
1      create   procedure TSB_ZBaseTreeHasObject (@SlotNumber int) AS begin declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin2 int declare @QER_BitPattern_Inherit_0 int = dbo.QER_FGIBitPatternInheritInfo('|Inherit|', 0) declare @DBQueueCurrent QBM_YDBQueueCurrent declare @QBM_BitPatternXOrigin_Inherit3 int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 0)  BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID4) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount5 = 0 begin goto EndLabel end insert into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore ) select 0, 0 , uid_Org6, ObjectKey, InheritInfo from BaseTreeHasObject bho join @DBQueueCurrent x on uid_Org = x.uid_parameter where bho.ObjectKey like '<Key><T>UNSGroupB</T>%'7 or bho.ObjectKey like '<Key><T>UNSGroupB1</T>%' or bho.ObjectKey like '<Key><T>UNSGroupB2</T>%' or bho.ObjectKey like '<Key><T>UNSGroupB3</T>%' or bho.ObjectKey8 like '<Key><T>TSBAccountDef</T>%'  insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 ,9 y.UID_Org, z.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(y.XOrigin) from BaseTreeHasUNSGroupB y join @DBQueueCurrent x on y.UID_Org= x.uid_parameter and10 y.XOrigin > 0 and y.XIsInEffect = 1 join UNSGroupB z on z.uid_UNSGroupB = y.uid_UNSGroupB union all select 1, 0 , y.UID_Org, z.XObjectKey, dbo.QER_FCVXOriginToInheritInfo11(y.XOrigin) from BaseTreeHasUNSGroupB1 y join @DBQueueCurrent x on y.UID_Org= x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1 join UNSGroupB1 z12 on z.uid_UNSGroupB1 = y.uid_UNSGroupB1 union all select 1, 0 , y.UID_Org, z.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(y.XOrigin) from BaseTreeHasUNSGroupB213 y join @DBQueueCurrent x on y.UID_Org= x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1 join UNSGroupB2 z on z.uid_UNSGroupB2 = y.uid_UNSGroupB214 union all select 1, 0 , y.UID_Org, z.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(y.XOrigin) from BaseTreeHasUNSGroupB3 y join @DBQueueCurrent x on y.UID_Org=15 x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1 join UNSGroupB3 z on z.uid_UNSGroupB3 = y.uid_UNSGroupB3 insert into @SourceData( IsUpcommingContent16, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , y.UID_Org, z.XObjectKey, dbo.QER_FCVXOriginToInheritInfo(y.XOrigin) from BaseTreeHasTSBAccountDef17 y join @DBQueueCurrent x on y.UID_Org= x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1 join TSBAccountDef z on z.UID_TSBAccountDef = y.UID_TSBAccountDef18 if dbo.QBM_FGIModuleExists('RMS') = 1 begin insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select19 1, 0 , y.UID_Org, ehe.Entitlement, dbo.QER_FCVXOriginToInheritInfo(@QBM_BitPatternXOrigin_Inherit) from BaseTreeHasESet y join @DBQueueCurrent x on y.UID_Org20 = x.uid_parameter and y.XOrigin > 0 and y.XIsInEffect = 1 join ESetHasEntitlement ehe on ehe.UID_ESet = y.UID_ESet and ehe.XOrigin > 0 and ehe.XIsInEffect21 = 1 join BaseTree b on y.UID_Org = b.UID_Org  and not (b.UID_OrgRoot in ( 'QER-V-ITShopOrg', 'QER-V-ITShopSrc') and b.ITShopInfo in ( 'BO', 'PR', 'BG'22, 'BT') ) join OrgRootAssign oa on oa.UID_OrgRoot = b.UID_OrgRoot and oa.IsAssignmentAllowed = 1 where ((ehe.Entitlement like '<Key><T>UNSGroupB</T>%' 23and oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB') or (ehe.Entitlement like '<Key><T>UNSGroupB1</T>%' and oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB1'24) or (ehe.Entitlement like '<Key><T>UNSGroupB2</T>%' and oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB2') or (ehe.Entitlement like '<Key><T>UNSGroupB3</T>%'25 and oa.UID_BaseTreeAssign = 'TSB-AsgnBT-UNSGroupB3') or (ehe.Entitlement like '<Key><T>TSBAccountDef</T>%' and oa.UID_BaseTreeAssign = 'TSB-AsgnBT-TSBAccountDef'26) )        end   insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter ) select 1, 0 , t.Element, t.XObjectKey27, @QER_BitPattern_Inherit_0 from ( select distinct ho.Element, p.XObjectKey from @SourceData ho join UNSGroupB g on ho.AssignedElement = g.XObjectKey  28join UNSGroupBCollection co on co.UID_UNSGroupBChild = g.uid_UNSGroupB join UNSGroupB p on co.UID_UNSGroupBParent = p.UID_UNSGroupB where ho.IsUpcommingContent29 = 1 and co.UID_UNSGroupBChild <> co.UID_UNSGroupBParent  ) as t         union all select 1, 0 , t.Element, t.XObjectKey, @QER_BitPattern_Inherit_0 from30 ( select distinct ho.Element, p.XObjectKey from @SourceData ho join UNSGroupB1 g on ho.AssignedElement = g.XObjectKey join UNSGroupB1Collection co on 31co.UID_UNSGroupB1Child = g.uid_UNSGroupB1 join UNSGroupB1 p on co.UID_UNSGroupB1Parent = p.UID_UNSGroupB1 where ho.IsUpcommingContent = 1 and co.UID_UNSGroupB1Child32 <> co.UID_UNSGroupB1Parent ) as t union all select 1, 0 , t.Element, t.XObjectKey, @QER_BitPattern_Inherit_0 from ( select distinct ho.Element, p.XObjectKey33 from @SourceData ho join UNSGroupB2 g on ho.AssignedElement = g.XObjectKey join UNSGroupB2Collection co on co.UID_UNSGroupB2Child = g.uid_UNSGroupB2 join34 UNSGroupB2 p on co.UID_UNSGroupB2Parent = p.UID_UNSGroupB2 where ho.IsUpcommingContent = 1 and co.UID_UNSGroupB2Child <> co.UID_UNSGroupB2Parent ) as 35t union all select 1, 0 , t.Element, t.XObjectKey, @QER_BitPattern_Inherit_0 from ( select distinct ho.Element, p.XObjectKey from @SourceData ho join UNSGroupB336 g on ho.AssignedElement = g.XObjectKey join UNSGroupB3Collection co on co.UID_UNSGroupB3Child = g.uid_UNSGroupB3 join UNSGroupB3 p on co.UID_UNSGroupB3Parent37 = p.UID_UNSGroupB3 where ho.IsUpcommingContent = 1 and co.UID_UNSGroupB3Child <> co.UID_UNSGroupB3Parent ) as t berechnen: exec QBM_PDBQueueCalculateDelta38 @SourceData, @DeltaQuantity = 0, @DeltaDelete = 1, @DeltaInsert = 1, @DeltaOrigin = 1, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin39 = @CountDeltaOrigin output , @UseIsInEffect = 0 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern = @DBQueueCurrent exec QER_PBasetreeHasObjectPostProc40 @CountDeltaOrigin, @CountDeltaQantity END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH endLabel: end 41