String types
String types
Section | Description |
|---|---|
CHAR is a FairCom database field type containing a fixed-length, padded string value up to 65,500 bytes. It is useful for small strings that vary little in length. | |
VARCHAR is a FairCom database field type containing a variable-length string up to 65,500 bytes. It is useful for medium-sized strings that vary in length. | |
LVARCHAR is a FairCom database field type that can hold a variable-length string up to 2 gigabytes. It is useful for very large strings that vary greatly in length. |
String types for the JSON DB API
CHAR is a FairCom database field type containing a fixed-length, padded string value, such as "my string". It is useful for small strings that vary little in length.
It is stored in a record as a series of UTF-8 characters. It has a fixed length between 1 and 65,500 bytes, which is stored once in the table's header. If a value is smaller than its fixed length, the server uses padding to fill in missing bytes at the end. You must specify the fixed length of the field when you create it.
Because CHAR is a fixed-length string, storing a string smaller than the specified field length causes the server to modify the string value by padding the string up to the full length of the field. By default, the server pads the string with the NULL character 0x00 or the byte value specified in the "padValue" property.
In FairCom's JSON DB API, SQL, and CTDB APIs, a CHAR value is represented as a string.
The string includes characters up to but not including the first
NULL 0x00character. This makes a fixed-length string appear to work the same as a variable-length string, but when stored in the FairCom database, a CHAR field is padded so that it occupies the user-defined fixed-length of the field.In FairCom's ISAM and CTDB APIs, an LVARCHAR value is submitted and returned as a sequence of UTF-8 characters.
VARCHAR is a FairCom database field type containing a variable-length string, such as "my string". It is useful for medium-sized strings that vary in length.
It is stored in a record as a variable-length sequence of UTF-8 characters with a user-specified maximum length of up to 65,500 bytes. You must specify the field's maximum length when you create it.
Each VARCHAR field in each record contains a 2-byte header that defines the stored length of the string.
In FairCom's JSON DB API, a VARCHAR value is represented as a JSON string.
In FairCom's SQL API, a VARCHAR value is submitted and returned as a string — for example,
'hello'.In FairCom's ISAM and CTDB APIs, a VARCHAR value is submitted and returned as a sequence of UTF-8 characters.
LVARCHAR is a FairCom database field type containing a variable-length string, such as "my string". It is useful for very large strings that vary greatly in length.
It is stored as a variable-length sequence of bytes up to 2 gigabytes. Each LVARCHAR field in each record includes a 4-byte length header. The bytes are interpreted as UTF-8 encoded characters.
In FairCom's JSON DB API, an LVARCHAR value is represented as a JSON string.
In FairCom's SQL API, an LVARCHAR value is submitted and returned as a string — for example,
'hello'.In FairCom's ISAM and CTDB APIs, an LVARCHAR value is submitted and returned as a sequence of UTF-8 characters.