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.
CommitUpdates setting status of inserted record as deleted
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: CommitUpdates setting status of inserted record as deleted
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
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
Re: CommitUpdates setting status of inserted record as deleted
The same thing I reported in SVN tickets
Re: CommitUpdates setting status of inserted record as deleted
Here you go.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
Thanks
You do not have the required permissions to view the files attached to this post.