Skip to end of metadata
Go to start of metadata



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 or in a comment section on this page.


SQLFreeStmt options

The following four options are described.

SQL_CLOSEClose 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_DROPThe 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_UNBINDAll rows bound by the previous SQLBindCol() call on this statement handle are dropped.
SQL_RESET_PARAMSAll 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.

  1. 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.
  2. 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().


  • No labels