This document describes how to use the ODBC function and SQLFreeStmt.
- This document is written based on ALTIBASE HDB version 6.3.1
- For additional information or updates, please leave a request at http://support.altibase.com/en/ or in a comment section on this page.
The following four options are described.
|SQL_CLOSE||Close the cursor associated with stmt and discard all pending results. The application can reopen this cursor later by executing the SELECT statement again using the same or different variables. If no cursor is open, this option has no effect on the application.|
|SQL_DROP||The resources associated with the input statement handle are dropped and the handle is invalidated. If there is an open cursor, it is closed and all pending results are discarded.|
|SQL_UNBIND||All rows bound by the previous SQLBindCol() call on this statement handle are dropped.|
|SQL_RESET_PARAMS||All parameters set by the previous SQLBindParameter() call on this statement handle are dropped. The association between the application variable or file reference and the SQL statement parameter marker in the statement handle is broken.|
Among these, SQL_CLOSE and SQL_DROP are mainly used.
- SQLFreeStmt(stmt, SQL_DROP):
This means that the resources for the prepared stmt (statement handle) are completely freed.
That is, it only calls when that stmt is not being reused.
- SQLFreeStmt(stmt, SQL_CLOSE):
If all the retrieved data have not been fetched, an error will occur if you execute SQLExecute again without SQLFreeStmt(SQL_CLOSE).
If SQLFreeStmt(stmt, SQL_CLOSE) is used, the existing stmt can be used without doing SQLAllocStmt().