MySQL, FetchAll=false not working

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
bogdan
Posts: 20
Joined: Mon 13 Apr 2015 17:27

MySQL, FetchAll=false not working

Post by bogdan » Sun 24 May 2015 07:18

Hello,
I got a small situation with the FetchAll option:

...
cnn.SpecificOptions.Add('FetchAll=false');
UniTable1.Connection:=cnn;
UniTable1.FetchRows:=25;
UniTable1.TableName:='myTable';
UniTable1.Active:=true;
showmessage(inttostr(UniTable1.RecordCount)); -->10015 records ?????? (all recs in myTable)
...

Am I missing something? Is there any additional option I should set?
MySQL 5.5.17, XE7, unidac60d21pro
Thank you very much.

stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

Re: MySQL, FetchAll=false not working

Post by stevel » Sun 24 May 2015 17:20

Hi,

I think that RecordCount will always report the complete number of records from the database table regardless of the FetchAll / FetchRows property settings. Those settings only control how many records are pulled from the database to the client application.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: MySQL, FetchAll=false not working

Post by ViktorV » Mon 25 May 2015 08:24

The FetchAll option refers to dataset, not to connection. Therefore, in your sample, the UniTable1.RecordCount property returns the number of all records, but not the number of fetched records, since the FetchAll option of UniTable1.SpecificOptions is set to True. to set the FetchAll option of UniTable1.SpecificOptions to False, please replace the first line in your sample with the following:

Code: Select all

UniTable1.SpecificOptions.Add('MySQL.FetchAll=false');
In addition, pay attention to the QueryRecCount TCustomUniDataSet.Options property. When it is set to True, the UniTable1.RecordCount property will return the number of all records without retrieving all the records from DataSet (FetchAll=False). See more details in the UniDAC help: http://www.devart.com/unidac/docs/Devar ... cCount.htm

bogdan
Posts: 20
Joined: Mon 13 Apr 2015 17:27

Re: MySQL, FetchAll=false not working

Post by bogdan » Mon 25 May 2015 14:34

Thank you very much, this solves my problem.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: MySQL, FetchAll=false not working

Post by ViktorV » Tue 26 May 2015 08:02

It is good to see that the problem has been solved.
Feel free to contact us if you have any further questions about UniDAC.

Post Reply