This unit contains all the routines needed for handling files with fixed
length (up to 65528 bytes) records. Records are identified by non negative
longints and all of the routines refer to these numbers. To use any of the
routines just drop a TFFile component on a form, set its FFileName
property and call AttachFile to use the routines. (See below for
details). Use the Create FFile Wizard to create a FFile data set.
TFFile - pack records here
Register - FileName: This is the name of a data set that contains the actual records.
procedure Register;
FileName: This is the name of a data set that contains the actual records.
The data set must exixt on disk when this property is set since
SetFFileName reads it to set some internal fields.
RecordLength: Just the length of records in the file. Read only, but
visible in Object Inspector.
RecordCount: Just the number of records in the file. Read only.
AttachFile: This method hooks up the internal TFFile with the disk data
set named in the FFileName property. It MUST be called before any other
methods or they wont work. A good place to put this is in the OnCreate
event for the form.
DetachFile. This method need not be called unless you want to use the
TFFile on another data set. This method breaks the connection between
the data set and the TFFile. Here is an example. We wish to disconnect
the TFFile from the data set 'DATA1' and connect instead to 'DATA2'.
AFFile.DetachFFile; -- disconnects DATA1 --
AFFile.FFileName := 'DATA2';
AFFile.AttachFile;
Exist: Returns TRUE if the record with record number rid exists.
Fetch: This method gets the record with id rid and places it in the
buffer pointed to by Buf.
Insert: This method is used to insert a new record with id rid. The
record is stored is the buffer pointer to by Buf. This method checks
to see that the id rid is not being used already, and if it is,
does nothing.
Restore: This method is used to restore a fetched record. The id is rid.
This method checks to see that the id rid is being used already,
and if it is not does nothing.
Delete: This method is used to delete a record. The id is rid. This
method check to see that the id rid is being used already, and it not,
does nothing. When a record is deleted its place in
file has its first 7 bytes set to 'DELETED'.
FetchPartial: Like fetch but only part of the record is retrieved.
Transmission starts at Start and Trans bytes are transmitted.
RestorePartial: Like Restore but only part of the record is retrieved.
Is intended to work with FetchPartial.