MySQL 8.4 C API Developer Guide
bool mysql_stmt_close(MYSQL_STMT *stmt)
Closes the prepared statement.
mysql_stmt_close()
also
deallocates the statement handler pointed to by
stmt
, which at that point becomes invalid
and should no longer be used. For a failed
mysql_stmt_close()
call, do
not call mysql_stmt_error()
,
or mysql_stmt_errno()
, or
mysql_stmt_sqlstate()
to
obtain error information because
mysql_stmt_close()
makes the
statement handler invalid. Call
mysql_error()
,
mysql_errno()
, or
mysql_sqlstate()
instead.
If the current statement has pending or unread results, this function cancels them so that the next query can be executed.
The MySQL server has gone away.
An unknown error occurred.
See the Example in Section 6.4.11, “mysql_stmt_execute()”.