Fixed binary host variables
Your IBM® Informix® ESQL/C program must handle all manipulation of the internal data structure for the fixed binary host variable; it must explicitly allocate memory and assign field values.
The following figure shows how to use a fixed binary host
variable to insert and select data in the circle_col column
of the circle_tab table (see Figure 4).
Figure 1. Accessing the
internal format of the circle opaque data type with a fixed binary
host variable
/* Include declaration for circle_t structure */
#include <circle.h>;
EXEC SQL BEGIN DECLARE SECTION;
fixed binary 'circle' circle_t fbin_circle;
EXEC SQL END DECLARE SECTION;
/* Assign data to members of internal data structure */
fbin_circle.center.x = 1.00;
fbin_circle.center.y = 17.00;
fbin_circle.radius = 15.25;
/* Insert a new circle_tab row with a fixed binary host
* variable */
EXEC SQL insert into circle_tab values (:fbin_circle);
/* Select a circle_tab row from into a fixed binary
* host variable */
EXEC SQL select circle_col into :fbin_circle
from circle_tab
where radius(circle_col) = 15.25;
if ((fbin_circle.center.x == 1.00) &&
(fbin_circle.center.y == 17.00))
printf("coordinates = (%d, %d)\n",
fbin_circle.center.x, fbin_circle.center.y);