SQLFreeHandle - Free a handle

Purpose

SQLFreeHandle() invalidates and frees a handle.

Syntax

SQLRETURN SQLFreeHandle (SQLSMALLINT htype,
                        SQLINTEGER handle);

Function arguments

Table 1. SQLFreeHandle arguments
Data type Argument Use Description
SQLINTEGER handle Input The handle to be freed.
SQLSMALLINT hType Input Handle type that must be SQL_HANDLE_ENV, SQL_HANDLE_DBC, SQL_HANDLE_STMT, or SQL_HANDLE_DESC.

Usage

SQLFreeHandle() combines the function of SQLFreeEnv(), SQLFreeConnect(), and SQLFreeStmt().

Return codes

Diagnostics

Table 2. SQLFreeHandle SQLSTATEs
SQLSTATE Description Explanation
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.
HY010 Function sequence error There is an hdbc which is in allocated or connected state. Call SQLDisconnect and SQLFreeConnect for the hdbc before calling SQLFreeHandle.
HY013 * Memory management problem The driver is unable to access memory required to support the processing or completion of the function.

References