TZTable to read fewer records at a time
Moderators: gto, cipto_kh, EgonHugeist
TZTable to read fewer records at a time
My customer says he has over 2,000 contacts in his contacts table. Is there a way in Delphi to tell the TZtable to only read a few hundred records at a time to display in the DBGrid, and when the user scrolls down it will ask the TZTable to read the next few hundred?
Re: TZTable to read fewer records at a time
I used to use ZTables for my DB applications until I ran into your problem. Only mine was more like 2,000,000 records in a table. Swallowing that whole took forever, especially over a WAN. Now I use ZQueries almost exclusively.rfwoolf wrote:My customer says he has over 2,000 contacts in his contacts table. Is there a way in Delphi to tell the TZtable to only read a few hundred records at a time to display in the DBGrid, and when the user scrolls down it will ask the TZTable to read the next few hundred?
I use a ZQuery and an SQL "LIMIT" command to limit the number of records returned in the dataset. You can then page through your table by bumping the start record in the SQL statement.
Example:
Get the first 100 records:
select *
from reallybigtable
limit 0,100
Get the next 100 records:
select *
from reallybigtable
limit 100,100
And so on...
This works in MySQL for sure. It will probably work in other SQL engines, maybe with a minor syntax tweak. For extra credit you can turn on data compression to speed up large data transfers over a WAN - at least on MySQL.
HTH!
Kevin
The syntax for limiting the results in firebird is:
This is very recommended as a best pratice in development process. By the way, 2000 records aren't too much, in my point of view. If your table don't have much columns and your network should be fast, maybe, there's a hardware problem.
Also, in ZQuery there's an option which *probably* will do the fetching thing, called FetchCount or something like that
Code: Select all
select first x, y from table
Also, in ZQuery there's an option which *probably* will do the fetching thing, called FetchCount or something like that
Hi all !
Here is the patch for Zeos 6.6.4-stable !
Just unpack and copy-replace this files to zeos/src/components and
(it is good practice to make backup !)
recompile zeos components ...
Now You have FetchRow property and FetchAll method on ZTable and ZQuery components ...
Have fun !
Here is the patch for Zeos 6.6.4-stable !
Just unpack and copy-replace this files to zeos/src/components and
(it is good practice to make backup !)
recompile zeos components ...
Now You have FetchRow property and FetchAll method on ZTable and ZQuery components ...
Have fun !
You do not have the required permissions to view the files attached to this post.