Page 1 of 1

ZeosLIb and stringgrid?

Posted: 30.04.2007, 20:53
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.

Posted: 01.05.2007, 09:30
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

Posted: 01.05.2007, 22:17
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?

Posted: 01.05.2007, 22:47
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.

Posted: 14.05.2007, 08:13
by Marcin W.
I have the same problem.
aljosa.motore, if you will find examples, please post it on forum.

greetings
Marcin