Access the internal format of an opaque type
You can access the internal or binary format of an opaque data
type with the host
variable in two ways:
- Use the fixed binary data type to access a fixed-length
opaque data type for which you have the C-language data structure
that represents the opaque data type.
A fixed-length opaque data type has a predefined size for its data. This size is equal to the size of the internal data structure for the opaque data type.
- Use the var binary data type to access a varying-length
opaque data type or to access a fixed-length opaque data type
for which you do not have the C-language data structure.
A varying-length data type holds data whose size might vary from row to row or instance to instance.
Both the fixed binary and var binary data types have
a one-to-one mapping between their declaration and the internal data
structure of the opaque data type. The database server invokes the
following support functions of the opaque data type when the application
transfers data in the fixed binary or var binary host
variables:
- The receive support function describes how to transfer the opaque-type
data from the fixed binary or var binary host variable
into the opaque-type column.
The database server invokes the receive support function for operations such as INSERT and UPDATE statements that send the internal format of an opaque type to the database server.
- The send support function describes how to transfer the opaque-type
data from the opaque-type column to the fixed binary or var
binary host variable.
The database server invokes the send support function for operations such as SELECT and FETCH statements that send the internal format of an opaque type to the client application.