The streamwrite() support function
On a destination database server, the streamwrite() support function converts opaque-type data from its binary representation to its stream representation.
mi_integer streamwrite(strm_desc, binary_rep)
MI_STREAM *strm_desc;
my_opq_type *binary_rep;
- strm_desc
- A pointer to a stream descriptor for an open stream. For more information, see Access to a stream (Server).
- binary_rep
- A pointer to the binary representation of the opaque-type data,
which is written to the stream.
The binary representation is the appropriate format for the opaque-type data. The passing mechanism for this data depends on the kind of opaque type, as Figure 1 through Figure 3 show. Most opaque-type values are passed by reference to the streamwrite() function as single pointers.
The streamwrite() function returns the number of bytes written to the stream or MI_ERROR. This function can also return the errors that mi_stream_write() returns. To convert the individual fields of the opaque-type internal representation to their stream representation, streamwrite() can call the stream-write functions of the DataBlade API (see Convert opaque-type data between stream and binary representations).
CREATE FUNCTION streamwrite(STREAM, MyUdt)
RETURNS INTEGER
EXTERNAL NAME '/usr/local/udrs/stream/myudt.so(MyUdtStreamWrite)'
LANGUAGE C;