C Examples: DbiOpenVchkList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiOpenVchkList

Return to chapter overview

Get validity check information for the specified table.

VchkList must be allocated large enough to hold security information. This example uses the following input:
         fDbiOpenVchkList(hDb, "ORDERS.DB", ValidityChecks);

DBIResult fDbiOpenVchkList(hDBIDb hTmpDb, pCHAR TblName, pCHAR VchkList)

{

   DBIResult      rslt;

   hDBICur        hVchkCur = 0;

   VCHKDesc       Vchk;

   CHAR           Buffer[200], Required[4];

   VchkList[0] = '\0';

   rslt = Chk(DbiOpenVchkList(hTmpDb, TblName, NULL, &hVchkCur));

   if (rslt == DBIERR_NONE)

   {

      while (DbiGetNextRecord(hVchkCur, dbiNOLOCK, (pBYTE)&Vchk, NULL) == DBIERR_NONE)

      {

         if (Vchk.bRequired == FALSE)

            strcpy(Required, "False");

         else

            strcpy(Required, "True");

         wsprintf(Buffer, "\r\nField Number: %d, Required: %s", Vchk.iFldNum, Required);

         strcat(VchkList, Buffer);

      }

   }

   if (hVchkCur != 0)

      DbiCloseCursor(&hVchkCur);

   return rslt;

}