Page 1 of 1

dbForge MySQL 2020 Bug - Execute in IDE requiring debugger

Posted: Fri 01 May 2020 17:00
by Requnix
Version: 9.0.285

So I was trying to solve a reported error in a Stored Procedure and was receiving very strange results; the EXCEPTION details never lined up even when I did an EXECUTE (without debug). So I deleted the cr_debug database and tried to simply EXECUTE the stored procedure, and received the below error:

Code: Select all

FUNCTION cr_debug.ENTER_MODULE2 does not exist.
I then went into MySQL Workbench and attempted to execute the Stored Procedure, but received the same error, so dbForge is doing something to the root procedures to connect them to the debug system.

I then went back to dbForge and recompiled the stored procedure (not for debug, but just compile) and everything worked just fine.

So the core issue is the debug compiled version of the stored procedure was returning incorrect SQLEXCEPTION error information; it seems the debug compile is interfering with that - which is a big problem. Note the below is the exception handling code:

Code: Select all

    -- == [ERROR HANDLING] ========================================
    DECLARE EXIT HANDLER FOR SQLEXCEPTION
    BEGIN
        GET DIAGNOSTICS @sp_error_count = NUMBER;
        GET DIAGNOSTICS CONDITION @sp_error_count @sp_error_state = RETURNED_SQLSTATE, 
            @sp_error_number = MYSQL_ERRNO, @sp_error_message = MESSAGE_TEXT;
        SELECT @sp_error_count;
        ROLLBACK; SET out_result = FALSE;
        CALL internal_error_handler(JSON_OBJECT('source','SQL','type','exit','location',debug_location), 
            NULL, debug_details, out_result_details);
    END;
While I understand compiling a SP for debug does connect to the system, the issue really is the behavior of the SP while under debug compilation and the fact I get different results from the SQLEXCEPTION handler.

Re: dbForge MySQL 2020 Bug - Execute in IDE requiring debugger

Posted: Tue 05 May 2020 09:06
by alexa
That's the way the debugger of dbForge works. It adds debug calls into the original definition of the stored routine upon the 'Compile for Debugging' command and removes it with the 'Compile' one.

Please see the following:
https://www.devart.com/dbforge/mysql/studio/debugging.html
https://www.youtube.com/watch?v=SYAJroU2moU
https://www.youtube.com/watch?v=5FPvydmoGf4