Freeing statement resources in CLI applications
After a transaction has completed, end the processing for each statement handle by freeing the resources associated with it.
About this task
- close the open cursor
- unbind the column bindings
- unbind the parameter bindings
- free the statement handle
There are two ways you can free statement resources: using SQLFreeHandle() or SQLFreeStmt().
Before you can free statement resources, you must have initialized your CLI application and allocated a statement handle.
To free statement
resources with SQLFreeHandle(),
call SQLFreeHandle() with
a HandleType of SQL_HANDLE_STMT and the
handle you want to free. This will close any open cursor associated
with this statement handle, unbind column and parameter bindings,
and free the statement handle. This invalidates the statement handle.
You do not need to explicitly carry out each of the four tasks listed
previously.
Procedure
To free statement resources with SQLFreeStmt(), you need to call SQLFreeStmt() for each task (depending on how the application was implemented, all of these tasks may not be necessary):