CommitUpdates setting status of inserted record as deleted

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

CommitUpdates setting status of inserted record as deleted

Postby bsoft » 14.07.2016, 19:50

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
Gold Boarder
Gold Boarder
Posts: 591
Joined: 17.01.2011, 14:17

Re: CommitUpdates setting status of inserted record as deleted

Postby marsupilami » 29.07.2016, 10:26

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
Junior Boarder
Junior Boarder
Posts: 43
Joined: 08.05.2014, 12:08

Re: CommitUpdates setting status of inserted record as deleted

Postby Fr0sT » 05.08.2016, 16:26

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

Postby bsoft » 05.08.2016, 20:05

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.


Return to “ZeosLib 7.1 stable Forum”

Who is online

Users browsing this forum: No registered users and 1 guest