Board index » off-topic » Counting record with BDE and Paradox

Counting record with BDE and Paradox


2005-01-20 03:17:52 AM
off-topic8
Environment: BDE 5.11, with Paradox database (level 5 table);
C++ language; idapi.h and idapi.lib ver 3.0.
Is there a way to know whether DbiGetRecordCount can return the
exact number of records associated with a cursor? For instance,
if we have a query with a simple WHERE clause on an indexed
field, DbiGetRecordCount gives the exact number of records
associated with the cursor. But if the field is not indexed, or
if the WHERE uses boolean operators, DbiGetRecordCount return an
approximate count, that is the number of record in the table.
We can call DbiGetExactRecordCount, but this function can be
very expensive, as it really counts every records associated
with the cursor, and doesn’t make use of the indexes to retrieve
the record count (it can be very expensive on a table with
hundreds of thousands of records). So, it seems to me there
should be a way to know in advance if DbiGetRecordCount can
return the exact value (a property of the cursor?), or at least
a way to know if the returned count is exact or approximat
(error code??). This way, we could call DbiGetExactRecordCount
only when really needed.
Thank you very much for any suggestion.
 
 

Re:Counting record with BDE and Paradox

tquery.recordcount is not enough ?
use select count(*) from (sql statement)
ask for fields[0].
JM
"Copras" < XXXX@XXXXX.COM >a écrit dans le message de
Environment: BDE 5.11, with Paradox database (level 5 table);
C++ language; idapi.h and idapi.lib ver 3.0.
Is there a way to know whether DbiGetRecordCount can return the
exact number of records associated with a cursor? For instance,
if we have a query with a simple WHERE clause on an indexed
field, DbiGetRecordCount gives the exact number of records
associated with the cursor. But if the field is not indexed, or
if the WHERE uses boolean operators, DbiGetRecordCount return an
approximate count, that is the number of record in the table.
We can call DbiGetExactRecordCount, but this function can be
very expensive, as it really counts every records associated
with the cursor, and doesn't make use of the indexes to retrieve
the record count (it can be very expensive on a table with
hundreds of thousands of records). So, it seems to me there
should be a way to know in advance if DbiGetRecordCount can
return the exact value (a property of the cursor?), or at least
a way to know if the returned count is exact or approximat
(error code??). This way, we could call DbiGetExactRecordCount
only when really needed.
Thank you very much for any suggestion.