Back to OIM Explorer

dbo.QBM_ZPrePropSheet

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 2.665 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_FGIPrepropConditionDeactiv source text reference
  • references source dbo.QBM_FGISessionContext source text reference
  • references source dbo.QBM_PDBQueueInsert_WaitForComp source text reference
  • references source dbo.QBM_PSessionContextSet source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL119 lines
1CREATE PROCEDURE QBM_ZPrePropSheet(2  @SlotNumber int3)4AS5BEGIN6  DECLARE @CountItems int7  DECLARE @GenProcID varchar(38)8  DECLARE @GenProcID_R varchar(38) = dbo.QBM_FGISessionContext('')9  DECLARE @DBQueueCurrent QBM_YDBQueueCurrent10  BEGIN TRY11    INSERT INTO @DBQueueCurrent(UID_DialogDBQueue,12    UID_Parameter,13    UID_SubParameter,14    GenProcID)15    SELECT16      UID_DialogDBQueue,17      UID_Parameter,18      UID_SubParameter,19      GenProcID20    FROM QBMDBQueueCurrent cu21      WITH(readpast)22    WHERE23      cu.SlotNumber = @SlotNumber24    IF @@rowcount = 025    BEGIN26      GOTO EndLabel27    END28    SELECT @GenProcID = max(GenProcID)29    FROM @DBQueueCurrent30    WHERE31      GenProcID > ' '32    IF isnull(@Genprocid,33    '') = ''34    BEGIN35      SELECT @GenProcID = newid()36    END37    DECLARE @PrePropHelper QBM_YPrepropHelper38    INSERT INTO @PrePropHelper(uid_parameter,39    isDeactivatedPrior,40    IsDeactivated,41    GenProcID,42    PreProcessorCondition,43    IsDeactivatedOld)44    SELECT45      x.uid_parameter,46      1,47      1,48      x.GenProcID,49      isnull(os.PreProcessorCondition,50      N ''),51      os.isDeactivatedByPreProcessor52    FROM @DBQueueCurrent x53    JOIN dialogSheet os54      ON x.uid_parameter = os.uid_dialogSheet55    UPDATE @PrePropHelper56    SET isDeactivatedPrior = 0,57    IsDeactivated = 058    FROM @PrePropHelper h59    WHERE60      EXISTS(61    SELECT TOP 1 162    FROM QBMTreeHasSheet ths63    JOIN QBMTree t64      ON ths.uid_QBMTree = t.uid_QBMTree AND t.isDeactivatedByPreProcessor = 065    WHERE66      ths.uid_DialogSheet = h.uid_parameter) OR EXISTS(67    SELECT TOP 1 168    FROM QBMTreeResultHasSheet ths69    JOIN QBMTreeResult t70      ON ths.uid_QBMTreeResult = t.uid_QBMTreeResult AND t.isDeactivatedByPreProcessor = 071    WHERE72      ths.uid_DialogSheet = h.uid_parameter)73    UPDATE @PrePropHelper74    SET isDeactivatedPrior = 0,75    IsDeactivated = 076    FROM @PrePropHelper h77    WHERE78      EXISTS(79    SELECT TOP 1 180    FROM DialogObjectHasSheet ohs81    JOIN DialogObject o82      ON ohs.UId_dialogObject = o.uid_dialogObject AND o.isDeactivatedByPreProcessor = 083    WHERE84      ohs.uid_DialogSheet = h.uid_parameter)85    UPDATE @PrePropHelper86    SET IsDeactivated = dbo.QBM_FGIPrepropConditionDeactiv(h.PreProcessorCondition)87    FROM @PrePropHelper h88    WHERE89      h.PreProcessorCondition > ' ' AND h.IsDeactivated = 090    EXEC QBM_PSessionContextSet 'GenProcID',91      @GenProcID92    UPDATE DialogSheet93    SET IsDeactivatedByPreProcessor = x.isDeactivated,94    xdateupdated = GetUTCDate(),95    xuserupdated = 'DBScheduler'96    FROM DialogSheet r97    JOIN @PrePropHelper x98      ON r.UID_DialogSheet = x.uid_parameter99    WHERE100      r.IsDeactivatedByPreProcessor <> x.IsDeactivated101    SELECT @CountItems = @@rowcount102    IF @CountItems > 0103    BEGIN104      EXEC QBM_PDBQueueInsert_WaitForComp 'Sheet',105        @GenProcID106    END107  END TRY108  BEGIN CATCH109    EXEC QBM_PSessionErrorAdd DEFAULT110    RAISERROR('',111    18,112    1)113      WITH NOWAIT114  END CATCH115  endLabel:116  EXEC QBM_PSessionContextSet 'GenProcID',117    @GenProcID_R118  RETURN119END
Open raw exported source
SQL ยท Raw19 lines
1   create   procedure QBM_ZPrePropSheet (@SlotNumber int) as begin   declare @CountItems int  declare @GenProcID varchar(38) declare @GenProcID_R2 varchar(38) = dbo.QBM_FGISessionContext('') declare @DBQueueCurrent QBM_YDBQueueCurrent BEGIN TRY insert into @DBQueueCurrent(UID_DialogDBQueue, UID_Parameter3, UID_SubParameter, GenProcID) select UID_DialogDBQueue, UID_Parameter, UID_SubParameter, GenProcID from QBMDBQueueCurrent cu with (readpast) where cu.SlotNumber4 = @SlotNumber if @@rowcount = 0 begin goto EndLabel end select @GenProcID = max(GenProcID) from @DBQueueCurrent where GenProcID > ' ' if isnull(@Genprocid5, '') = '' begin select @GenProcID = newid() end declare @PrePropHelper QBM_YPrepropHelper insert into @PrePropHelper (uid_parameter , isDeactivatedPrior6 , IsDeactivated , GenProcID , PreProcessorCondition, IsDeactivatedOld)  select x.uid_parameter,  1,  1, x.GenProcID, isnull(os.PreProcessorCondition,N''7), os.isDeactivatedByPreProcessor from @DBQueueCurrent x join dialogSheet os on x.uid_parameter = os.uid_dialogSheet  update @PrePropHelper set isDeactivatedPrior8 = 0, IsDeactivated = 0 from @PrePropHelper h where exists (select top 1 1 from QBMTreeHasSheet ths join QBMTree t on ths.uid_QBMTree = t.uid_QBMTree and9 t.isDeactivatedByPreProcessor = 0 where ths.uid_DialogSheet = h.uid_parameter ) or exists (select top 1 1 from QBMTreeResultHasSheet ths join QBMTreeResult10 t on ths.uid_QBMTreeResult = t.uid_QBMTreeResult and t.isDeactivatedByPreProcessor = 0 where ths.uid_DialogSheet = h.uid_parameter ) update @PrePropHelper11 set isDeactivatedPrior = 0, IsDeactivated = 0 from @PrePropHelper h where exists (select top 1 1 from DialogObjectHasSheet ohs join DialogObject o on 12ohs.UId_dialogObject = o.uid_dialogObject and o.isDeactivatedByPreProcessor = 0 where ohs.uid_DialogSheet = h.uid_parameter )  update @PrePropHelper set13 IsDeactivated = dbo.QBM_FGIPrepropConditionDeactiv(h.PreProcessorCondition) from @PrePropHelper h where h.PreProcessorCondition > ' ' and h.IsDeactivated14 = 0    exec QBM_PSessionContextSet 'GenProcID', @GenProcID update DialogSheet set IsDeactivatedByPreProcessor = x.isDeactivated, xdateupdated = GetUTCDate15(), xuserupdated = 'DBScheduler'  from DialogSheet r join @PrePropHelper x on r.UID_DialogSheet = x.uid_parameter where r.IsDeactivatedByPreProcessor <>16 x.IsDeactivated select @CountItems = @@rowcount  if @CountItems > 0 begin   exec QBM_PDBQueueInsert_WaitForComp 'Sheet', @GenProcID  end  END TRY BEGIN17 CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH  endLabel: exec QBM_PSessionContextSet 'GenProcID', @GenProcID_R return18 end 19