The var binary host variables
In the program,
the varying-length C structure, ifx_varlena_t, stores a binary
value for a var binary host variable. This data structure allows
you to transfer binary data without knowing the exact structure of
the internal format for the opaque data type. It provides a data buffer
to hold the data for the associated var binary host variable.
Important: The ifx_varlena_t structure is an opaque structure
to programs.
That is, you do not access its internal structure directly. The internal
structure of ifx_varlena_t might change in future releases.
Therefore, to create portable code, always use the accessor
functions for this structure to obtain and store values in the ifx_varlena_t structure.
For a list of these access
functions, see The lvarchar pointer and var binary library functions.
This section uses a varying-length opaque data type called image to
demonstrate how the var
binary host variable accesses an opaque data type. The image data
type encapsulates an image such as a JPEG, GIF, or PPM file. If the
image is less than 2 kilobytes, the data structure for the data type
stores the image directly. However, if the image is greater than 2
kilobytes, the data structure stores a reference (an LO-pointer structure)
to a smart large object that contains the image data. The following
figure shows the internal data structure for the image data
type in the database.
The following figure shows the CREATE TABLE statement
that creates a table called image_tab that has a column of
type image and an image identifier.
The following figure shows how to use a var binary host
variable to insert and select data in the image_col column
of the image_tab table (see Creating a column of the image
opaque data type).
For more information about the ifx_var_flag(), ifx_var_alloc(), ifx_var_setdata(), ifx_var_getdata(), and ifx_var_dealloc() functions, see The lvarchar pointer and var binary library functions.