Back to OIM Explorer

dbo.QBM_PTransactionLevelCheck

Stored ProcedureSQL_STORED_PROCEDURESandbox DB

Stored Procedure.

Source: sandbox-db sys.sql_modules

Source size: 1.240 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_FGISessionErrorIsMissingCo source text reference
  • references source dbo.QBM_FGISessionErrorRethrow source text reference
  • references source dbo.QBM_PJournal source text reference
  • references source dbo.QBM_PSessionErrorAdd source text reference

Complete Source

SQL62 lines
1CREATE PROCEDURE QBM_PTransactionLevelCheck(2  @ExpectedLevel int,3  @SourceProcedure int = 0,4  @DebugComment nvarchar(1000) = N ''5)6AS7BEGIN8  DECLARE @Message nvarchar(1000)9  DECLARE @procname nvarchar(256)10  DECLARE @DebugLevel char(1) = 'W'11  SET XACT_ABORT OFF12  BEGIN TRY13    IF @@TRANCOUNT = ISNULL(@ExpectedLevel,14    0)15    BEGIN16      EXEC QBM_PJournal 'Level OK',17        @@PROCID,18      'I',19        @DebugLevel20      GOTO endLabel21    END22    IF @SourceProcedure = 023    BEGIN24      SELECT @Procname = object_name(@@procid)25    END26    ELSE27    BEGIN28      SELECT @Procname = object_name(@SourceProcedure)29    END30    SELECT31      @Message = '#LDS#Expected transaction count {0} does not match existing {1}, called from {2}.|' + str(isnull(@ExpectedLevel,32      0)) + '|' + str(@@TRANCOUNT) + '|' + @Procname + '|'33    IF @DebugComment > ' '34    BEGIN35      SELECT36        @Message = @Message + ', ' + @DebugComment37    END38    SELECT @Message = @Message + ')' ROLLBACK TRANSACTION39    EXEC QBM_PJournal @Message,40      @@PROCID,41    'E',42      @DebugLevel43    RAISERROR(@Message,44    18,45    1)46      WITH nowait47  END TRY48  BEGIN CATCH49    EXEC QBM_PSessionErrorAdd DEFAULT50    IF dbo.QBM_FGIsessionErrorIsMissingCO(DEFAULT) = 051    BEGIN52      ROLLBACK TRANSACTION53      DECLARE @Rethrow varchar(1000) = dbo.QBM_FGISessionErrorRethrow()54      RAISERROR(@Rethrow,55      18,56      1)57        WITH NOWAIT58    END59  END CATCH60  endLabel:61  RETURN62END
Open raw exported source
SQL ยท Raw9 lines
1  create   procedure QBM_PTransactionLevelCheck (@ExpectedLevel int , @SourceProcedure int = 0 , @DebugComment nvarchar(1000) = N'' ) as begin declare2 @Message nvarchar(1000) declare @procname nvarchar(256) declare @DebugLevel char(1) = 'W' SET XACT_ABORT OFF BEGIN TRY if @@TRANCOUNT = ISNULL(@ExpectedLevel3, 0) begin exec QBM_PJournal 'Level OK', @@PROCID, 'I', @DebugLevel goto endLabel end if @SourceProcedure = 0 begin select @Procname = object_name(@@procid4) end else begin select @Procname = object_name(@SourceProcedure) end  select @Message = '#LDS#Expected transaction count {0} does not match existing {1}, called from {2}.|'5 + str(isnull(@ExpectedLevel, 0)) + '|' + str( @@TRANCOUNT) + '|' + @Procname + '|' if @DebugComment > ' ' begin select @Message = @Message + ', ' + @DebugComment6 end select @Message = @Message + ')' rollback transaction exec QBM_PJournal @Message, @@PROCID, 'E', @DebugLevel raiserror (@Message, 18, 1) with nowait7 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default if dbo.QBM_FGIsessionErrorIsMissingCO(default)= 0 begin rollback transaction declare @Rethrow varchar8(1000) = dbo.QBM_FGISessionErrorRethrow() RAISERROR (@Rethrow, 18, 1) WITH NOWAIT end END CATCH endLabel: return end 9