Certain properties of a set of records can be specified by preceding
them with a record descriptor. A record descriptor is itself a
record, and uses fields with some predefined names to store the
properties. The most basic property that can be specified for a set
of records is their type. The special field name %rec is
used for that purpose:
%rec: Entry
Id: 1
Name: Entry 1
Id: 2
Name: Entry 2
The records following the descriptors are then identified as having its type. So in the example above we would say there are two records of type “Entry”.
The effect of a record descriptor ends when another descriptor is found in the stream of records. This allows to store different kind of records in the same database. For example, consider you have to maintain a depot. You will need to keep records of both the current stockage and the movements.
The following example shows the usage of two record descriptors to store both kind of records: articles and movements.
%rec: Article
Id: 1
Title: Article 1
Id: 2
Title: Article 2
%rec: Movement
Id: 1
Type: sell
Date: 20 April 2011
Id: 2
Type: adquisition
Date: 21 April 2011
Besides determining the type of the records that follows in the stream, record descriptors can be used to describe other properties of those records. That can be done by using the so-called special fields, having special names from a predefined set. Consider for example the following database, where the descriptor is used to specify a primary key and a mandatory field:
%rec: Item
%key: Id
%mandatory: Title
Id: 10
Title: Notebook (big)
Id: 11
Title: Fountain Pen
Note that the names of special fields always start with the character
%. Also note that it is also possible to use non-special
fields in a record descriptor, but such fields will have no effect on
the described record set.
What follows is an exhaustive list of the supported special fields. They are discussed in deep in the following sections.
%rec%mandatory%prohibit%unique%key%auto%doc%typedef%type%sort%size%confidential