ZeosLIb and stringgrid?

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
aljosa.motore
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 08.09.2006, 18:03

ZeosLIb and stringgrid?

Post by aljosa.motore »

I am using stringgrid component instead of dbgrid for displaying query result, but when I have big result query it takes a lot of time to fill the stringgrid. If I switch to dbgrid, this happened much much faster. So, how to fill stringgrid with query result as fast as possible?

Thanks.
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post by btrewern »

I expect it's a limitation of the stringgrid. Try looking for a different component e.g. Virtual Treeview (http://www.soft-gems.net/index.php?opti ... &Itemid=33could do what you want but takes a little effort to program for.

Regards,

Ben
aljosa.motore
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 08.09.2006, 18:03

Post by aljosa.motore »

I figured out that the problem is not in stringgrid. I tryed to generate stringgrid of 100000x10 cells with some random text and the speed is quite OK. So the problem is with reading database. I am using (for reading) ZQuery with function next, (then read data), next (then read data).... is there any fastest way for reading from query?
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi,

Reading that many rows is quite heavy indeed. I see 3 options:
- Try to use the zeos dbc layer directly. This avoids some of the TDataset handling. You'll have to look around a little to find nice examples. They exist, but don't ask me where.
- Try to only load the data actually visible. So only when scrolling down you load data not visible at first. Still slow when jumping to the last record is possible.
- Ask the database to concatenate multiple rows. So you only have to read one database record to to fill multiple grid rows. How? group_concat in mysql, stored procs to do the editing on database side (eg by preparing xml files you can parse when filling the grid.)

Of course : you should first check if the query is not delaying everything.

Mark

BTW : with 100000 lines you can fill a heavy book. Who ever reads this from a string grid? Make sure you only show the data that the user is looking for.
Marcin W.
Fresh Boarder
Fresh Boarder
Posts: 10
Joined: 24.04.2007, 11:57

Post by Marcin W. »

I have the same problem.
aljosa.motore, if you will find examples, please post it on forum.

greetings
Marcin
Post Reply