Skip to content

Records

While tables and columns have both names and numbers, records have only numbers. These numbers start with 1 in every table and proceed without gaps up to the last record in the table. Deletion of records in a table can create apparent gaps in record numbers. New records will always be created under the numbers of previously deleted records unless there are no deleted record numbers available or the Re-Use Deleted Space option has been rejected in the table's definition. Thus, record numbers indicate the physical order of records in the table on disk.

Every record of a table has a value for every column, and every column has a value in every record. In DataFlex, there is no distinction between a null column and an empty one. DataFlex will not create a new record if all of its columns are blank. A blank record can be created from an existing one, however, by clearing all of its columns.

A given record is always ultimately found by its record number, which is a physical pointer based on the distance of the record from the beginning of the data. In a table of 20-byte records, the fifth record begins 100 bytes after the start of the first record. Columns are found the same way. DataFlex embedded database files contain no delimiters.

Record Blocking

In order to facilitate finding records, DataFlex assigns record lengths that may exceed the aggregate length of the columns in the table. In a table whose columns total 27 bytes, for example, records will be created every 28 bytes, with one undefined byte "in" (or between) each record. Tables whose fields total 28 bytes in length will be assigned the same size (28-byte) records. This blocking factor is applied automatically when a table is created.

The following record sizes are available:

  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 28
  • 30
  • 32
  • 34
  • 36
  • 39
  • 42
  • 46
  • 51
  • 56
  • 64
  • 73
  • 85
  • 102
  • 128
  • 170
  • 256
  • 384
  • 512
  • 640
  • 768

The blocking factor continues upward in 128-byte increments after 256.

Following is an illustration of what the first 60 bytes of data on disk would look like in a table containing records whose columns totaled 27 bytes. Since 27 bytes' total field length is assigned to records of 28 bytes' length, the last byte in each record block would be untyped (and not used). The hypothetical record is made up of the following columns:

  • a: String, 15 bytes
  • /: Date, 3 bytes
  • 1: Number, 2 bytes
  • b: String, 4 bytes
  • 2: Number, 3 bytes
  • x: undefined
10        20        30        40        50        60
|         |         |         |         |         |
aaaaaaaaaaaaaaa///11bbbb222xaaaaaaaaaaaaaaa///11bbbb222xaaaaaaaa
|                     |                     |
Record 1             Record 2             Record 3

See Also

The Embedded Database