To handle opaque-type data in its internal unload representation,
the database server calls the importbin and exportbin support functions
of the opaque type. The internal unload representation is the binary
version of the opaque-type data when it is in a copy file. Usually,
the internal unload and server internal representations of an opaque
type are the same.
When a bulk-copy utility sends or receives opaque-type data in
its internal unload representation, the database server must find
a support function to handle the possibility that the client computer
uses a different byte ordering than the server computer. The importbin
and exportbin support functions are the cast functions for an opaque
type between its internal (binary) unload representation (its binary
format in a copy file) and its server internal (binary) representation.
Important: An opaque data type only requires importbin and exportbin
support functions if its internal unload representation is different
from its server internal representation (which the send and receive
support functions handle). For most opaque data types, the database
server can use the send and receive support functions for importbin
and exportbin, respectively, to handle bulk copies of the opaque-type
columns to and from their binary representation.
The database server stores the internal unload representation of
an opaque type in an mi_impexpbin structure, which is a varying-length
structure. Its ability to store varying-length data enables it to
handle any possible changes in the size of the opaque-type data when
it is converted between these two internal representations. For example,
the client and server computers might have different packing rules
for structures.
Because the
mi_impexpbin data type is a varying-length structure
(like
mi_lvarchar), it is
always passed by reference.
Therefore, the importbin and exportbin support routines have the following
basic signatures.
Opaque-type support function |
Cast from |
Cast to |
importbin |
mi_impexpbin * |
Server internal representation of the opaque data
type |
exportbin |
Server internal representation of the opaque data
type |
mi_impexpbin * |