Handle the internal representation
If a client application that uses an opaque data type executes on a different computer than the database server, the computers involved might have different ways of representing the internal structure of the opaque type. For example, the client computer might use a different byte ordering than the database server computer.
You must supply send and receive support functions, sometimes called transport functions, that convert data between the client application and the database server, commonly called receive and send functions.
You can choose arbitrary names for these support functions. The cast functions that use the functions identify the support functions to the database server.
- The receive function converts incoming data to the internal representation of the local database server.
- The send function converts outgoing data from the internal representation of the local database server to an appropriate representation for the client application or the external database.
The send and receive functions should be reciprocal functions; that is, the receive function should produce a value that the send function accepts as an argument and the send function should produce a value that the receive function accepts as an argument.
The functions must handle conversions for all platform variations that the client application or external database server might encounter. When the local database server accepts a client connection or connects to a remote database server, it receives a description of the internal representations that the client or the remote database server uses. The database server uses this description to determine which data representation to use in its receive and send support functions.
The Informix® DataBlade® API provides functions that support conversion between different internal representations of opaque types. The send and receive functions can call DataBlade® API routines for each member of the internal structure to convert them to the appropriate representation for the destination platform.
For an opaque data type to accept an internal representation on nondefault locales, you must use the Informix® GLS API in the receive and send functions to access Informix® locales from within these functions. For more information, see Handle locale-sensitive data (GLS).