Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbFindDatabaseByUID

Get the name and path of a database by its unique identifier.

Declaration

CTDBRET ctdbFindDatabaseByUID(CTHANDLE Handle, ULONG uid, pTEXT Name,

VRLEN NameSize, pTEXT Path, VRLEN PathSize)

where:

  • Handle [in] - the handle of the session dictionary that will be searched. If you specify a database handle, then the session dictionary which that database is currently connected to will be searched.
  • uid [in] - the unique database identifier, used to locate the database. It is set automatically when the database is created or added to the session dictionary.
  • Name [out] - the string with the database name.
  • NameSize [in] - the size in bytes of Name. If Name is not large enough to receive the database name, ctdbFindDatabaseByUID() will return CTDBRET_ARGSMALL (4006).
  • Path [out] - the database path, if the name is located in the session and Path is large enough to hold the database path. The path includes drive, directory, file name and file extension.
  • PathSize [in] - the size in bytes of Path. If Path is not large enough to receive the database path, ctdbFindDatabaseByUID() will return CTDBRET_ARGSMALL (4006).

Description

ctdbFindDatabaseByUID() retrieves the name and path of any database in a session dictionary by its unique identifier. It is important to remember that the UID of a database is set when the database is created (which automatically adds it to a session dictionary), and when an existing database is added to a session dictionary. Dropping a database from a session dictionary and then adding it again will likely result in the database being assigned a different UID.

Use ctdbFindDatabase() to get the path of a database by name.

Use ctdbGetDatabaseUID() or ctdbGetActiveDatabaseUID() to retrieve the database UID.

Returns

ctdbFindDatabaseByUID() returns CTDBRET_OK on success, or INOT_ERR (101) if the database is not in the session dictionary, or a c-tree error code on failure. Note: If the database is not found in the session dictionary, then the UID must be considered invalid.

See also

ctdbFindDatabase(), ctdbGetDatabaseUID(), ctdbGetActiveDatabaseUID()

TOCIndex