The mi_streamread_collection() function

The mi_streamread_collection() function reads a collection structure (LIST, SET, MULTISET) from a stream, converting any difference in the stream representation to that of the internal representation.

Syntax

mi_integer mi_streamread_collection(strm_desc, coll_dptr)
   MI_STREAM *strm_desc;
   MI_COLLECTION **coll_ptr;
strm_desc
A pointer to the stream descriptor for the open stream from which to read the collection structure (MI_COLLECTION).
coll_dptr
A pointer to the buffer into which to copy the address of the collection structure.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes
Important: Enterprise Replication does not support this function.

Usage

The mi_streamread_collection() function reads a collection from the stream that strm_desc references. The function reads the collection structure from the stream and puts its address in the buffer that coll_dptr references. The read operation begins at the current stream seek position. You can use mi_stream_tell() or mi_stream_getpos() to obtain this seek position.

The mi_streamread_collection() function is a constructor function for a collection structure. It allocates memory for the collection structure in the current memory duration.

This function is useful in a streamread() support function of an opaque data type that contains a collection structure (MI_COLLECTION).
Important: The mi_streamread_collection() function requires the caller to have an open connection to the database server.

For more information about the use of mi_streamread_collection() in a streamread() support function, see the HCL OneDB™ DataBlade® API Programmer's Guide.

Return values

>=0
The number of bytes that the function has read from the open stream to the value that coll_dptr references.
MI_STREAM_EEOF
The end of the stream has been reached without any errors.
MI_STREAM_EBADARG
The stream descriptor that strm_desc references or the value that coll_dptr references is invalid.
MI_ERROR
The function was not successful.