summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-03-23 11:44:29 +0100
committerSergei Golubchik <serg@mariadb.org>2018-03-23 11:44:29 +0100
commita2e47f8c41e60fb0eeaa01cdd41fc07b9c963768 (patch)
tree1846a0fdfdff14207698f563376afbdae5d33c8c /sql/sql_prepare.cc
parent04921000594dcbdf23340850b9284fd30ccdb0fd (diff)
parentddc5c65333a4add28907ccb82054ecba0ff6b873 (diff)
downloadmariadb-git-a2e47f8c41e60fb0eeaa01cdd41fc07b9c963768.tar.gz
Merge branch '5.5' into 10.0
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 6a0f89aa7b7..18f95490a82 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -3858,6 +3858,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
Statement stmt_backup;
Query_arena *old_stmt_arena;
bool error= TRUE;
+ bool qc_executed= FALSE;
char saved_cur_db_name_buf[SAFE_NAME_LEN+1];
LEX_STRING saved_cur_db_name=
@@ -3980,6 +3981,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd->lex->sql_command= SQLCOM_SELECT;
status_var_increment(thd->status_var.com_stat[SQLCOM_SELECT]);
thd->update_stats();
+ qc_executed= TRUE;
}
}
@@ -4018,7 +4020,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd->set_statement(&stmt_backup);
thd->stmt_arena= old_stmt_arena;
- if (state == Query_arena::STMT_PREPARED)
+ if (state == Query_arena::STMT_PREPARED && !qc_executed)
state= Query_arena::STMT_EXECUTED;
if (error == 0 && this->lex->sql_command == SQLCOM_CALL)