First, let’s examine the field definitions, stored as a DODA resource in the data file. The SQL command specified three columns, but c-treeACE SQL created three additional fields for internal use:
Field name |
Offset |
Type |
Length |
|---|---|---|---|
$DELFLD$ (a) |
0 |
CT_ARRAY |
4 |
$NULFLD$ (b) |
4 |
CT_ARRAY |
1 |
$ROWID$ (c) |
8 |
CT_INT8 |
8 |
dbl |
16 |
CT_DFLOAT |
8 |
int4 |
24 |
CT_INT4 |
4 |
ch |
28 |
CT_FSTRING |
8 |
(a) $DELFLD$ is a placeholder field at the beginning of the record for c-tree deleted record flag. If the first field in a record is not a binary field or the file is VARIABLE LENGTH, $DELFLD$ is not necessary. It can be modified, however, the first byte cannot be set to 0xFF or 0xFE for fixed-length data files, as these are reserved values.
(b) $NULFLD$ is a bit mask indicating which fields contain NULL values to support IFNULL functionality. If this field is not present, then all fields of a record will always be considered NOT NULL, and any operation to set the null flag of a particular field will be ignored. Select queries based on NULL field expressions may not be resolved as expected.
(c) $ROWID$ is an automatic serial number to support ROWID functionality. If this field is not present, then the SQL engine will use the record’s RECBYT. Please note that RECBYT may not be a unique row identifier. As records are deleted and reused, the RECBYT of a deleted record will be used for an inserted record. Select queries based on ROWID may not be resolved as expected when the RECBYT is used.