CommitUpdates setting status of inserted record as deleted

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
bsoft
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 14.07.2016, 18:33

CommitUpdates setting status of inserted record as deleted

Post by bsoft »

When using a ZQuery with CachedUpdates = True and executing ApplyUpdates followed by CommitUpdates, the record's UpdateStatus is set to usDeleted, which generates an Error when trying to Edit the Record.

ZConnection properties are AutoCommit = True and TransactionIsolation = tiReadCommited. Zeos version 7.1.4 and Firebird Datasbase.

Example:

qryTest.Open;
qryTest.Append;
// set field values
qryTest.Post;
qryTest.ApplyUpdates;
qryTest.CommitUpdates; // qryTest.UpdateStatus = usDeleted
qryTest.Edit;
//set field values
qryTest.Post; //Exception 'Cannot update a deleted row'

It seems to me that the error is caused by TZAbstractDataset.CommitUpdates calling CachedResultSet.CancelUpdates, which executes this code:

if CurrentRow.UpdateType = utInserted then
InitialRow.UpdateType := utDeleted;

Is this intended? Shouldn't CommitUpdates call DisposeCachedUpdates?

Zeos 7.2 should have the same issue, although I didn't test it, only looked at the source code.

Thanks.
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1956
Joined: 17.01.2011, 14:17

Re: CommitUpdates setting status of inserted record as deleted

Post by marsupilami »

Hello bsoft,

could you try to build a small test case? Just a database script and a small Delphi or Lazarus project? That helps in tracking things down.
With best regards,

Jan
Fr0sT
Zeos Dev Team
Zeos Dev Team
Posts: 280
Joined: 08.05.2014, 12:08

Re: CommitUpdates setting status of inserted record as deleted

Post by Fr0sT »

The same thing I reported in SVN tickets
bsoft
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 14.07.2016, 18:33

Re: CommitUpdates setting status of inserted record as deleted

Post by bsoft »

marsupilami wrote:Hello bsoft,

could you try to build a small test case? Just a database script and a small Delphi or Lazarus project? That helps in tracking things down.
With best regards,

Jan
Here you go.

Thanks
You do not have the required permissions to view the files attached to this post.
Post Reply