summaryrefslogtreecommitdiff
path: root/libmysql/libmysql.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmysql/libmysql.c')
-rw-r--r--libmysql/libmysql.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index a77d1408383..d59ba999ee2 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -5036,6 +5036,12 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
{
DBUG_ENTER("mysql_stmt_reset");
DBUG_ASSERT(stmt != 0);
+ if (!stmt->mysql)
+ {
+ /* mysql can be reset in mysql_close called from mysql_reconnect */
+ set_stmt_error(stmt, CR_SERVER_LOST, unknown_sqlstate);
+ DBUG_RETURN(1);
+ }
/* Reset the client and server sides of the prepared statement */
DBUG_RETURN(reset_stmt_handle(stmt, RESET_SERVER_SIDE | RESET_LONG_DATA));
}