DB2 Version 10.1 for Linux, UNIX, and Windows

sqleEndCtx API - Detach from and free the memory associated with an application context

Frees all memory associated with a given context.

Scope

The scope of this API is limited to the immediate process.

Authorization

None

Required connection

None

API include file

sql.h

API and data structure syntax

SQL_API_RC SQL_API_FN
  sqleEndCtx (
        void ** ppCtx,
        sqlint32 lOptions,
        void * reserved,
        struct sqlca * pSqlca);

sqleEndCtx API parameters

ppCtx
Output. A data area in private memory (used for the storage of context information) that is freed.
lOptions
Input. Valid values are:
SQL_CTX_FREE_ONLY
The context memory will be freed only if a prior detach has been done.
Note: pCtx must be a valid context previously allocated by sqleBeginCtx.
SQL_CTX_END_ALL
If necessary, a call to sqleDetachFromCtx will be made before the memory is freed.
Note: A detach will be done even if the context is still in use. If this option is used, the ppCtx parameter can be NULL, but if passed, it must be a valid context previously allocated by sqleBeginCtx. A call to sqleGetCurrentCtx will be made, and the current context freed from there.
reserved
Reserved for future use. Must be set to NULL.
pSqlca
Output. A pointer to the sqlca structure.

Usage notes

If a database connection exists, or the context has been attached by another thread, this call will fail.
Note: If a context calls an API that establishes an instance attachment (for example, db2CfgGet, it is necessary to detach from the instance using sqledtin before calling sqleEndCtx.