소스 검색

fcl-db: bufdataset: TBufDataset autoincrement fields (ftAutoInc) are not restarted when dataset is closed and again reopened. See bug #25628

git-svn-id: trunk@26622 -
lacak 11 년 전
부모
커밋
c4a981fa8e
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      packages/fcl-db/src/base/bufdataset.pas

+ 2 - 2
packages/fcl-db/src/base/bufdataset.pas

@@ -1173,7 +1173,6 @@ var IndexNr : integer;
     i : integer;
 
 begin
-  FAutoIncField:=nil;
   if not Assigned(FDatasetReader) and (FileName<>'') then
     begin
     FFileStream := TFileStream.Create(FileName,fmOpenRead);
@@ -1202,6 +1201,7 @@ begin
   // If there is a field with FieldNo=0 then the fields are not found to the
   // FieldDefs which is a sign that there is no dataset created. (Calculated and
   // lookup fields have FieldNo=-1)
+  FAutoIncField:=nil;
   for i := 0 to Fields.Count-1 do
     if Fields[i].FieldNo=0 then
       DatabaseError(SErrNoDataset)
@@ -1274,7 +1274,7 @@ begin
 
   SetLength(FFieldBufPositions,0);
 
-  FAutoIncValue:=-1;
+  if FAutoIncValue>-1 then FAutoIncValue:=1;
 
   if assigned(FParser) then FreeAndNil(FParser);
   FReadFromFile:=false;