Browse Source

* When syncing the current record to the activebuffer in ApplyUpdates, perform only the necessary steps

git-svn-id: trunk@12366 -
joost 16 years ago
parent
commit
6617fdf305
1 changed files with 17 additions and 11 deletions
  1. 17 11
      packages/fcl-db/src/base/bufdataset.pas

+ 17 - 11
packages/fcl-db/src/base/bufdataset.pas

@@ -399,6 +399,7 @@ type
     procedure ParseFilter(const AFilter: string);
     procedure IntLoadFielddefsFromFile;
     procedure IntLoadRecordsFromFile;
+    procedure CurrentRecordToBuffer(Buffer: PChar);
   protected
     procedure UpdateIndexDefs; override;
     function GetNewBlobBuffer : PBlobBuffer;
@@ -1240,11 +1241,24 @@ begin
   if FCursOnFirstRec then FCurrentRecBuf:=FLastRecBuf;
 end;
 
+procedure TBufDataset.CurrentRecordToBuffer(Buffer: PChar);
+var ABookMark : PBufBookmark;
+begin
+  with FCurrentIndex do
+    begin
+    move(CurrentBuffer^,buffer^,FRecordSize);
+    ABookMark:=PBufBookmark(Buffer + FRecordSize);
+    ABookmark^.BookmarkFlag:=bfCurrent;
+    StoreCurrentRecIntoBookmark(ABookMark);
+    end;
+
+  GetCalcFields(Buffer);
+end;
+
 function TBufDataset.GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult;
 
 var Acceptable : Boolean;
     SaveState : TDataSetState;
-    ABookMark : PBufBookmark;
 
 begin
   Result := grOK;
@@ -1267,15 +1281,7 @@ begin
 
     if Result = grOK then
       begin
-      with FCurrentIndex do
-        begin
-        move(CurrentBuffer^,buffer^,FRecordSize);
-        ABookMark:=PBufBookmark(Buffer + FRecordSize);
-        ABookmark^.BookmarkFlag:=bfCurrent;
-        StoreCurrentRecIntoBookmark(ABookMark);
-        end;
-
-      GetCalcFields(Buffer);
+      CurrentRecordToBuffer(buffer);
 
       if Filtered then
         begin
@@ -1825,7 +1831,7 @@ begin
         begin
         FCurrentIndex.GotoBookmark(@FUpdateBuffer[r].BookmarkData);
         // Synchronise the Currentbuffer to the ActiveBuffer
-        GetRecord(ActiveBuffer,gmCurrent,True);
+        CurrentRecordToBuffer(ActiveBuffer);
         Response := rrApply;
         try
           ApplyRecUpdate(FUpdateBuffer[r].UpdateKind);