fcl-db/dbase: fix for HasBlob only returning true if last field is blob

git-svn-id: trunk@24340 -
This commit is contained in:
reiniero 2013-04-27 12:26:44 +00:00
parent 11a915e682
commit e78c2e05ef
4 changed files with 9 additions and 5 deletions

View File

@ -68,7 +68,7 @@ type
FDateTimeHandling: TDateTimeHandling; FDateTimeHandling: TDateTimeHandling;
FOnLocaleError: TDbfLocaleErrorEvent; FOnLocaleError: TDbfLocaleErrorEvent;
FOnIndexMissing: TDbfIndexMissingEvent; FOnIndexMissing: TDbfIndexMissingEvent;
// Yes if table has blob/memo type field(s) (storage in external file)
function HasBlob: Boolean; function HasBlob: Boolean;
function GetMemoExt: string; function GetMemoExt: string;
@ -686,7 +686,7 @@ begin
end; end;
// begin writing field definitions // begin writing field definitions
FFieldDefs.Clear; FFieldDefs.Clear;
// deleted mark 1 byte // deleted mark takes 1 byte, so skip over that
lFieldOffset := 1; lFieldOffset := 1;
for I := 1 to AFieldDefs.Count do for I := 1 to AFieldDefs.Count do
begin begin
@ -875,8 +875,11 @@ var
begin begin
Result := false; Result := false;
for I := 0 to FFieldDefs.Count-1 do for I := 0 to FFieldDefs.Count-1 do
if FFieldDefs.Items[I].IsBlob then if FFieldDefs.Items[I].IsBlob then
begin
Result := true; Result := true;
break;
end;
end; end;
function TDbfFile.GetMemoExt: string; function TDbfFile.GetMemoExt: string;

View File

@ -66,6 +66,7 @@ type
procedure CheckSizePrecision; procedure CheckSizePrecision;
procedure SetDefaultSize; procedure SetDefaultSize;
procedure AllocBuffers; procedure AllocBuffers;
// Yes if field is a blob/memo type field (storage in external file)
function IsBlob: Boolean; function IsBlob: Boolean;
property DefaultBuf: PChar read FDefaultBuf; property DefaultBuf: PChar read FDefaultBuf;

View File

@ -38,7 +38,7 @@ type
end; end;
{ TDBFAutoClean } { TDBFAutoClean }
// DBF descendant that saves to a temp file and removes file when closed // DBF descendant that saves to a memory stream instead of file
TDBFAutoClean = class(TDBF) TDBFAutoClean = class(TDBF)
private private
FBackingStream: TMemoryStream; FBackingStream: TMemoryStream;

View File

@ -90,7 +90,7 @@ begin
CheckEquals('TestName' + inttostr(i),ADBFDataset.fieldbyname('NAME').AsString); CheckEquals('TestName' + inttostr(i),ADBFDataset.fieldbyname('NAME').AsString);
ADBFDataset.next; ADBFDataset.next;
end; end;
CheckTrue(ADBFDataset.EOF); CheckTrue(ADBFDataset.EOF,'After reading all records the dataset should show EOF');
end; end;