2. Embedded SQL for C : C Variables and Data Types : Variable and Type Declarations : Varying Length Binary Type
 
Share this page                  
Varying Length Binary Type
The Ingres data type varbyte behaves just like varchar except that it bypasses character set translation when transmitted across Heterogeneous Ingres/Net.
A special varbyte structure type exists, which behaves exactly like the varchar structure type except that the associated internal data type is varbyte instead of varchar. Typedefs and struct tag declarations are supported in exactly the same way as for varchar.
Note that when a retrieved byte value does not fit into the embedded variable provided it will be truncated and a "Warning - string data, right truncation" condition is set via SQLSTATE and sqlca.sqlwarn1. This is identical to the handling of string truncation for character data.
Note:   
The word varbyte is reserved and can be in uppercase or lowercase.
The varbyte keyword is not generated to the output C file.
The varbyte storage class can only refer to a variable declaration, not to a type declaration. For example, the following declaration is legal because it declares the variable vbyt:
varbyte struct {
        short buf_size;
        char buf[100];
    } vbyt;
But the varbyte declaration of the structure tag vbyt (without a variable) is not legal and generates an error:
varbyte struct vbyt {
        short buf_size;
        char buf[100];
    };
You can replace the structure definition of a varbyte variable declaration by a structure tag or typedef reference.
Example: Legal typedef and varbyte declarations
typedef struct vbyt_ {
        short vbyt_count;
        char vbyt_data[VCH_MAX];
    } VBYT;
    varbyte VBYT vbyt 1; /* Typedef referenced */
    varbyte struct vbyt_ vch_2; /* Structure tag */
                                /* referenced */
You can use the varbyte storage class for any type of variable declaration, including external and static variables, and to qualify nested structure members.
Example: Legal declarations
static varbyte struct _txt {
           short tx_len;
           char tx_data[TX_MAX];
    } txt_var, *txt_ptr, txt_arr[10];
    struct v_ {
            short length;
            char data[MAXLEN];
    };
    VARBYTE struct v_ my_varbyte;
       typedef short buf_size;
       typedef char buf[512];
       varbyte struct {
             buf_size len;
             buf data;
    } vbyte;