• Kristofer Pettersson's avatar
    Bug#44521 Executing a stored procedure as a prepared statement can sometimes cause · fc1acef6
    Kristofer Pettersson authored
              an assertion in a debug build.
    
    The reason is that the C API doesn't support multiple result sets for prepared
    statements and attempting to execute a stored routine which returns multiple result
    sets sometimes lead to a network error. The network error sets the diagnostic area
    prematurely which later leads to the assert when an attempt is made to set a second
    server state.
    
    This patch fixes the issue by changing the scope of the error code returned by
    sp_instr_stmt::execute() to include any error which happened during the execution.
    To assure that Diagnostic_area::is_sent really mean that the message was sent all
    network related functions are checked for return status.
    
    libmysqld/lib_sql.cc:
      * Changed prototype to return success/failure status on net_send_error_packet(),
        net_send_ok(), net_send_eof(), write_eof_packet().
    mysql-test/r/sp_notembedded.result:
      * Added test case for bug 44521
    mysql-test/t/sp_notembedded.test:
      * Added test case for bug 44521
    sql/protocol.cc:
      * Changed prototype to return success/failure status on net_send_error_packet(),
        net_send_ok(), net_send_eof(), write_eof_packet().
    sql/protocol.h:
      * Changed prototype to return success/failure status on net_send_error_packet(),
        net_send_ok(), net_send_eof(), write_eof_packet().
    sql/sp_head.cc:
      * Changed prototype to return success/failure status on net_send_error_packet(),
        net_send_ok(), net_send_eof(), write_eof_packet().
    fc1acef6
sp_notembedded.result 6.57 KB