Allows the maximum record size in TFixedDataset and descendents to be modifyed.

git-svn-id: trunk@11727 -
This commit is contained in:
sekelsenmat 2008-09-07 19:17:12 +00:00
parent 156acf3817
commit b573908e93

View File

@ -125,9 +125,6 @@ interface
uses
DB, Classes, SysUtils;
const
MAXSTRLEN = 250;
type
//-----------------------------------------------------------------------------
// TRecInfo
@ -165,6 +162,7 @@ type
FRecInfoOfs :Integer;
FBookmarkOfs :Integer;
FSaveChanges :Boolean;
FMaxRecordLength :Cardinal;
protected
function AllocRecordBuffer: PChar; override;
procedure FreeRecordBuffer(var Buffer: PChar); override;
@ -199,6 +197,7 @@ type
function BufToStore(Buffer: PChar): String; virtual;
function StoreToBuf(Source: String): String; virtual;
public
property MaxRecordLength: Cardinal read FMaxRecordLength write FMaxRecordLength default 250;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetFieldData(Field: TField; Buffer: Pointer): Boolean; override;
@ -338,7 +337,7 @@ begin
FData.Objects[i] := TObject(Pointer(i+1)); // Fabricate Bookmarks
end;
if (Maxlen = 0) then
Maxlen := MAXSTRLEN;
Maxlen := FMaxRecordLength;
LstFields := TStringList.Create;
try
LoadFieldScheme(LstFields, Maxlen);
@ -368,13 +367,13 @@ begin
end;
if not FLoadfromStream then
FData.LoadFromFile(FileName);
FRecordSize := MAXSTRLEN;
FRecordSize := FMaxRecordLength;
InternalInitFieldDefs;
if DefaultFields then
CreateFields;
BindFields(TRUE);
if FRecordSize = 0 then
FRecordSize := MAXSTRLEN;
FRecordSize := FMaxRecordLength;
BookmarkSize := SizeOf(Integer);
FRecInfoOfs := FRecordSize + CalcFieldsSize; // Initialize the offset for TRecInfo in the buffer
FBookmarkOfs := FRecInfoOfs + SizeOf(TRecInfo);