SQLFreeStmt
SQLFreeStmt#
SQLFreeStmt stops processing associated with a specific statement, closes any open cursors associated with the statement, discards pending results, or, optionally, frees all resources associated with the statement handle.
Syntax#
SQLRETURN SQLFreeStmt (
SQLHSTMT stmt,
SQLSMALLINT fOption );
Arguments#
Data Type | Argument | In/Output | Description |
---|---|---|---|
SQLHSTMT | stmt | Input | Statement handle |
SQLSMALLINT | fOption | Input | Handle Control Method SQL_CLOSE SQL_DROP SQL_UNBIND SQL_RESET_PARAMS |
Return Values#
SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_INVALID_HANDLE
SQL_ERROR
Description#
Calls SQLFreeStmt() with the one of following options:
SQL_CLOSE#
Closes the cursor related to stmt, and discards all pending results. An application can open this cursor again by executing SELECT statement again using the same or different variables. However, if no cursor is open, this option will not effect for the application.
SQL_DROP#
The resources related to the input statement handle will be released, and the handle will be freed. In case there is an open cursor, the cursor will be closed and all pending results will be deleted.
SQL_UNBIND#
Releases all column buffers bound by SQLBindCol for the given StatementHandle.
SQL_RESET_PARAMS#
Releases all parameter buffers set by SQLBindParameter(). The relation between an application variable or file reference and a SQL statement parameter marker of the statement handle will be released.
Diagnosis#
SQLSTATE | Description | Comments |
---|---|---|
HY000 | General error |
Related Functions#
SQLAllocHandle
SQLFreeHandle
Example#
< Refer to: $ALTIBASE_HOME/sample/SQLCLI/demo_ex1.cpp >
SQLFreeStmt(stmt, SQL_DROP);