Skip to main content

String types

String types

Abstract

string types

Section

Description

CHAR

CHAR is a FairCom database field type containing a fixed-length, padded string value.

VARCHAR

VARCHAR is a FairCom database field type containing a variable-length string.

LVARCHAR

LVARCHAR is a FairCom database field type containing a variable-length string.

NCHAR

NCHAR is a FairCom database field type containing a fixed length UTF-16 string with padding.

NVARCHAR

NVARCHAR is a FairCom database field type containing a variable length UTF-16 string.

CHAR is a FairCom database field type containing a fixed length, padded string value, such as "my string". 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.

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.

CHAR's behavior in different APIs:
  • 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 0x00 character. 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 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.

VARCHAR's behavior in different APIs:
  • 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 stored as a variable-length sequence of bytes up to 2 gigabytes in length. Each LVARCHAR field in each record includes a 4-byte length header. The bytes are interpreted as UTF-8 encoded characters.

LVARCHAR's behavior in different APIs:
  • 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.

NVARCHAR is a variable length UTF-16 string. Its maximum length is specified when the field is created.

NVARCHAR's behavior in different APIs:
  • In FairCom's JSON DB API, an NVARCHAR value is represented as a JSON string.

  • In FairCom's SQL API, an NVARCHAR value is submitted and returned as a string - for example, 'hello'.

  • In FairCom's ISAM and CTDB APIs, an NVARCHAR value is submitted and returned as a sequence of UTF-16 characters.

NCHAR is a fixed length UTF-16 string with padding. Its fixed length is specified when the field is created.

NCHAR's behavior in different APIs:
  • In FairCom's JSON DB API, an NCHAR value s represented as a JSON string.

  • In FairCom's SQL API, an NCHAR value is submitted and returned as a string - for example, 'hello'.

  • In FairCom's ISAM and CTDB APIs, an NCHAR value is submitted and returned as a sequence of UTF-16 characters.