Open Client has four character types, CS_CHAR, CS_LONGCHAR, CS_VARCHAR, and CS_UNICHAR:
CS_CHAR corresponds to the Adaptive Server types char and varchar. That is, Client-Library interprets both the server char and varchar types as CS_CHAR. For example, ct_describe returns CS_CHAR_TYPE when describing a result column that has the server datatype varchar.
CS_CHAR is defined as:
typedef char CS_CHAR;
WARNING! CS_LONGCHAR and CS_VARCHAR do not correspond to any Adaptive Server datatypes. Specifically, CS_VARCHAR does not correspond to the Adaptive Server datatype varchar.
CS_LONGCHAR does not correspond to any Adaptive Server type, but some Open Server applications support CS_LONGCHAR. An application uses the CS_DATA_LCHAR capability to determine whether an Open Server connection supports CS_LONGCHAR. If it does, then ct_describe returns CS_LONGCHAR when describing a result data item.
A CS_LONGCHAR value has a maximum length of 2,147,483,647 bytes. CS_LONGCHAR is defined as:
typedef unsigned char CS_LONGCHAR;
CS_VARCHAR does not correspond to any Adaptive Server type. For this reason, Open Client routines do not return CS_VARCHAR_TYPE. CS_VARCHAR is provided to enable non-C programming language veneers to be written for Open Client. Typical client applications will not use CS_VARCHAR.
CS_VARCHAR is defined as:
typedef struct _cs_varchar
{
CS_SMALLINT len;
CS_CHAR str[CS_MAX_CHAR];
} CS_VARCHAR;
where:
len is the length of the string.
str is the string itself. Note that str is not null-terminated.
Although CS_VARCHAR variables are used to store variable-length values, CS_VARCHAR is considered to be a fixed-length type. This means that an application does not typically need to provide Client-Library with the length of a CS_VARCHAR variable. For example, ct_bind ignores the value of datafmt−>maxlength when binding to a CS_VARCHAR variable.
CS_UNICHAR corresponds to the Adaptive Server 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 two-byte Unicode UTF-16 format.
CS_UNICHAR is defined as follows:
typedef unsigned char CS_UNICHAR;