IBM Books

Administrative API Reference

sqleEndCtx - Detach and Destroy 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

Version

sql.h

C API Syntax



int sqleEndCtx (
void           **ppCtx,
long           lOptions,
void           *reserved,
struct sqlca   *pstSqlca);

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 - Create and Attach to an Application Context.

SQL_CTX_END_ALL
If necessary, a call to sqleDetachFromCtx - Detach From Context 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 - Create and Attach to an Application Context. A call to sqleGetCurrentCtx - Get Current Context will be made, and the current context freed from there.

reserved
Reserved for future use. Must be set to NULL.

pstSqlca
Output. A pointer to the sqlca structure. For more information about this structure, see SQLCA.

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, sqlfxdb - Get Database Configuration), it is necessary to detach from the instance using sqledtin - Detach before calling sqleEndCtx.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]