Binary file import and export functions
The binary file import function transfers the binary representation of the opaque data type to a flat file. The C name of the binary file import function for each opaque data type is OpaqueImportBinary(). The binary file export function transfers the binary representation of the opaque data type from a flat file. The C name of the binary file export function for each opaque data type is OpaqueExportBinary().
BladeSmith generates complete C code for these functions.
The generated code
The HCL OneDB™ database server calls the binary file import function with an mi_impexpbin pointer containing the binary representation of an opaque type value, read from an external file. The function also receives an unused MI_FPARAM pointer.
The binary file import function translates the binary data in the mi_impexpbin structure into an instance of the opaque type and returns a pointer to the C structure containing the opaque data type. The BladeSmith-generated code allocates memory for the return structure and then calls DataBlade® API mi_get functions to retrieve a value for each member of the structure.
The HCL OneDB database server calls the binary file export function with a pointer to a C structure, which contains an instance of the opaque type, and an unused MI_FPARAM pointer. The function translates the opaque type value into a binary image and returns it in an mi_impexpbin structure. The HCL OneDB database server writes the returned binary value into external files.
The binary file export function calls mi_new_var() to allocate an mi_bitvarying variable and then calls an mi_put function for each element of the opaque structure to store the value.
Customize the code
Do not modify the generated code for the binary file import and export functions.
Smart large object considerations
If the opaque type includes large objects, the binary file import function calls Gen_LoadLOFromFile() to read the large object data from a file. The binary file export function calls Gen_StoreLOToFile() to save the smart large object in an external file.