Previous Topic

Next Topic

Find Table by UID

ctdbFindTableByUID() locates a table in the database given the table UID and retrieves the table name and path. ctdbFindTableByUID() requires a database or a table handle. The following example shows how to implement a table open function using the table UID instead of the table name.

/* open table using UID */
CTDBRET OpenByUID(CTHANDLE hTable, ULONG uid, CTOPEN_MODE OpenMode)
{
   TEXT tblName[MAX_NAME];
   TEXT tblPath[MAX_PATH];
   CTDBRET Retval;

   Retval = ctdbFindTableByUID(hTable, uid, tblName, sizeof(dbName),
            tblPath, sizeof(tblPath));
   if (Retval == CTDBRET_OK)
      Retval = ctdbOpenTable(hTable, tblName, OpenMode);
   return Retval;
}

The code fragment above is provided as example only. ctdbOpenTableByUID() will open a table using the table UID.