The mi_lo_from_buffer() function

The mi_lo_from_buffer() function copies a specified number of bytes from a user-defined buffer to an existing smart large object.

Syntax

mi_integer mi_lo_from_buffer(conn, LO_hdl, size, buffer)
   MI_CONNECTION *conn;
   MI_LO_HANDLE *LO_hdl;
   mi_integer size;
   char *buffer;
conn
This value is one of the following connection values:

A pointer to a connection descriptor established by a previous call to mi_open(), mi_server_connect(), or mi_server_reconnect().

A NULL-valued pointer (database server only)

LO_hdl
The LO handle for the smart large object into which you want to copy the buffer data.
size
An integer that identifies the number of bytes to copy to the smart large object.
buffer
A pointer to a user-defined buffer from which you want to copy the data.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_lo_from_buffer() function copies up to size bytes from the user-defined buffer into a smart large object that the LO_hdl LO handle references. The write operation to the smart large object starts at a zero-byte offset. This function allows you to write data to a smart large object without opening the smart large object. To use the mi_lo_from_buffer() function to copy data, the smart large object must already exist in an sbspace.

Server only: The mi_lo_from_buffer() function does not need a connection descriptor to execute. If your UDR does not need a valid connection for other operations, you can specify a NULL-valued pointer for the conn parameter to establish a NULL connection. For information about the advantages of a NULL connection, see the HCL OneDB™ DataBlade® API Programmer's Guide.

Return values

>=0
The number of bytes copied from the user-defined buffer to the smart large object. This value must always be equal to the size value.
MI_ERROR
The function was not successful.