Data Types

The data types that are available in RDM SQL are given in the following syntax specification and described in the table which follows.

Table 1. RDM SQL Data Type Descriptions
Data Type Description
CHAR[(length)]
CHARACTER[(length)]
A fixed-length UTF-8 character array. The length specifies the maximum number of characters that can be contained in the column. They are stored as C char strings, adding 1 character for the null-terminal character. Each row contains length + 1 bytes for the column.
VARCHAR(length) A variable-length UTF character array. The length specifies the maximum number of characters that can be contained in the column. They are stored as C char strings, adding 1 character for the null-terminal character.
WCHAR[(length)]
WCHARACTER[(length)]
A fixed-length UTF-16 or UTF-32 (depending on OS) character array. The length specifies the maximum number of characters (not bytes) stored in the array. They are stored as C wchar (or wchar_t) strings, adding 1 character for the null-terminal character.
WVARCHAR(length) A variable-length UTF-16 or UTF-32 (depending on OS) character array. The length specifies the maximum number of characters (not bytes) stored in the array. They are stored as C wchar (or wchar_t) strings, adding 1 character for the null-terminal character.
LONG VARCHAR A variable-length UTF-8 character string of up to 4.2 gigabytes in length. Note that a null-terminal character is required.
CLOB A variable-length UTF-8 character string of up to 4.2 gigabytes in length. Note that a null-terminal character is required.
LONG WVARCHAR A variable-length UTF-16 or UTF-32 (depending on OS) character string of up to 4.2 gigabytes in length. Note that a null-terminal character is required.
WCLOB A variable-length UTF-16 or UTF-32 (depending on OS) character string of up to 4.2 gigabytes in length. Note that a null-terminal character is required.
BINARY(length) A fixed-length binary (uint8_t) array of length number of bytes.
VARBINARY(length) A variable-length binary (uint8_t) array
LONG VARBINARY A variable-length binary array consisting of up to 4.2 gigabytes in length.
BLOB A variable-length binary array consisting of up to 4.2 gigabytes in length.
BOOLEAN A boolean value can be set to true (1) or false (0).
TINYINT A signed, 8 bit integer value (int8_t).
SMALLINT A signed, 16 bit integer value (int16_t).
INTEGER | INT A signed, 32 bit integer value (int32_t).
BIGINT A signed, 64 bit integer value (int64_t).
REAL A 32 bit floating point number.
FLOAT,
DOUBLE [PRECISION]
A 64 bit floating point number.
DECIMAL [(precision_num [, scale_num)] A binary-coded decimal value. The precision specifies the maximum number of significant digits up to 32. The scale specifies the number of decimal places and must be less than or equal to precision. If not specified, scale is 0 and precision is 32.
DATE Date values are stored as a 32 bit unsigned integer that contains the number of elapsed days since Dec 31, 1 BCE (Jan 1, 1 CE = 1).
TIME Time values are stored as a 32 bit unsigned integer that contains the elapsed time since midnight.
TIMESTAMP Timestamp values are stored as the two 32 bit unsigned integer values described above for date and time.
GUID | UUID

Globally/Universally Unique Identifier value. A 128 bit value guaranteed to be globally / universally unique. The value is stored by RDM in the following structure:

typedef struct {
    uint32_t time_low;
    uint16_t time_mid;
    uint16_t time_hi_and_ver;
    uint8_t  clock_seq_hi_and_res;
    uint8_t  clock_seq_low;
    uint8_t  node[6];
} psp_uuid_t;

Values are represented as a hyphenated string of hexadecimal digits, for example: f81d4fae-7dec-11d0-a765-00a0c91e6bf6.