Contents of the OVERFLOW.DOC file
This document describes the overflow module for managing
variable length records with Turbo Access (version 4).
The code for the overflow module is pulled straight out
of one of my programs. It does not quite stand alone
and there are a few things I'd do differently if it were
really intended as a general purpose stand-alone module.
However, it does serve to illustrate the ideas and it
isn't too difficult to adapt to other programs.
The overflow module manages variable length records by
recording them as linked lists of fixed length record parts
of 64 bytes each. The 64 byte size is large enough so that
most of the records in my application fit in a single record
part. Each record has a single "base" record part and may
optionally have up to 15 overflow record parts. This module
puts the overflow record parts in a separate file, although
there is no real reason why they couldn't be in the same file
as the base records.
The last 2 bytes of each record part are reserved for the
number of the next record part, with 0 indicating that this
is the last record part. (My application needs nowhere near
64k records, so a 2 byte pointer is sufficient). The first
2 bytes of each record part contain the record number of the
base record part; this is not really needed, but provides
a good integrity check.
This overflow module requires one simple modification to the
Turbo Access module. The NewRec procedure in Turbo Access
needs to be declared in the interface section to make it publicly
accessible. NewRec allocates a new record without writing it.
We use this because we need to know the record number before
we are quite ready to write the record. If you want to use a
strictly unmodified Turbo Access module, you can substitute a
call to AddRec instead of NewRec. The only difference is that
AddRec will do an unnecessary write of a record that you are
going to rewrite later.
The overflow module references a module called "strings".
This is just for the errorHalt procedure. You can provide
an errorHalt procedure or excise the calls to it.
Note that the data record is passed to these procedures
through a static variable instead of an argument. The merits
of this are debatable, but I won't bother with all the pros
and cons here. Suffice it to say that you can easily change
the code to pass the record as an argument if you think