c-tree recognizes the following field types:
The field delimiter defaults to a null byte. However, the SetVariableBytes() function can be used to change the delimiter to a value other than the default.
Following the Pascal string storage convention, the value stored in the length count byte(s) corresponds to the length of the string and does not include the length count bytes themselves. However, the length count byte(s) should be included in the length specified in the DODA flen element. For example, a 10-byte string of type CT_F4STRING has a length of 14-bytes in the flen element of the DODA, however, the length stored in the byte count portion of the data record would be 10.
Caution: When using the CT_F2STRING and CT_F4STRING types, the byte count can be affected by the alignment of the compiler.
A fixed-length field with varying length contents means that the field occupies a fixed number of bytes in the record structure, but that a field delimiter or a length count specifies the actual amount of data in the field.
The constants used to represent these field types (found in ctport.h) are:
Symbolic Constant |
Interpretation |
---|---|
CT_BOOL |
1-byte Boolean. |
CT_CHAR |
Signed char. |
CT_CHARU |
Unsigned char. |
CT_INT2 |
Signed 2-byte integer. |
CT_INT2U |
Unsigned 2-byte integer. |
CT_INT4 |
Signed 4-byte integer. |
CT_INT4U |
Unsigned 4-byte integer. |
CT_INT8 |
Signed 8-byte integer. |
CT_INT8U |
Unsigned 8-byte integer. |
CT_MONEY |
Signed 4-byte integer interpreted as number of pennies up to a precision of 9. |
CT_DATE |
Unsigned 4-byte integer interpreted as date. |
CT_TIME |
Unsigned 4-byte integer interpreted as time. |
CT_SFLOAT |
4-byte floating point. |
CT_DFLOAT |
8-byte floating point. |
CT_EFLOAT |
Extended precision floating point (not supported as a key segment). |
CT_TIMES |
8-byte floating point. |
CT_ARRAY |
Arbitrary fixed length data. |
CT_RESRVD |
Reserved for future use. |
CT_FSTRING |
Fixed length field delimited data. |
CT_FPSTRING |
Fixed length data with 1-byte length count. |
CT_F2STRING |
Fixed length data with 2-byte length count. |
CT_F4STRING |
Fixed length data with 4-byte length count. |
CT_STRING |
Varying length field delimited data. (NUL terminated.) |
CT_PSTRING |
Varying length data with 1-byte length count. |
CT_2STRING |
Varying length data with 2-byte length count. |
CT_4STRING |
Varying length data with 4-byte length count. |
CT_UNICODE |
A variable-length field containing a UTF16 encoded, null terminated string. |
CT_2UNICODE |
A variable-length field that begins with a 2-byte integer specifying the number of bytes in the following UTF16 encoded string. |
CT_FUNICODE |
A fixed length field containing a UTF16 encoded, null terminated string. |
CT_F2UNICODE |
A fixed length field that begins with a 2-byte integer specifying the number of bytes in the following UTF16 encoded string. |
CT_UNIXTIME_T |
A 4 byte UNIX timestamp that maps to the SQL TIMESTAMP type |
CT_UNIXTIME64_T |
An 8 byte UNIX timestamp that maps to the SQL TIMESTAMP type |