summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-03-25 13:02:52 +0200
committerSergei Golubchik <serg@mariadb.org>2018-03-25 13:02:52 +0200
commitc764bc0a78e9359fa208e074bd327f7a852c7cb7 (patch)
treeeeb5d56d225d1fdf97a016c3eae7b93c4e1f6927 /sql/sql_prepare.cc
parentd702e463902bca7d94ff8a1a49468a5b7bdb4ba0 (diff)
parent15795b9f9a850d9587f17ef18e1ac7b5af31ec1e (diff)
downloadmariadb-git-c764bc0a78e9359fa208e074bd327f7a852c7cb7.tar.gz
Merge branch '10.1' into 10.2
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 3e1dcc22acd..ee92df7c6b8 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -4657,6 +4657,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=
@@ -4779,6 +4780,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;
}
}
@@ -4817,7 +4819,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)