Convert opaque-type data between stream and binary representations

The DataBlade® API provides several functions to convert built-in data types between binary and stream representations. The streamwrite() and streamread() support functions can use these DataBlade API functions to convert a UDT between its binary representation and its stream representation.

Important: Writing a collection or row to a stream opened for Enterprise Replication is not supported. Likewise, reading a collection or row from a stream opened for Enterprise Replication is not supported.
The following tables show stream-conversion functions of the DataBlade API.
Table 1. DataBlade API stream-conversion functions for byte data
Type of data The streamwrite() support function The streamread() support function
Byte data mi_stream_write() mi_stream_read()
Table 2. DataBlade API stream-conversion functions for date and date/time data
Type of data The streamwrite() support function The streamread() support function
DATE data mi_streamwrite_date() mi_streamread_date()
DATETIME data mi_streamwrite_datetime() mi_streamread_datetime()
INTERVAL data mi_streamwrite_interval() mi_streamread_interval()
Table 3. DataBlade API stream-conversion functions for integer data
Type of data The streamwrite() support function The streamread() support function
SMALLINT data (two-byte integers) mi_streamwrite_smallint() mi_streamread_smallint()
INTEGER data (four-byte integers) mi_streamwrite_integer() mi_streamread_integer()
INT8 data (eight-byte integers) mi_streamwrite_int8() mi_streamread_int8()
Table 4. DataBlade API stream-conversion functions for fixed-point and floating-point data
Type of data The streamwrite() support function The streamread() support function
DECIMAL data (fixed- and floating-point) mi_streamwrite_decimal() mi_streamread_decimal()
MONEY data mi_streamwrite_money() mi_streamread_money()
SMALLFLOAT data mi_streamwrite_real() mi_streamread_real()
FLOAT data mi_streamwrite_double() mi_streamread_double()
Table 5. DataBlade API stream-conversion functions for other data
Type of data The streamwrite() support function The streamread() support function
Character data mi_streamwrite_string() mi_streamread_string()
Smart large objects mi_streamwrite_lo() mi_streamread_lo() mi_streamread_lo_by_lofd()
Boolean data mi_streamwrite_boolean() mi_streamread_boolean()
Collection structures mi_streamwrite_collection() mi_streamread_collection()
Row structures mi_streamwrite_row() mi_streamread_row()
Varying-length structures mi_streamwrite_lvarchar() mi_streamread_lvarchar()
The DataBlade API function converts the corresponding data type to a machine-independent stream representation.
Important: The mistrmutil.h header file declares the stream-conversion functions of the DataBlade API; however, the mi.h header file does not include mistrmutil.h. You must explicitly include mistrmutil.h in files that use these stream-conversion functions.