Database Records and Mark Characters |
![]() ![]() ![]() |
A database record may have any number of fields (table columns). The entire record and the constituent fields are of variable length, there being no restriction applied by QM. A record may exist in the database with no data or with many megabytes of data.
The record stored on disk or manipulated in memory may be divided into fields by field mark characters. A field may be divided into values by use of value mark characters and values may be further divided by use of subvalue mark characters.
Two additional mark characters are defined. The text mark is typically used to mark points in text data where newlines should be inserted. This mark character is often inserted by programs manipulating data in memory rather than being stored in the database. The item mark is defined mainly for compatibility with other database systems. Its only reserved use within QM is to separate items in the DATA queue.
The internal representation of the mark characters uses the last five characters of the ASCII character set:
The memory representation of a record containing mark characters for use in QMBasic programs is known as a dynamic array and there are many specialised program operations for working on this data.
Fields, values within a field and subvalues within a value are numbered from one upwards. By convention the record key is sometimes referred to as field zero though it is not part of the dynamic array and references to field zero are only recognised by QM in certain contexts.
Database records are often entered, modified or retrieved by the ED, SED and MODIFY commands.
In directory files, the internal field mark character is replaced by the ASCII newline character when a record is written to disk so that fields appear as lines if the record is viewed, edited or printed from outside QM. Conversely, ASCII newlines are converted to field marks on reading a record. Mechanisms are provided in QMBasic (see the MARK.MAPPING statement) to turn off this translation when handling binary data.
|