Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic


Get the name and path of the first database in a session dictionary.


CTDBRET ctdbFirstDatabase(CTHANDLE Handle, pTEXT Name,

VRLEN NameSize, pTEXT Path, VRLEN PathSize)


ctdbFirstDatabase() gets the name and path of the first database in the specified session dictionary.

  • Handle [in] the a session handle.
  • Name [out] receives the database name.
  • NameSize [in] the name size in bytes. If Name is not large enough to receive the database name, ctdbFirstDatabase() will return CTDBRET_ARGSMALL (4006).
  • Path [out] receives the database path, if the name is located and it is large enough to hold the path, and is returned by the function ctdbFirstDatabase().
  • PathSize [in] the path size in bytes. If Path is not large enough to receive the database path, ctdbFirstDatabase() will return CTDBRET_ARGSMALL (4006).

ctdbFirstDatabase(), in conjunction with ctdbNextDatabase(), may be used to obtain the names and paths of all Databases in this session dictionary. ctdbGetDatabaseCount() may be used to retrieve the total number of databases in the session dictionary.


ctdbFirstDatabase() returns CTDBRET_OK on success, or INOT_ERR (101) if there are no databases in the session dictionary, or a c-tree error code on failure.


ctdbFirstDatabase(hSession, name, sizeof(name), path, sizeof(path));

do {

printf("\n\nDatabase: %s (%s)\n", path, name);


while (

ctdbNextDatabase(hSession, name, sizeof(name), path, sizeof(path))


See also

ctdbNextDatabase(), ctdbGetDatabaseCount(), ctdbFindDatabase(), ctdbFirstTable()