The mi_lo_writewithseek() function
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
- 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_fd
- An LO file descriptor for the smart large object to which to write.
- buf
- 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
- The number of bytes to write to the smart large object. This value cannot exceed 2 GB.
- offset
- A pointer to the eight-byte integer (mi_int8) offset from the starting LO seek position.
- whence
- 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 2 GB in size.
- The whence argument identifies the position from which
to start the seek operation: Valid values include the following whence constants.
- Whence constant
- Starting LO seek position
- MI_LO_SEEK_SET
- The start of the smart large object
- MI_LO_SEEK_CUR
- The current LO seek position in the smart large object
- MI_LO_SEEK_END
- The end of the smart large object
- The offset argument identifies the offset, in bytes, relative
to the starting seek position (which the whence argument specifies)
at which to begin the write operation.
This offset value can be negative for all values of whence. For more information about how to access eight-bit (INT8) integers, see the Informix® DataBlade® API Programmer's Guide.
- The offset argument identifies the offset, in bytes, relative
to the starting seek position (which the whence argument specifies)
at which to begin the write operation.
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.
Return values
- >=0
- The number of bytes that the function wrote from the buf character buffer, the open smart large object.
- MI_ERROR
- The function was not successful.