Open Server has three character types, CS_CHAR, CS_LONGCHAR, and CS_VARCHAR:
CS_CHAR corresponds to the Adaptive Server 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 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 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.