|
@@ -1116,9 +1116,9 @@ end;
|
|
procedure TCustomBufDataset.InternalOpen;
|
|
procedure TCustomBufDataset.InternalOpen;
|
|
|
|
|
|
var IndexNr : integer;
|
|
var IndexNr : integer;
|
|
|
|
+ i : integer;
|
|
|
|
|
|
begin
|
|
begin
|
|
- InitDefaultIndexes;
|
|
|
|
if not Assigned(FDatasetReader) and (FileName<>'') then
|
|
if not Assigned(FDatasetReader) and (FileName<>'') then
|
|
begin
|
|
begin
|
|
FFileStream := TFileStream.Create(FileName,fmOpenRead);
|
|
FFileStream := TFileStream.Create(FileName,fmOpenRead);
|
|
@@ -1126,6 +1126,21 @@ begin
|
|
FReadFromFile := True;
|
|
FReadFromFile := True;
|
|
end;
|
|
end;
|
|
if assigned(FDatasetReader) then IntLoadFielddefsFromFile;
|
|
if assigned(FDatasetReader) then IntLoadFielddefsFromFile;
|
|
|
|
+
|
|
|
|
+ // This is to check if the dataset is actually created (By calling CreateDataset,
|
|
|
|
+ // reading from a stream in some other way implemented by a descendent)
|
|
|
|
+ // If there are less fields then FieldDefs we know for sure that the dataset
|
|
|
|
+ // is not (correctly) created.
|
|
|
|
+ if Fields.Count<FieldDefs.Count then
|
|
|
|
+ DatabaseError(SErrNoDataset);
|
|
|
|
+ // 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
|
|
|
|
+ // lookupfields have FielNo=-1)
|
|
|
|
+ for i := 0 to Fields.Count-1 do
|
|
|
|
+ if fields[i].FieldNo=0 then
|
|
|
|
+ DatabaseError(SErrNoDataset);
|
|
|
|
+
|
|
|
|
+ InitDefaultIndexes;
|
|
CalcRecordSize;
|
|
CalcRecordSize;
|
|
|
|
|
|
FBRecordcount := 0;
|
|
FBRecordcount := 0;
|