KI_DATABASES

Enumerate available databases

Synopsis:
CALL KI_DATABASES handle TO status
status = 'ki_databases( handle )
ArgumentEnumerationPurpose
handleHandle to virtual result set
statusKDB_ERROR_ENUMReturn status
>KI_DATABASES

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
History
Introduced in KCML 5.00
See Also:
KI_BIND_COL, KI_BIND_PARAM, KI_BOUND_COL, KI_BOUND_PARAM, KI_COLUMNS, KI_DEFAULT_ROW, KI_DESCRIBE_COL, KI_ERROR, KI_ERROR_TEXT, KI_EXECUTE, KI_FETCH, KI_GET_COL_LIST, KI_GET_ERROR_TEXT, KI_PARTITIONS, KI_PREFETCH_ROWS, KI_PREPARE, KI_SESSIONS, KI_SET_COL_LIST, KI_SQL, KI_SQL_XML, KI_TABLES, KI_TABLESPACES
KCML database status codes