Browse Source

fcl-db: cosmetic

git-svn-id: trunk@27127 -
lacak 11 years ago
parent
commit
cf42b3bdc0
2 changed files with 9 additions and 5 deletions
  1. 4 3
      packages/fcl-db/src/base/bufdataset.pas
  2. 5 2
      packages/fcl-db/src/sqldb/sqldb.pp

+ 4 - 3
packages/fcl-db/src/base/bufdataset.pas

@@ -1262,6 +1262,8 @@ var r  : integer;
 
 begin
   FOpen:=False;
+  FReadFromFile:=False;
+
   if FIndexesCount>0 then with FIndexes[0] do if IsInitialized then
     begin
     iGetResult:=ScrollFirst;
@@ -1305,7 +1307,6 @@ begin
   if FAutoIncValue>-1 then FAutoIncValue:=1;
 
   if assigned(FParser) then FreeAndNil(FParser);
-  FReadFromFile:=false;
 end;
 
 procedure TCustomBufDataset.InternalFirst;
@@ -2976,7 +2977,7 @@ procedure TCustomBufDataset.CreateDataset;
 var AStoreFileName: string;
 begin
   CheckInactive;
-  if ((FieldCount=0) or (FieldDefs.Count=0)) then
+  if ((Fields.Count=0) or (FieldDefs.Count=0)) then
     begin
     if (FieldDefs.Count>0) then
       CreateFields
@@ -2989,7 +2990,7 @@ begin
       raise Exception.Create(SErrNoFieldsDefined);
     FAutoIncValue:=1;
     end;
-  // When a FileName is set, do not read from this file
+  // When a FileName is set, do not read from this file; we want empty dataset
   AStoreFileName:=FFileName;
   FFileName := '';
   try

+ 5 - 2
packages/fcl-db/src/sqldb/sqldb.pp

@@ -2171,13 +2171,16 @@ begin
     //  so let them do cleanup f.e. cancel pending queries and/or free resultset
     if not Prepared then FStatement.DoUnprepare;
     end;
+
   if DefaultFields then
     DestroyFields;
+
   FIsEOF := False;
   if assigned(FUpdateQry) then FreeAndNil(FUpdateQry);
   if assigned(FInsertQry) then FreeAndNil(FInsertQry);
   if assigned(FDeleteQry) then FreeAndNil(FDeleteQry);
 //  FRecordSize := 0;
+
   inherited InternalClose;
 end;
 
@@ -2201,7 +2204,7 @@ end;
 procedure TCustomSQLQuery.InternalOpen;
 
 var counter, fieldc : integer;
-    f               : TField;
+    F               : TField;
     IndexFields     : TStrings;
 begin
   if IsReadFromPacket then
@@ -2248,7 +2251,7 @@ begin
                 ExtractStrings([';'],[' '],pchar(ServerIndexDefs[counter].fields),IndexFields);
                 for fieldc := 0 to IndexFields.Count-1 do
                   begin
-                  F := Findfield(IndexFields[fieldc]);
+                  F := FindField(IndexFields[fieldc]);
                   if F <> nil then
                     F.ProviderFlags := F.ProviderFlags + [pfInKey];
                   end;