C Examples: DbiOpenLockList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiOpenLockList

Return to chapter overview

Retrieve all users on a particular table:  

Note: pLockInfo must be large enough to hold data. This example using the following input:
         char    Buffer[500];
         fDbiOpenLockList(hCur, Buffer);

 

DBIResult fDbiOpenLockList(hDBICur hTmpCur, pCHAR pLockInfo)

{

   DBIResult   rslt;

   LOCKDesc    LDesc;

   hDBICur     hLockCur = 0;

 

   strcpy(pLockInfo, "\0");

   rslt = Chk(DbiOpenLockList(hTmpCur, TRUE, TRUE, &hLockCur));

   if (rslt != DBIERR_NONE)

      return rslt;

   while (rslt == DBIERR_NONE)

   {

      rslt = DbiGetNextRecord(hLockCur, dbiNOLOCK, (pBYTE)&LDesc, NULL);

      if (rslt == DBIERR_NONE)

         wsprintf(pLockInfo, "%s\r\nUSER: %s", pLockInfo, LDesc.szUserName);

   }

   if (rslt == DBIERR_EOF)

     rslt = DBIERR_NONE;

   else

     Chk(rslt);

   return rslt;

}