Open Server has four character types, CS_CHAR, CS_LONGCHAR, CS_VARCHAR, and CS_UNICHAR:
CS_CHAR corresponds to the Adaptive Server Enterprise datatypes char and varchar. That is, Server-Library interprets both the server char and varchar datatypes as CS_CHAR. For example, srv_descfmt returns CS_CHAR_TYPE when retrieving the description of a character parameter from a client.
CS_CHAR is defined as follows:
typedef char CS_CHAR;
CS_LONGCHAR does not correspond to any Adaptive Server Enterprise datatype, but some Client-Library applications may support CS_LONGCHAR. An application can use the CS_DATA_LCHAR capability to determine whether a Client-Library connection supports CS_LONGCHAR.
A CS_LONGCHAR value supports a maximum length of 2,147,483,647 bytes. CS_LONGCHAR is defined as follows:
typedef unsigned char CS_LONGCHAR;
CS_VARCHAR does not correspond to any Adaptive Server Enterprise datatype. For this reason, Open Server routines do not return CS_VARCHAR_TYPE. If a datatype is described as CS_VARCHAR_TYPE, Open Server automatically converts it to a nullable CS_CHAR_TYPE before sending it to a client. CS_VARCHAR_TYPE can only be used when binding program variables. CS_VARCHAR enables programmers to write non-C programming language veneers for Open Server. Typical server applications will not use CS_VARCHAR.
CS_VARCHAR is defined as follows:
typedef struct _cs_varchar
{
CS_SMALLINT len;
CS_BYTE str[CS_MAX_CHAR];
} CS_VARCHAR;
where:
len is the length of the string.
str is the string itself. Note that str is not a null-terminated string.
CS_UNICHAR corresponds to the Adaptive Server Enterprise unichar fixed-width and univarchar variable-width datatypes. CS_UNICHAR is a shared, C-programming datatype that can be used anywhere the CS_CHAR datatype is used. The CS_UNICHAR datatype stores character data in the 2-byte Unicode UTF-16 format.
CS_UNICHAR is defined as follows:
typedef unsigned char CS_UNICHAR;