activating MyTable with large table

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
digdagdigedag
Posts: 6
Joined: Wed 18 Apr 2007 10:52

activating MyTable with large table

Post by digdagdigedag » Wed 18 Apr 2007 11:27

hello,
from an earlier posting from 'Veli', i understand that activating a table is equivalent to 'SELECT * FROM table', i.e. all records are loaded into memory and can lead to an 'out of memory crash'. it was proposed to use TMyQuery instead of TMyTable.
for some purposes the proposal may be useful but i would like to move from record to record with Next() and in a second round with Previous() in order to process every single reocrd one by one.

this means that i do not need to simultaneously keep all records in memory but i need to at least access each record. how can TMyQery help me here ?

thanks
uwe

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 19 Apr 2007 09:42

You should use UniDirectional mode (TMyQuery.UniDirectional = True). In this mode the only current record is cached on the client. The restriction of this mode is that you can browse the record set forward only (commands like Prior, First are not allowed). Not all DB-aware controls can work in this mode (e.g. TDBGrid).

You can also restrict your record set size by specifying only required field names instead of * in your SELECT, and by adding a condition to WHERE to restrict records count.

Post Reply