[patch_rejected] cached updates can not be posted

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
zx
Fresh Boarder
Fresh Boarder
Posts: 16
Joined: 13.10.2005, 14:05

[patch_rejected] cached updates can not be posted

Post by zx »

bug report: cached updates can not be posted
TZAbstractDataset.CommitUpdates method rolls updates back

[problem]
Just look what code does:
// ZAbstractDataset.pas
procedure TZAbstractDataset.CommitUpdates;
begin
CheckBrowseMode;
if CachedResultSet <> nil then
CachedResultSet.CancelUpdates;
end;

But it is supposed to commit, not roll back updates. So:

[suggested solution]

(scope)
======== [component\ZAbstractDataset.pas] ========
procedure TZAbstractDataset.CommitUpdates;
(origin)
{
CachedResultSet.CancelUpdates;
}
(change into)
{
CachedResultSet.PostUpdates;
}

[platform notes]
zeosdbo-6.6.1-beta
delphi7
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

From Delphi Docs
Delphi syntax:

procedure CommitUpdates;

C++ syntax:

void __fastcall CommitUpdates(void);

Description

Call CommitUpdates to clear the cached updates buffer after both a successful call to ApplyUpdates and a database component’s Commit method. Clearing the cache after applying updates ensures that the cache is empty except for records that could not be processed and were skipped by the OnUpdateRecord or OnUpdateError event handlers. An application can attempt to modify the records still in the cache.

Record modifications made after a call to CommitUpdates repopulate the cached update buffer and require a subsequent call to ApplyUpdates to move them to the database.

Note: Applications that use a database component’s ApplyUpdates method to apply and commit pending updates for all datasets associated with the database component do not need to call CommitUpdates.
Before calling commitUpdates the Updates should have been posted to the database by ApplyUpdates already.

So no zeoslib change is required.

Mark
Image
Post Reply