2.4.4 Record Sets Properties

Besides determining the type of record that follows in the stream, record descriptors can be used to describe other properties of those records. This can be done by using special fields, which have special names from a predefined set. Consider for example the following database, where record descriptors are used to specify a (optional) numeric ‘Id’ and a mandatory ‘Title’ field:

%rec: Item
%type: Id int
%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.

Every record set must contain one, and only one, field named %rec. It is not mandated that that field must occupy the first position in the record. However, it is considered a good style to place it as the first field in the record set, in order for the casual reader to easily identify the type of the records.

The following list briefly describes the special fields defined in the recutils format, along with references to the sections of this manual describing their usage in depth.

%rec

Naming record types. Also, they allow using external and remote descriptors. See Remote Descriptors.

%mandatory, %allowed and %prohibit

Requiring or forbidding specific fields. See Mandatory Fields. See Prohibited Fields. See Allowed Fields.

%unique and %key

Working with keys. See Keys and Unique Fields.

%doc

Documenting your database. See Documenting Records.

%typedef and %type

Field types. See Field Types.

%auto

Auto-counters and time-stamps. See Auto-Generated Fields.

%sort

Keeping your record sets sorted. See Sorted Output.

%size

Restricting the size of your database. See Size Constraints.

%constraint

Enforcing arbitrary constraints. See Arbitrary Constraints.

%confidential

Storing confidential information. See Encryption.

%singular

Fields without repeating values.