Browse Source

+ fix for activerecord, bof false after append.

michael 20 years ago
parent
commit
fc3b6f0693
2 changed files with 21 additions and 7 deletions
  1. 16 6
      fcl/db/dataset.inc
  2. 5 1
      fcl/db/db.pp

+ 16 - 6
fcl/db/dataset.inc

@@ -1085,7 +1085,8 @@ Procedure TDataset.DoInsertAppend(DoAppend : Boolean);
   begin
   begin
   // need to scroll up al buffers after current one,
   // need to scroll up al buffers after current one,
   // but copy current bookmark to insert buffer.
   // but copy current bookmark to insert buffer.
-  If FRecordcount > 0 then BookBeforeInsert:=Bookmark;
+  If FRecordcount > 0 then
+    BookBeforeInsert:=Bookmark;
 
 
   if FActiveRecord < FRecordCount-1 then
   if FActiveRecord < FRecordCount-1 then
     begin
     begin
@@ -1095,8 +1096,10 @@ Procedure TDataset.DoInsertAppend(DoAppend : Boolean);
     end
     end
   else if FRecordcount=FBuffercount then
   else if FRecordcount=FBuffercount then
     shiftbuffersbackward
     shiftbuffersbackward
-  else
+  else begin
+    if FRecordCount>0 then
     inc(FActiveRecord);
     inc(FActiveRecord);
+  end;
 
 
   // Active buffer is now edit buffer. Initialize.
   // Active buffer is now edit buffer. Initialize.
   InitRecord(FBuffers[FActiveRecord]);
   InitRecord(FBuffers[FActiveRecord]);
@@ -1113,7 +1116,8 @@ Procedure TDataset.DoInsertAppend(DoAppend : Boolean);
     fBOF := false;
     fBOF := false;
     // 29:01:05, JvdS: Why is this here?!? It can result in records with the same bookmark-data?
     // 29:01:05, JvdS: Why is this here?!? It can result in records with the same bookmark-data?
     // I would say that the 'internalinsert' should do this. But I don't know how Tdbf handles it
     // I would say that the 'internalinsert' should do this. But I don't know how Tdbf handles it
-    if FRecordcount > 0 then SetBookMarkData(ActiveBuffer,pointer(BookBeforeInsert));
+    if FRecordcount > 0 then
+      SetBookMarkData(ActiveBuffer,pointer(BookBeforeInsert));
     end;
     end;
 
 
   InternalInsert;
   InternalInsert;
@@ -1145,9 +1149,11 @@ begin
     ClearBuffers;
     ClearBuffers;
     InternalLast;
     InternalLast;
     GetPriorRecords;
     GetPriorRecords;
-    FActiveRecord:=FRecordCount-1;
+    if FRecordCount>0 then
+      FActiveRecord:=FRecordCount-1;
     DoInsert;
     DoInsert;
     SetBookmarkFlag(ActiveBuffer,bfEOF);
     SetBookmarkFlag(ActiveBuffer,bfEOF);
+    FBOF :=False;
     FEOF := true;
     FEOF := true;
     end;
     end;
   SetState(dsInsert);
   SetState(dsInsert);
@@ -1381,7 +1387,8 @@ begin
   try
   try
     InternalLast;
     InternalLast;
     GetPriorRecords;
     GetPriorRecords;
-    FActiveRecord:=FRecordCount-1;
+    if FRecordCount>0 then
+      FActiveRecord:=FRecordCount-1
   finally
   finally
     FEOF:=true;
     FEOF:=true;
     DataEvent(deDataSetChange, 0);
     DataEvent(deDataSetChange, 0);
@@ -1758,7 +1765,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.32  2005-02-14 17:13:12  peter
+  Revision 1.33  2005-03-29 10:07:34  michael
+  + fix for activerecord, bof false after append.
+
+  Revision 1.32  2005/02/14 17:13:12  peter
     * truncate log
     * truncate log
 
 
   Revision 1.31  2005/02/07 11:19:27  joost
   Revision 1.31  2005/02/07 11:19:27  joost

+ 5 - 1
fcl/db/db.pp

@@ -1148,6 +1148,7 @@ type
     procedure SetBufferCount(Value: Integer); virtual;
     procedure SetBufferCount(Value: Integer); virtual;
     procedure UpdateData; virtual;
     procedure UpdateData; virtual;
     property VisualControl: Boolean read FVisualControl write FVisualControl;
     property VisualControl: Boolean read FVisualControl write FVisualControl;
+    property FirstRecord: Integer read FFirstRecord write FFirstRecord;
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -1895,7 +1896,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.42  2005-03-25 11:38:01  michael
+  Revision 1.43  2005-03-29 10:07:34  michael
+  + fix for activerecord, bof false after append.
+
+  Revision 1.42  2005/03/25 11:38:01  michael
   + Implementation of IndexForFields from   Alexandrov Alexandru
   + Implementation of IndexForFields from   Alexandrov Alexandru
 
 
   Revision 1.41  2005/03/18 11:54:56  michael
   Revision 1.41  2005/03/18 11:54:56  michael