The mi_lo_seek() function

The mi_lo_seek() function sets the LO seek position for the next read or write operation on an open smart large object.

Syntax

mi_integer mi_lo_seek(conn, LO_fd, offset, whence, seek_pos)
   MI_CONNECTION *conn;
   MI_LO_FD LO_fd;
   mi_int8 *offset;
   mi_integer whence;
   mi_int8 *seek_pos;
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 whose seek position you want to change. A previous call to mi_lo_open() obtains this descriptor.
offset
A pointer to the eight-byte integer (mi_int8) offset from the specified whence seek position.
whence
This value determines how the offset value is interpreted.
seek_pos
A pointer to the eight-byte integer (mi_int8) that identifies the new LO seek position.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_lo_seek() function uses the whence and offset arguments to determine the new LO seek position of the smart large object that LO_hdl identifies, as follows:
  • The whence argument identifies the position from which to start the seek operation.
    Valid values include the following whence constants.
    Whence constant
    Starting 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, from the starting seek position (which the whence argument specifies) at which to begin the seek.

    This offset value can be negative for all values of whence. For more information about how to access eight-bit (INT8) integers, see the HCL OneDB™ DataBlade® API Programmer's Guide.

The mi_lo_seek() function returns the new seek position in the mi_int8 seek_pos variable.

Server only: The mi_lo_seek() 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.

To obtain the current seek position, use the mi_lo_tell() function.

Return values

MI_OK
The function was successful.
MI_ERROR
The function was not successful.