Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbFirstDatabase

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

Declaration

CTDBRET ctdbFirstDatabase(CTHANDLE Handle, pTEXT Name,

VRLEN NameSize, pTEXT Path, VRLEN PathSize)

Description

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.

Returns

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.

Example


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))

== CTDBRET_OK );


See also

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

TOCIndex