SQLFreeStmt() is called after executing an SQL statement and processing the results.
SQLRETURN SQLFreeStmt (SQLHSTMT hstmt, SQLSMALLINT fOption);
Data type | Argument | Use | Description |
---|---|---|---|
SQLHSTMT | hstmt | Input | Statement handle |
SQLSMALLINT | fOption | Input | Option specifying the manner of freeing the
statement handle. The option must have one of the following values:
|
The cursor (if any) associated with the statement handle (hstmt) is closed and all pending results are discarded. The application can reopen the cursor by calling SQLExecute() with the same or different values in the application variables (if any) that are bound to hstmt. The cursor name is retained until the statement handle is dropped or the next successful SQLSetCursorName() call. If no cursor has been associated with the statement handle, this option has no effect (no warning or error is generated).
DB2 UDB CLI resources associated with the input statement handle are freed, and the handle is invalidated. The open cursor, if any, is closed and all pending results are discarded.
All the columns bound by previous SQLBindCol() calls on this statement handle are released (the association between application variables or file references and result set columns is broken).
All the parameters set by previous SQLBindParam() calls on this statement handle are released. The association between application variables or file references and parameter markers in the SQL statement of the statement handle is broken.
SQL_SUCCESS_WITH_INFO is not returned if fOption is set to SQL_DROP, because there is no statement handle to use when SQLError() is called.
SQLSTATE | Description | Explanation |
---|---|---|
40003 * | Statement completion unknown | The communication link between the CLI and the data source fails before the function completes processing. |
58004 | System error | Unrecoverable system error. |
HY001 | Memory allocation failure | The driver is unable to allocate memory required to support the processing or completion of the function. |
HY009 | Argument value that is not valid | The value specified for the argument fOption is not SQL_CLOSE, SQL_DROP, SQL_UNBIND, or SQL_RESET_PARAMS. |
HY021 | Internal descriptor that is not valid | The internal descriptor cannot be addressed or allocated, or it contains a value that is not valid. |
Refer to the SQLFetch() rzadpfnfetch.htm#rzadpfnfetch__xmfetch.