KI_DATABASES
| Argument | Enumeration | Purpose |
|---|---|---|
| handle | Handle to virtual result set | |
| status | KDB_ERROR_ENUM | Return status |
KI_DATABASES
This function is used to set up a virtual result set enumerating the available databases for a connection. The handle must have been allocated with a KI_ALLOC_HANDLE and it can be used in subsequent KI_FETCH calls to get the information.
The result set consists of one or more rows matching the KDB_DATABASE record.
For Example:
DIM hdl, rc, kdb_conn
DIM db$_KDB_DATABASE
REM Default KDB connection is 1
kdb_conn = _KDB_DEFAULT_CONNECT
CALL KI_ALLOC_HANDLE _KDB_HANDLE_AUTO, kdb_conn TO hdl, rc
IF (rc == _KE_SUCCESS)
CALL KI_DATABASES hdl TO rc
IF (rc == _KE_SUCCESS)
PRINT "Available databases:"
WHILE TRUE DO
CALL KI_FETCH hdl, SYM(db$) TO rc
IF (rc <> _KE_SUCCESS) THEN BREAK
PRINT FLD(db$.DATABASE_Name$)
WEND
ELSE
PRINT "Failed to enumerate databases, rc = ";rc
END IF
CALL KI_FREE_HANDLE hdl TO rc
ELSE
PRINT "Failed to allocate handle, rc = ";rc
END IF