summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2014-04-15 18:17:47 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2014-04-15 18:17:47 +0500
commit708ba733dade0348611269093587e30f4cd64eb7 (patch)
tree8532dc7e983d76a85e6de994230ee7b9f16175e6 /sql/sp_head.cc
parent9d32b8b2aa717441ce22eac27a38192409331eb1 (diff)
downloadmariadb-git-708ba733dade0348611269093587e30f4cd64eb7.tar.gz
MDEV-5138 Numerous test failures in "mtr --ps --embedded".
If a prepared statement calls an stored procedure, the thd->server_status out of the SP goes up to the PS and then to the client. So that the client gets the SERVER_STATUS_CURSOR_EXISTS status if the SP uses a cursor. Which makes the embedded server fail. Fixed by saving/restoring the upper-level server_status in sp_head::execute().
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 99f9b172b16..3272e29389b 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1223,6 +1223,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
LEX *old_lex;
Item_change_list old_change_list;
String old_packet;
+ uint old_server_status;
Reprepare_observer *save_reprepare_observer= thd->m_reprepare_observer;
Object_creation_ctx *saved_creation_ctx;
Warning_info *saved_warning_info;
@@ -1357,6 +1358,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
It is probably safe to use same thd->convert_buff everywhere.
*/
old_packet.swap(thd->packet);
+ old_server_status= thd->server_status;
/*
Switch to per-instruction arena here. We can do it since we cleanup
@@ -1486,6 +1488,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
thd->spcont->pop_all_cursors(); // To avoid memory leaks after an error
/* Restore all saved */
+ thd->server_status= old_server_status;
old_packet.swap(thd->packet);
DBUG_ASSERT(thd->change_list.is_empty());
old_change_list.move_elements_to(&thd->change_list);