C Examples: DbiOpenTableList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiOpenTableList

Return to chapter overview

Return a string containing all tables meeting the search criteria (in WildCard).

This example uses the following input:
         fDbiOpenTableList(hDb, &hCursor);

DBIResult fDbiOpenTableList(hDBIDb hTmpDb, pCHAR TblList, pCHAR WildCard)

{

   DBIResult      rslt;

   TBLBaseDesc    ListDesc;    // structure to hold information about the table list.

   hDBICur        hCur;

   CHAR           Buffer[DBIMAXTBLNAMELEN + 1];

   UINT16         Count = 1;

   TblList[0] = '\0';

   rslt = Chk(DbiOpenTableList(hTmpDb, FALSE, FALSE, WildCard, &hCur));

   if (rslt != DBIERR_NONE)

      return rslt;

   while ((DbiGetNextRecord(hCur, dbiNOLOCK, (pBYTE)&ListDesc, NULL)) != DBIERR_EOF)

   {

      wsprintf(Buffer, "\r\nTable %d: %s", Count++, ListDesc.szName);

      strcat(TblList, Buffer);

   }

   return rslt;

}