Open Client has three binary types, CS_BINARY, CS_LONGBINARY, and CS_VARBINARY.
CS_BINARY corresponds to the Adaptive Server types binary and varbinary. That is, Client-Library interprets both the server binary and varbinary types as CS_BINARY. For example, ct_describe returns CS_BINARY_TYPE when describing a result column that has the server datatype varbinary.
CS_BINARY is defined as:
typedef unsigned char CS_BINARY;
WARNING! CS_LONGBINARY and CS_VARBINARY do not correspond to any SQL Server datatypes.
Some Open Server applications may support CS_LONGBINARY. An application uses the CS_DATA_LBIN capability to determine whether an Open Server connection supports CS_LONGBINARY. If it does, then ct_describe returns CS_LONGBINARY when describing a result data item.
A CS_LONGBINARY value has a maximum length of 2,147,483,647 bytes. CS_LONGBINARY is defined as:
typedef unsigned char CS_LONGBINARY;
CS_VARBINARY does not correspond to any SQL Server type. For this reason, Open Client routines do not return CS_VARBINARY_TYPE. CS_VARBINARY is provided to enable non-C programming language veneers to be written for Open Client. Typical client applications will not use CS_VARBINARY.
CS_VARBINARY is defined as:
typedef struct _cs_varybin
{
CS_SMALLINT len;
CS_BYTE array[CS_MAX_CHAR];
} CS_VARBINARY;
where:
len is the length of the binary array.
array is the array itself.
Although CS_VARBINARY variables are used to store variable-length values, CS_VARBINARY 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_VARBINARY variable. For example, ct_bind ignores the value of datafmt−>maxlength when binding to a CS_VARBINARY variable.