Error on double ApplyUpdates

The forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Post Reply
andrem
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 10.06.2014, 18:48

Error on double ApplyUpdates

Post by andrem »

Code: Select all

procedure TZAbstractCachedResultSet.PostUpdatesCached;
var
  i: Integer;
begin
  CheckClosed;
  if FInitialRowsList.Count > 0 then
  begin
    i := 0;
    while i < FInitialRowsList.Count do
    begin
      OldRowAccessor.RowBuffer := PZRowBuffer(FInitialRowsList[i]);
      NewRowAccessor.RowBuffer := PZRowBuffer(FCurrentRowsList[i]);
      Inc(i);

      { Updates default field values. }
      if NewRowAccessor.RowBuffer.UpdateType = utInserted then
        CalculateRowDefaults(NewRowAccessor);

      { Posts row updates. }
      PostRowUpdates(OldRowAccessor, NewRowAccessor);
{MikhailovAP -- ??? } 
      { If post was Ok - update the row update type. }
      if NewRowAccessor.RowBuffer.UpdateType <> utDeleted then
      begin
        NewRowAccessor.RowBuffer.UpdateType := utUnmodified;
        if (FSelectedRow <> nil)
          and (FSelectedRow.Index = NewRowAccessor.RowBuffer.Index) then
          FSelectedRow.UpdateType := utUnmodified;
      end;
    end;
{??? - Reset UpdateType after success}
  end;
end;
Program inserts one record (AutoCommit == off), but no commit. Method DataSet.ApplyUpdates involves again after next manipulation. Has error: primary key.
Copy/paste code block resolves this problem (may be?)
Post Reply