[yunqa.de] Re: DISQLite3UniDirQuery RecordCount

  • From: Skylogdev@xxxxxxx
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 2 Sep 2009 13:12:00 EDT

Hi Ralf,
 
No, I was using:
 
 DISQLite3UniDirQuery1.SelectSQL:= 'Select * FROM  DH';
DISQLite3UniDirQuery1.Active:=  true;
recCount:=  0;
while not  DISQLite3UniDirQuery1.EOF do  begin
Inc(RecCount); 
              DISQLite3UniDirQuery1.Next;
end;
 
Regards...Andrew
Skylog Development
_www.skylog.co.uk_ (http://www.skylogservices.co.uk/) 

Important Note on Backups:


Please ensure  you have read and complied with the guidance on backing up 
your Skylog data  detailed in Help for Backup/Restore or FAQ 2 at:

_http://www.skylogservices.co.uk/spages/faqs.htm#Faq2_ 
(http://www.skylogservices.co.uk/spages/faqs.htm#Faq7) 



In a message dated 02/09/2009 15:06:25 GMT Standard Time, delphi@xxxxxxxx  
writes:

I  suppose you are counting the number of rows returned by the  query

select count(*) from t;

Since this is an aggregate  query it will always return one record even if 
table t is empty. This single  record holds the count of record count for 
table t.

Hence do not count  the records returned by the aggregate query but read 
the integer value to  determine the record count of the table in question. 
Here is the  code:

RecCount := Query.Fields[0].AsInteger;

If I point  the example project from my previous to your database and 
change the SQL to  replace table "t" with "dh", it returns the expected  
results.



Other related posts: