summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorKristofer Pettersson <kristofer.pettersson@sun.com>2009-07-29 22:07:08 +0200
committerKristofer Pettersson <kristofer.pettersson@sun.com>2009-07-29 22:07:08 +0200
commitfc1acef6b2b08b13388afd255aa259f6cd5e20e8 (patch)
tree5b1e05b2c4937be9524d4cae2be1ae9517d5be95 /sql/sp_head.cc
parent1df8ad6c1471602abb9e11865ad2ba302a8fca08 (diff)
downloadmariadb-git-fc1acef6b2b08b13388afd255aa259f6cd5e20e8.tar.gz
Bug#44521 Executing a stored procedure as a prepared statement can sometimes cause
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().
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 018937fec2f..0736e5fc2a8 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1248,7 +1248,7 @@ sp_head::execute(THD *thd)
*/
if (thd->prelocked_mode == NON_PRELOCKED)
thd->user_var_events_alloc= thd->mem_root;
-
+
err_status= i->execute(thd, &ip);
if (i->free_list)
@@ -2863,7 +2863,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
if (!thd->is_error())
thd->main_da.reset_diagnostics_area();
}
- DBUG_RETURN(res);
+ DBUG_RETURN(res || thd->is_error());
}