KI_ALLOC_HANDLE

Allocate memory for a rowset handle

Synopsis:
CALL KI_ALLOC_HANDLE handle, connection TO newhand, status
status = 'ki_alloc_handle( handle, connection, newhand )
ArgumentEnumerationPurpose
handleHandle
connectionCurrent database connection
newhandNew handle
statusKDB_ERROR_ENUMReturn status
>KI_ALLOC_HANDLE

KI_ALLOC_HANDLE

This must be called to allocate a rowset handle for use in opening a table or issuing a query. As of KCML 6.20 handle numbers are non-zero, postive huge numbers which act as opaque tokens. They can be converted into the small integers in the range 1 to _KDB_MAX_HANDLES that were returned by previous version of KCML by using KI_INFO as shown below. How the handle is allocated depends on the supplied handle argument:

Handles allocated with this call should have their resources freed with KI_FREE_HANDLE.

Converting a handle to an integer

To convert the opaque token returned by KI_ALLOC_HANDLE into a small integer compatible with KCMLs prior to version 6.20, use the internal KCML functions 'KCML_DecodeMagicToValue() and 'KCML_DecodeMagicToType() e.g.

	oldValue = 'KCML_DecodeMagicToValue(handle)
	magicType = 'KCML_DecodeMagicToType(handle)
	IF (magicType != _KDB_MAGIC_HANDLE) THEN STOP
History
Introduced in KCML 5.00
See Also:
KI_ADD_TRACKED_LOCK, KI_CLEAR, KI_CLEAR_HANDLES, KI_CLOSE_TABLE, KI_DROP_TRACKED_LOCK, KI_FREE_HANDLE, KI_GET_HANDLE, KI_GET_TRACKED_LOCKS, KI_HANDLE_GET_ATTR, KI_HANDLE_GET_ATTR_STR, KI_HANDLE_SET_ATTR, KI_HANDLE_SET_ATTR_POOL, KI_HANDLE_SET_ATTR_STR
KCML database status codes