string and binary parameters

string parameters are passed in a CS_STRING_HOLDER structure. binary parameters are passed in a CS_BINARY_HOLDER structure. These structures are defined in jagpublic.h as follows:

typedef struct _cs_longchar_holder
{
        CS_LONGCHAR *value;
        CS_INT length;
} CS_STRING_HOLDER;

typedef struct _cs_longbinary_holder
{
        CS_LONGBINARY *value;
        CS_INT length;
} CS_BINARY_HOLDER;

#define CS_LONGCHAR_HOLDER    CS_STRING_HOLDER
#define CS_LONGBINARY_HOLDER  CS_BINARY_HOLDER

To allow backward compatibility with code that was written for EAServer version 1.1, you can use CS_LONGCHAR_HOLDER in place of CS_STRING_HOLDER, and CS_LONGBINARY_HOLDER in place of CS_BINARY_HOLDER.

On input, the value field contains the input value and the length field specifies the input length. For output, you can set a new value and length in the structure as follows:

The following example calls the JagFree and JagAlloc routines to reallocate a larger value buffer:

JagFree(myholder->value);
myholder->value = JagAlloc(new_length);
if (myholder->value == NULL)
{
    JagLog(JAG_TRUE, “Out of memory!\n”);
    return CS_FAIL;
}
memcpy(myholder->value, new_value, new_length);
myholder->length = new_length;