<< Click to Display Table of Contents >>
C Examples: DbiGetRecordCount
Example 1: Get the record count for the specified table
This example uses the following input:
fDbiGetRecordCount1(hCursor, &RecCount);
DBIResult fDbiGetRecordCount1(hDBICur hTmpCur, pUINT32 piRecCount)
{
DBIResult rslt;
rslt = Chk(DbiGetRecordCount(hTmpCur, piRecCount));
return rslt;
}
Example 2 (for local tables only): Get the amount of records after the current location of the cursor.
This example uses the following input:
fDbiGetRecordCount2(hCursor, &RecLeft);
DBIResult fDbiGetRecordCount2(hDBICur hTmpCur, pUINT32 piRecLeft)
{
DBIResult rslt;
UINT32 RecNum, CurrRec;
CURProps Props;
RECProps RecProps;
rslt = Chk(DbiGetRecordCount(hTmpCur, &RecNum));
if (rslt != DBIERR_NONE)
return rslt;
if (piRecLeft != NULL)
{
rslt = Chk(DbiGetCursorProps(hTmpCur, &Props));
if (rslt != DBIERR_NONE)
return rslt;
if (strcmp(Props.szTableType, szPARADOX) == 0)
{
rslt = Chk(DbiGetSeqNo(hTmpCur, &CurrRec));
if (rslt != DBIERR_NONE)
return rslt;
}
else
{
if (strcmp(Props.szTableType, szDBASE) == 0)
{
rslt = Chk(DbiGetRecord(hTmpCur, dbiNOLOCK, NULL, &RecProps));
if (rslt != DBIERR_NONE)
return rslt;
CurrRec = RecProps.iPhyRecNum;
}
else
return DBIERR_NA;
}
*piRecLeft = RecNum - CurrRec;
}
return rslt;
}