You can call the mysql_stmt_close() function to close a prepared statement.
Syntax
my_bool
mysql_stmt_close(MYSQL_STMT *stmt)
Return values
0 is returned for an execution success, and a non-zero value is returned if an error occurred.
Errors
CR_SERVER_GONE_ERROR: The connection to the OBServer was disconnected.CR_UNKNOWN_ERROR: An unknown error occurred.
Notes
mysql_stmt_close() deallocates the statement handler to which stmt points. At that point in time, the handler 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 will cancel them so that the next query can be executed.