Home | Previous Page | Next Page   Function Descriptions >

mi_lo_writewithseek( )

The mi_lo_writewithseek( ) function performs a seek operation and then writes a specified number of bytes of data to an open smart large object.

Syntax

mi_integer mi_lo_writewithseek(conn, LO_fd, buf, nbytes, offset, whence)
   MI_CONNECTION *conn;
   MI_LO_FD LO_fd;
   const char *buf;
   mi_integer nbytes;
   mi_int8 *offset;
   mi_integer whence;
conn
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_fd
is an LO file descriptor for the smart large object to which to write.
buf
is a pointer to a user-allocated character buffer of at least nbytes bytes that contains the data to be written to the smart large object.
nbytes
is the number of bytes to write to the smart large object. This value cannot exceed two gigabytes.
offset
is a pointer to the eight-byte integer (mi_int8) offset from the starting LO seek position.
whence
is an integer value that identifies the starting LO seek position.
Valid in Client LIBMI Application? Valid in User-Defined Routine?
Yes Yes

Usage

The mi_lo_writewithseek( ) function writes nbytes of data to the smart large object that the LO_fd file descriptor identifies. The function obtains the data to write from the user-allocated buffer that buf references. The buffer must be less than two gigabytes in size.

The write begins at the LO seek position of LO_fd that the offset and whence arguments indicate, as follows:

Tip:
The mi_lo_writewithseek( ) function is useful in client LIBMI applications because it reduces the number of round trips between the client application and the database server.

If the database server writes less than nbytes of data to the smart large object, mi_lo_writewithseek( ) returns the number of bytes that it wrote and raises an exception. This condition can occur when the sbspace runs out of space.

Server Only

The mi_lo_writewithseek( ) 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 on the advantages of a NULL connection, see the IBM Informix: DataBlade API Programmer's Guide.

End of Server Only

Return Values

>=0
is the number of bytes that the function wrote from the buf character buffer to open the smart large object.
MI_ERROR
indicates that the function was not successful.

Related Topics

See also the descriptions of mi_lo_readwithseek( ), mi_lo_seek( ), and mi_lo_write( ).

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]