CommitUpdates setting status of inserted record as deleted
Posted: 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.
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.