The mi_lo_unlock() function

The mi_lo_unlock() releases a byte-range lock on a smart large object.

Syntax

mi_integer mi_lo_unlock(conn, LO_fd, offset, whence, nbytes)
   MI_CONNECTION *conn;
   MI_LO_FD LO_fd;
   mi_int8 *offset;
   mi_integer whence;
   mi_int8 *nbytes;
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 open smart large object whose bytes you want to unlock.
offset
A pointer to the eight-byte integer (mi_int8) that identifies the offset at which the unlock of the smart-large-object bytes begins.
whence
An integer value that identifies the starting LO seek position.
nbytes
A pointer to the eight-byte integer (mi_int8) that specifies the number of bytes to unlock. This value cannot exceed 2 GB.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_lo_unlock() function removes a byte-range lock on the open smart large object that LO_fd indicates. This unlock request applies to nbytes number of bytes beginning at the LO seek location that the whence and offset arguments specify.

When the mi_lo_unlock() function requests the release of a byte-range lock, the database server attempts to unlock a locked smart large object if it has a share-mode or update-mode lock. For exclusive locks, the database server does not permit the release of the lock until the end of the transaction.

Server only: The mi_lo_unlock() 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 Informix® DataBlade® API Programmer's Guide.

For more information about locks for smart large objects or on how to use byte-range locks, see the Informix® DataBlade® API Programmer's Guide.

Return values

MI_OK
The function was successful; the requested lock was successfully released.
MI_ERROR
The function was not successful; the requested lock cannot be released or the smart large object has not been opened for byte-range locking.