* Set buffer size

(cherry picked from commit e45b31ced5)
This commit is contained in:
Michaël Van Canneyt 2022-07-29 03:36:30 +02:00 committed by marcoonthegit
parent a04d892e40
commit d209df65b2
2 changed files with 21 additions and 4 deletions

View File

@ -208,7 +208,7 @@ type
FOnIndexMissing: TDbfIndexMissingEvent;
FOnCompareRecord: TNotifyEvent;
FOnCopyDateTimeAsString: TConvertFieldEvent;
FMyBufferSize : Cardinal;
function GetIndexName: string;
function GetVersion: string;
function GetPhysicalRecNo: Integer;
@ -250,7 +250,8 @@ type
procedure SetRangeBuffer(LowRange: PChar; HighRange: PChar);
protected
function GetDefaultBufferCount : Cardinal; override;
procedure SetDefaultBufferCount(aValue : Cardinal); virtual;
{ abstract methods }
function AllocRecordBuffer: TRecordBuffer; override; {virtual abstract}
procedure ClearCalcFields(Buffer: TRecordBuffer); override;
@ -409,7 +410,7 @@ type
{$ifndef SUPPORT_INITDEFSFROMFIELDS}
procedure InitFieldDefsFromFields;
{$endif}
Property DefaultBufferCount : Cardinal Read GetDefaultBufferCount Write SetDefaultBufferCount;
property AbsolutePath: string read FAbsolutePath;
property DbfFieldDefs: TDbfFieldDefs read GetDbfFieldDefs;
property PhysicalRecNo: Integer read GetPhysicalRecNo write SetPhysicalRecNo;
@ -660,6 +661,21 @@ begin
end;
end;
function TDbf.GetDefaultBufferCount : Cardinal;
begin
Result:=fMyBufferSize;
end;
procedure TDbf.SetDefaultBufferCount(aValue : Cardinal);
begin
CheckInactive;
FMyBufferSize:=aValue;
if FMyBufferSize<2 then
FMyBufferSize:=2;
end;
//====================================================================
// TDbf = TDataset Descendant.
//====================================================================
@ -669,7 +685,7 @@ begin
if DbfGlobals = nil then
DbfGlobals := TDbfGlobals.Create;
FMyBufferSize:=inherited GetDefaultBufferCount;
BookmarkSize := sizeof(TBookmarkData);
FIndexDefs := TDbfIndexDefs.Create(Self);
FMasterLink := TDbfMasterLink.Create(Self);

View File

@ -207,6 +207,7 @@ begin
Inherited;
FDBF:=TDBF.Create(Self);
FDBF.TableName:=FFileName;
FDBF.DefaultBufferCount:=2;
FE:=FileExists(FFileName);
If FAppendData and FE then
FDBF.Open