The importbinary and exportbinary support functions perform any tasks needed to process the external binary representation of an opaque type for a bulk copy, as follows:
These support functions do not have to be named importbinary and exportbinary, but they do have to perform the specified conversions. They should be reciprocal functions; that is, the importbinary function should produce a value that the exportbinary function accepts as an argument and conversely. The IBM Informix DataBlade API provides functions that support conversion between different internal representations of opaque types.
For opaque data types that have identical external and internal representations, the import and importbinary support functions can be the same function. Similarly, the export and exportbinary support functions can be the same function.
SQL statements support an internal data type called IMPEXPBIN to hold the external binary representation of an opaque data type for a bulk copy. The IMPEXPBIN data type allows for any possible change in the size of the data when it is converted between the two representations. The importbinary and exportbinary support functions serve as cast functions between the IMPEXPBIN and opaque data type.
The importbinary support function takes as an argument a structure that holds the bulk-copy format of the external binary format of the opaque type and returns the internal structure for the opaque type.
Any files that the import function reads must reside on the database server computer. If you do not provide an importbinary support function, the database server imports the binary data in the database server internal representation of the opaque data type.
The following function signature is for an importbinary support function of an opaque data type whose internal structure is ll_longlong_t:
ll_longlong_t * ll_longlong_importbin(mi_impexpbin *client_intrnl_bcopy_format);
The ll_longlong_importbin() function is a cast function from the IMPEXPBIN data type to the ll_longlong_t internal structure. It must be registered as an implicit cast function with the CREATE IMPLICIT CAST statement. For more information, see Creating Casts for Opaque Data Types.
The exportbinary support function takes as an argument the internal structure for the opaque type and returns a structure that holds the bulk-copy format of the external binary representation of the opaque type.
If you do not provide an exportbinary support function, the database server exports the binary data in the external binary representation of the opaque data type.
The following function signature is for an exportbinary support function of an opaque data type whose internal structure is ll_longlong_t:
mi_impexpbin * ll_longlong_exportbin(ll_longlong_t *srvr_intrnl_bopy_format);
The ll_longlong_exportbin() function is a cast function from the ll_longlong_t internal structure to the IMPEXPBIN data type. It must be registered as an explicit cast function with the CREATE EXPLICIT CAST statement. For more information, see Creating Casts for Opaque Data Types.