Hitachi

Hitachi Advanced Database Application Development Guide


16.11.1 SQLFreeStmt

Organization of this subsection

(1) Function

This ODBC function performs on the specified statement the processing specified by an option. It stops the processing associated with the statement, closes cursors, discards unprocessed results, and releases all resources associated with the statement handle.

(2) Format

SQLRETURN SQLFreeStmt
(
  SQLHSTMT       StatementHandle,       /* In */
  SQLUSMALLINT   Option                 /* In */
)

(3) Arguments

StatementHandle

Specifies a statement handle.

Specify a value that was output by *OutputHandlePtr of SQLAllocHandle before this function is executed.

Option

Specifies one of the following options:

Option

Description

SQL_CLOSE

Closes the cursor managed by StatementHandle. The processing is the same as is performed by SQLCloseCursor, but with this function no error occurs if no cursor is open. The function terminates with SQL_SUCCESS.

SQL_UNBIND

Sets the SQL_DESC_COUNT field of the ARD to 0 and releases all columns bound by SQLBindCol for StatementHandle.

SQL_RESET_PARAMS

Sets the SQL_DESC_COUNT field of the APD to 0 and releases all parameters bound by SQLBindParameter for StatementHandle.

(4) Return value

This ODBC function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

(5) SQLSTATE

This ODBC function returns one of the following SQLSTATE values:

SQLSTATE

Description

Remarks

Returned

01000

General warning

--

N

24000

Invalid cursor status

Y

HY000

General error

N

HY001

Memory allocation error

N

HY010

Function sequence error

Before this function was executed, SQLExecute, SQLExecDirect, SQLExecDirectW, or SQLParamData was called for StatementHandle and returned SQL_NEED_DATA. Since then, the setting of runtime data parameters or runtime data columns has not been completed.

Y

HY013

Memory management error

--

N

HY092

Invalid attribute or option identifier

SQL_DROP or an invalid identifier was specified in Option.

Y

HYT01

Connection timeout expired

--

N

IM001

Driver does not support this function

N

Legend:

Y: This SQLSTATE might be returned by the HADB ODBC driver.

N: This SQLSTATE is not returned by the HADB ODBC driver.

--: None

(6) Notes

This function does not support SQL_DROP in Option. Use SQLFreeHandle to release the statement handle.

SQL_UNBIND and SQL_RESET_PARAMS in Option only perform unbind operations; they do not release memory. Therefore, use the application program to release the memory area for data that was passed to the HADB ODBC driver by SQLBindCol and SQLBindParameter.