The streamread() support function
On a target database server, the streamread() support function converts opaque-type data from its stream representation to its binary representation, which is stored in the target database.
mi_integer streamread(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 buffer into which the function is to copy the
binary representation of the opaque-type data.
The stream buffer is declared with the appropriate format for the binary representation of the opaque-type data. The passing mechanism for this buffer depends on the kind of opaque type, as Input support function for circle opaque type through Input support function for image opaque type show. Most buffers for opaque-type data are passed by reference to streamread() as double pointers.
The streamread() function returns the number of bytes read from the stream or MI_ERROR. This function can also return the errors that mi_stream_read() returns. To convert the individual fields of the opaque-type internal representation to their binary representation, streamwrite() can call the stream-read functions of the DataBlade® API (see Convert opaque-type data between stream and binary representations).
CREATE FUNCTION streamread(STREAM, OUT MyUdt)
RETURNS INTEGER
EXTERNAL NAME '/usr/local/udrs/stream/myudt.so(MyUdtStreamRead)'
LANGUAGE C;