Procedure will try to determine if the target procedure is a MOCK procedure, will restore the code of the original stored procedure and will delete the MOCK and all of its traces from related tables. 

Note: 

  • The code of a STUB procedure is not restored because stub does not replace the code, insteat it creates a copy of the procedure with same signature 

 

Arguments

  • v_PretendObjectName - The name of a mocked procedure This can be fully qualified name with database.schema.object. Parameter type SYSNAME.
  • v_IsPretendObject - OUTPUT parameter, BIT.  "1" if restored object is still a "pretend object", 0 if restored object is the original project

Note: SQL Server only

Examples

SQL Server

       --this example will create teh MOCK object
       --which executes original code
       --for sp_AddNewProduct procedure and select
       --number of products before and after
       EXEC DBTD_CREATE_MOCK_PROCEDURE
            @v_ProcName  = 'sp_AddNewProduct',
            @v_BeforeSQL = 'SELECT COUNT(*) AS [Number Of Products Before]
                            FROM PRODUCTS',
            @v_InsteadOfSQL = '
RUN ORIGINAL CODE',
            @v_AfterSQL  = 'SELECT COUNT(*) AS [Number Of Products After]
                            FROM PRODUCTS'

       --this example will create MOCK object that does not
       --call any of the original
       --functionality from sp_AddNewProduct
       EXEC DBTD_CREATE_MOCK_PROCEDURE
            @v_ProcName  = 'sp_AddNewProduct',
            @v_BeforeSQL = NULL,
            @v_InsteadOfSQL = NULL
,
            @v_AfterSQL  = NULL

             
       DECLARE 
@v_IsPretendObject BIT
      EXEC DBTD_RESTORE_ORIGINAL_PROC
           @v_PretendObjectName = 'sp_AddNewProduct',
           @v_IsPretendObject = @v_IsPretendObject OUTPUT

 

See Also