Query.CachedUpdates

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
MainMeat
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 21.04.2009, 09:02

Query.CachedUpdates

Post by MainMeat »

Hi Everyone,

I have a quick question on the CachedUpdates property that can be set to true on a Query.

What does this property do?
Does it:
1) Cache any updates made to the dataset and does not write the changes to records to disk until ApplyUpdates is called. This means all changes / updates to data in the dataset is cached until ApplyUpdates is called and the updated will remain in memory until this is done.

2) Therefor, does this mean when I insert a new record into a dataset, I have to call ApplyUpdates in order for this record to be stored? (I have found that when not doing this, the new data is not always stored).

Thanks in advance!
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

This property means that communication with the server only happens 'on demand'. Not sure, but I believe closing a dataset also does this.
Normally only changing this option should not have any effect on final data in the database (not taking into account the influence of other sessions on the database).

Concerning
(I have found that when not doing this, the new data is not always stored)
This may be bad behaviour (~ a bug). Difficult to tell with only the data above.

Mark
Image
trupka
Expert Boarder
Expert Boarder
Posts: 140
Joined: 26.08.2007, 22:10

Post by trupka »

I don't thing its a bug, more like feature.
It seems that CachedUpdates resembles behavior of delphi T(BDE|IBX)* components and influences how UpdateObject will work (if assigned).
If CachedUpdates := false then updates will be immediately applied (query will be executed).
If CachedUpdates := true, all updates (chages) will be, well.. cached - not applied to dataset until ApplyUpdates called. This behavior allows to change many records at once, and, in theory, to work "offline". I never tested zeos implementation in details but I think it works...
Post Reply