KI_ALLOC_HANDLE
Argument | Enumeration | Purpose |
---|---|---|
handle | Handle | |
connection | Current database connection | |
newhand | New handle | |
status | KDB_ERROR_ENUM | Return status |
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