[yunqa.de] Re: RecordCount always -1 for SQLite query component

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Thu, 01 Sep 2011 08:59:27 +0200

On 01.09.2011 07:31, Kai Peters wrote:

> is it by design that your query component always returns -1 as record count?

Yes, this is intentional.

TDISQLite3UniDirQuery is a uni-directional dataset. Uni-directional
datasets do not hold records in cache but pull the next record from the
database when requested (by calling TDISQLite3UniDirQuery.Next).

For this reason, TDISQLite3UniDirQuery does not determine the actual
number of rows available. To reflect this,
TDISQLite3UniDirQuery.RecordCount always returns a value of negative one
(-1).

If you must determine the number of records in a table or query, use the
count() SQL function like this:

  select count(*) from tablename;
  select count(*) from tablename where condition;

Note: The uni-directional concept also does not allow
TDISQLite3UniDirQuery to address records by number. As a result,
TDISQLite3UniDirQuery.RecNo always returns -1 as well.

Ralf
_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: