Back to OIM Explorer

dbo.TSB_ZOrgHasTSBAccountDef

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure. Bulk DBQueue insert -> TSB-K-BaseTreeHasObject / TSB_ZBaseTreeHasObject at line 21; References QBM_PDBQueueInsert_Bulk

Source: sandbox-db sys.sql_modules

Source size: 4.643 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 -> TSB-K-BaseTreeHasObject / TSB_ZBaseTreeHasObject at line 21
  • References QBM_PDBQueueInsert_Bulk

Typed Edges

  • queues DBQueue task TSB_ZBaseTreeHasObject at line 21 Bulk DBQueue insert -> TSB-K-BaseTreeHasObject / TSB_ZBaseTreeHasObject at line 21
  • references source dbo.QBM_FGIBitPatternXOrigin source text reference
  • references source dbo.QBM_FGIConfigparmValue source text reference
  • references source dbo.QBM_FGIModuleExists source text reference
  • references source dbo.QBM_PDBQueueCalculateDelta source text reference
  • references source dbo.QBM_PDBQueueInsert_Bulk source text reference
  • references source dbo.QBM_PMNTableInsert source text reference
  • references source dbo.QBM_PMNTableOriginUpdate source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference
  • references source dbo.QER_PMNTableAddViewProperties source text reference
  • references source dbo.TSB_FTTSBAccountDefPredecessor source text reference
  • queues DBQueue task TSB-K-BaseTreeHasObject -> TSB_ZBaseTreeHasObject QBM_PDBQueueInsert_Bulk 'TSB-K-BaseTreeHasObject', @DBQueueElements_01 end end insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter , XIsInEffectAfter ) select 1, 0 , s.Element, pd.UID_TSBAcco…

Complete Source

