TMyQuery refresh only one field?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
starhu
Posts: 34
Joined: Thu 13 Aug 2009 12:13

TMyQuery refresh only one field?

Post by starhu » Mon 03 Feb 2020 09:47

Hi,

I have a TMyQuery, let's say I have 3 fields: id, productName, quantity

Sometimes I need to refresh only the quantity fields because the table is very big.
How is this possible? I can't use the SqlRefresh because I use it for refreshing everything (I need this too, sometimes).
Thank you very much for your help!

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

Re: TMyQuery refresh only one field?

Post by ViktorV » Mon 03 Feb 2020 10:45

To quickly get changes made by other queries, you can use the TCustomDADataSet.RefreshQuick method. Note that for this method to work, it is necessary that the table has unique key fields and a TIMESTAMP field. You can get more information about this method in MyDAC help: https://devart.com/mydac/docs/devart.my ... olean).htm
For the TMyQuery.RefreshQuick method to work correctly, the timestamp field must be present in the SELECT query. If there are several such fields in the query, the last timestamp field present in the SELECT query will be used.
Note that the timestamp field in the database table should be as follows:
timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

Note, the query specified in the SQLRefresh property is used to refresh current record by calling the RefreshRecord procedure, but not the Refresh method.
You can find the detailed description of the property in IBDAC help: https://www.devart.com/mydac/docs/index ... efresh.htm
The query parameter value specified in the SQLRefresh property is automatically set to a value that is equal to the field value associated with this parameter before calling the RefreshRecord method.

Post Reply