Insert from a fixed binary host variable

To insert the data that a fixed binary host variable contains into an opaque-type column, the code fragment in Accessing the internal format of the circle opaque data type with a fixed binary host variable takes the following steps:
  1. Includes the definition of the internal structure of the circle opaque data type.

    The definition of the circle_t internal data structure, which Internal data structures for the circle opaque data type shows, must be available to your program. Therefore, the code fragment includes the circle.h header file, which contains the definition of the circle_t structure.

  2. Stores the data for the fixed binary host variable into the internal data structure, circle_t.

    The declaration of the fixed binary host variable associates the circle_t internal data structure with the fbin_circle host variable. The code fragment assigns a value to each member of the circle_t data structure.

  3. Inserts the data that the fbin_circle host variable contains into the circle_col opaque-type column.

    When the database server executes the INSERT statement, it calls the receive support function for the circle data type (circle_rcv) to perform any translation necessary between the internal format of the data that the client application has sent (circle_t) and the internal format of the circle data type on disk.

To insert a null value into an opaque-type column with a fixed binary host variable, set an indicator variable to -1. The following code fragment inserts a null value into the circle_col column with the fbin_circle host variable:
#include <circle.h>;

EXEC SQL BEGIN DECLARE SECTION;
   fixed binary 'circle' circle_t fbin_circle;
   int circle_ind;
EXEC SQL END DECLARE SECTION;
⋮

circle_ind = -1;
EXEC SQL insert into circle_tab 
   values (:fbin_circle:circle_ind);