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

View File

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

View File

@ -38,7 +38,7 @@ type
end;
{ 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)
private
FBackingStream: TMemoryStream;

View File

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