SQL191 lines
1CREATE PROCEDURE TSB_ZOrgHasTSBAccountDef(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @GenProcID varchar(38)7  DECLARE @UID_BasetreeAssignToUse varchar(38) = 'TSB-AsgnBT-TSBAccountDef'8  DECLARE @Sourcedata QBM_YDataForDelta,9  @CountDeltaQantity int,10  @CountDeltaOrigin int11  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent12  DECLARE @QBM_BitPatternXOrigin_Inherit int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',13  0)14  DECLARE @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|',15  1)16  BEGIN TRY17    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,18    UID_Parameter,19    UID_SubParameter,20    GenProcID)21    SELECT22      UID_DialogDBQueue,23      UID_Parameter,24      UID_SubParameter,25      GenProcID26    FROM QBMDBQueueCurrent cu27      WITH(readpast)28    WHERE29      cu.SlotNumber = @SlotNumber30    IF @@rowcount = 031    BEGIN32      GOTO EndLabel33    END34    INSERT INTO @SourceData(IsUpcommingContent,35    XOriginAfter,36    Element,37    AssignedElement,38    XOriginBefore,39    XIsInEffectBefore)40    SELECT41      0,42      0,43      bha.UID_Org,44      bha.UID_TSBAccountDef AS UID_TSBAccountDef,45      XOrigin,46      bha.XIsInEffect47    FROM BaseTreeHasTSBAccountDef bha48    JOIN @DBQueueCurrent x49      ON UID_org =x.uid_parameter50    INSERT INTO @SourceData(IsUpcommingContent,51    XOriginBefore,52    XOriginAfter,53    Element,54    AssignedElement,55    XIsInEffectAfter)56    SELECT57      1,58      0,59      oha.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv,60      oha.uid_org,61      oha.UID_TSBAccountDef,62      163    FROM BaseTreeHasTSBAccountDef oha64    JOIN @DBQueueCurrent x65      ON oha.UID_org = x.uid_parameter66    WHERE67      oha.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 068    INSERT INTO @SourceData(IsUpcommingContent,69    XOriginBefore,70    Element,71    AssignedElement,72    XOriginAfter,73    XIsInEffectAfter)74    SELECT75      1,76      0,77      x.uid_parameter,78      oha.UID_TSBAccountDef,79      @QBM_BitPatternXOrigin_Inherit,80      181    FROM BaseTreeHasTSBAccountDef oha82    JOIN BaseTreeCollection oc83      ON oha.UID_org = oc.UID_parentorg AND oha.XOrigin > 0 AND oha.XIsInEffect = 184    JOIN @DBQueueCurrent x85      ON oc.UID_org = x.uid_parameter86    WHERE87      oc.UID_org <> oc.UID_parentorg AND oha.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 088    IF dbo.QBM_FGIModuleExists('RMS') = 189    BEGIN90      IF dbo.QBM_FGIConfigparmValue('QER\Structures\Inherite\NoESetSplitting') = ''91      BEGIN92        INSERT INTO @SourceData(IsUpcommingContent,93        XOriginBefore,94        Element,95        AssignedElement,96        XOriginAfter,97        XIsInEffectAfter)98        SELECT99          1,100          0,101          x.uid_parameter,102          y.UID_TSBAccountDef,103          @QBM_BitPatternXOrigin_Inherit,104          1105        FROM @DBQueueCurrent x106        JOIN BaseTreeHasEset bhe107          ON x.UID_Parameter = bhe.uid_org AND bhe.XOrigin > 0 AND bhe.XIsInEffect = 1108        JOIN ESetHasEntitlement ehe109          ON bhe.uid_ESet = ehe.uid_ESet AND ehe.XOrigin > 0 AND ehe.XIsInEffect = 1110        JOIN TSBAccountDef y111          ON ehe.entitlement = y.XObjectKey112        JOIN BaseTree b113          ON bhe.UID_Org = b.UID_Org AND NOT(b.UID_OrgRoot IN('QER-V-ITShopOrg', 'QER-V-ITShopSrc') AND b.ITShopInfo IN('BO',114        'PR', 'BG', 'BT'))115        JOIN OrgRootAssign oa116          ON oa.UID_OrgRoot = b.UID_OrgRoot AND oa.UID_BaseTreeAssign = @UID_BasetreeAssignToUse AND oa.IsAssignmentAllowed = 1117      END118      ELSE119      BEGIN120        DECLARE @DBQueueElements_01 QBM_YDBQueueRaw121        INSERT INTO @DBQueueElements_01(object,122        subobject,123        genprocid)124        SELECT125          x.uid,126          NULL,127          x.GenProcID128        FROM(129        SELECT130          cu.UID_Parameter AS uid,131          cu.GenProcID132        FROM @DBQueueCurrent cu) AS x133        EXEC QBM_PDBQueueInsert_Bulk 'TSB-K-BaseTreeHasObject',134          @DBQueueElements_01135      END136    END137    INSERT INTO @SourceData(IsUpcommingContent,138    XOriginBefore,139    Element,140    AssignedElement,141    XOriginAfter,142    XIsInEffectAfter)143    SELECT144      1,145      0,146      s.Element,147      pd.UID_TSBAccountDefPredecessor,148      @QBM_BitPatternXOrigin_Inherit,149      s.XIsInEffectAfter150    FROM @SourceData s151    JOIN BaseTree b152      ON s.element = b.UID_Org AND NOT(b.UID_OrgRoot IN('QER-V-ITShopOrg', 'QER-V-ITShopSrc') AND b.ITShopInfo IN('BO',153    'PR', 'BG', 'BT')) CROSS apply dbo.TSB_FTTSBAccountDefPredecessor(s.AssignedElement) pd154    WHERE155      s.IsUpcommingContent = 1 AND pd.UID_TSBAccountDef <> pd.UID_TSBAccountDefPredecessor156    EXEC QBM_PDBQueueCalculateDelta @SourceData,157      @DeltaQuantity = 0,158      @DeltaDelete = 0,159      @DeltaInsert = 1,160      @DeltaOrigin = 1,161      @CountDeltaQantity = @CountDeltaQantity OUTPUT,162      @CountDeltaOrigin = @CountDeltaOrigin OUTPUT,163      @UseIsInEffect = 1,164      @SlotNumber = @SlotNumber,165      @DBQueueCurrentExtern = @DBQueueCurrent166    IF @CountDeltaOrigin > 0167    BEGIN168      EXEC QBM_PMNTableOriginUpdate 'BaseTreeHasTSBAccountDef',169      'UID_Org',170      'uid_TSBAccountDef'171    END172    IF @CountDeltaQantity > 0173    BEGIN174      EXEC QER_PMNTableAddViewProperties 'BaseTreeHasTSBAccountDef'175      EXEC QBM_PMNTableInsert 'BaseTreeHasTSBAccountDef',176      'UID_Org',177      'uid_TSBAccountDef',178        @TargetIsView = 1,179        @FKTableNameElement = 'BaseTree',180        @FKColumnNameElement = 'UID_Org'181    END182  END TRY183  BEGIN CATCH184    EXEC QBM_PSessionErrorAdd DEFAULT185    RAISERROR('',186    18,187    1)188      WITH NOWAIT189  END CATCH190  endLabel:191END
Open raw exported source
SQL · Raw31 lines
1       create   procedure TSB_ZOrgHasTSBAccountDef (@SlotNumber int) AS begin declare @GenProcID varchar(38) declare @UID_BasetreeAssignToUse varchar2(38) = 'TSB-AsgnBT-TSBAccountDef' declare @Sourcedata QBM_YDataForDelta , @CountDeltaQantity int , @CountDeltaOrigin int declare @DBQueueCurrent QBM_YDBQueueCurrent3 declare @QBM_BitPatternXOrigin_Inherit int = dbo.QBM_FGIBitPatternXOrigin('|Inherit|', 0) declare @QBM_BitPatternXOrigin_Inherit_inv int = dbo.QBM_FGIBitPatternXOrigin4('|Inherit|', 1)  BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter5, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber = @SlotNumber if @@rowcount = 0 begin goto EndLabel end  insert6 into @SourceData( IsUpcommingContent, XOriginAfter , Element, AssignedElement, XOriginBefore , XIsInEffectBefore ) select 0, 0 , bha.UID_Org, bha.UID_TSBAccountDef7 as UID_TSBAccountDef, XOrigin , bha.XIsInEffect from BaseTreeHasTSBAccountDef bha join @DBQueueCurrent x on UID_org =x.uid_parameter  insert into @SourceData8( IsUpcommingContent, XOriginBefore, XOriginAfter , Element, AssignedElement , XIsInEffectAfter ) select 1, 0, oha.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv9 , oha.uid_org, oha.UID_TSBAccountDef , 1 from BaseTreeHasTSBAccountDef oha join @DBQueueCurrent x on oha.UID_org = x.uid_parameter  where oha.XOrigin 10& @QBM_BitPatternXOrigin_Inherit_inv > 0 insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter , XIsInEffectAfter11 ) select 1, 0 , x.uid_parameter, oha.UID_TSBAccountDef, @QBM_BitPatternXOrigin_Inherit , 1 from BaseTreeHasTSBAccountDef oha join BaseTreeCollection oc12 on oha.UID_org = oc.UID_parentorg and oha.XOrigin > 0 and oha.XIsInEffect = 1 join @DBQueueCurrent x on oc.UID_org = x.uid_parameter where oc.UID_org 13<> oc.UID_parentorg  and oha.XOrigin & @QBM_BitPatternXOrigin_Inherit_inv > 0 if dbo.QBM_FGIModuleExists('RMS') = 1 begin if dbo.QBM_FGIConfigparmValue14('QER\Structures\Inherite\NoESetSplitting') = '' begin insert into @SourceData( IsUpcommingContent, XOriginBefore , Element, AssignedElement, XOriginAfter15 , XIsInEffectAfter ) select 1, 0 , x.uid_parameter, y.UID_TSBAccountDef, @QBM_BitPatternXOrigin_Inherit  , 1 from @DBQueueCurrent x join BaseTreeHasEset16 bhe on x.UID_Parameter = bhe.uid_org and bhe.XOrigin > 0 and bhe.XIsInEffect = 1 join ESetHasEntitlement ehe on bhe.uid_ESet = ehe.uid_ESet and ehe.XOrigin17 > 0 and ehe.XIsInEffect = 1 join TSBAccountDef y on ehe.entitlement = y.XObjectKey join BaseTree b on bhe.UID_Org = b.UID_Org  and not (b.UID_OrgRoot 18in ( 'QER-V-ITShopOrg', 'QER-V-ITShopSrc') and b.ITShopInfo in ( 'BO', 'PR', 'BG', 'BT') ) join OrgRootAssign oa on oa.UID_OrgRoot = b.UID_OrgRoot and 19oa.UID_BaseTreeAssign = @UID_BasetreeAssignToUse and oa.IsAssignmentAllowed = 1 end else begin  declare @DBQueueElements_01 QBM_YDBQueueRaw insert into20 @DBQueueElements_01 (object, subobject, genprocid) select x.uid, null, x.GenProcID from ( select cu.UID_Parameter as uid, cu.GenProcID from @DBQueueCurrent21 cu ) as x exec QBM_PDBQueueInsert_Bulk 'TSB-K-BaseTreeHasObject', @DBQueueElements_01 end end  insert into @SourceData( IsUpcommingContent, XOriginBefore22 , Element, AssignedElement, XOriginAfter , XIsInEffectAfter ) select 1, 0 , s.Element, pd.UID_TSBAccountDefPredecessor, @QBM_BitPatternXOrigin_Inherit23 , s.XIsInEffectAfter from @SourceData s join BaseTree b on s.element = b.UID_Org and not (b.UID_OrgRoot in ( 'QER-V-ITShopOrg', 'QER-V-ITShopSrc') and24 b.ITShopInfo in ( 'BO', 'PR', 'BG', 'BT') ) cross apply dbo.TSB_FTTSBAccountDefPredecessor(s.AssignedElement) pd where s.IsUpcommingContent = 1 and pd.UID_TSBAccountDef25 <> pd.UID_TSBAccountDefPredecessor  exec QBM_PDBQueueCalculateDelta @SourceData, @DeltaQuantity = 0, @DeltaDelete = 0, @DeltaInsert = 1, @DeltaOrigin 26= 1, @CountDeltaQantity = @CountDeltaQantity output , @CountDeltaOrigin = @CountDeltaOrigin output , @UseIsInEffect = 1 , @SlotNumber = @SlotNumber , @DBQueueCurrentExtern27 = @DBQueueCurrent if @CountDeltaOrigin > 0 begin exec QBM_PMNTableOriginUpdate 'BaseTreeHasTSBAccountDef', 'UID_Org', 'uid_TSBAccountDef' end if @CountDeltaQantity28 > 0 begin exec QER_PMNTableAddViewProperties 'BaseTreeHasTSBAccountDef' exec QBM_PMNTableInsert 'BaseTreeHasTSBAccountDef', 'UID_Org', 'uid_TSBAccountDef'29, @TargetIsView = 1 , @FKTableNameElement = 'BaseTree' , @FKColumnNameElement = 'UID_Org' end END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR30 ('', 18, 1) WITH NOWAIT END CATCH endLabel: end 31