The ifx_lo_lock() function

The ifx_lo_lock() function allows you to lock an explicit range of bytes in a smart large object.

Syntax

mint ifx_lo_lock(LO_fd, offset, whence, range, lockmode)
   mint LO_fd;
   int8 *offset;
   mint whence;

   int8 *range;

   mint lockmode;
LO_fd
The LO-file descriptor for the smart large object in which to lock the range of bytes. For more information about an LO-file descriptor, see The LO file descriptor
offset
A pointer to the 8-byte integer (INT8) that specifies the offset within the smart large object at which the lock begins.
whence
A mint constant that specifies from what point the offset is calculated: the beginning of the smart large object, the current position within the smart large object, or the end of the smart large object.
range
A pointer to the 8-byte integer (INT8) that specifies the number of bytes to lock.
lockmode
The mode in which to lock the specified bytes. Set to LO_EXCLUSIVE_MODE for an exclusive lock or to LO_SHARED_MODE for a shared lock.

Usage

The ifx_lo_lock() function locks the number of bytes specified by range, beginning at the location specified by offset and whence, for the smart large object that LO_fd specifies. The ifx_lo_lock() function places the type of lock that lockmode specifies. If you specify ISSLOCK, ifx_lo_lock() places a shared lock on the byte range. If you specify ISXLOCK, ifx_lo_lock() places an exclusive lock on the byte range.

Before you call ifx_lo_lock(), you must obtain a valid LO-file descriptor by calling either ifx_lo_create() to create a new smart large object, or by calling ifx_lo_open() to open an existing smart large object.

The ifx_lo_lock() function uses the whence and offset arguments to determine the seek position, as follows:
  • The whence value identifies the position from which to start the seek.
    Valid values include the following constants, which the locator.h header file defines.
    Whence constant
    Starting seek position
    LO_SEEK_SET
    The start of the smart large object
    LO_SEEK_CUR
    The current seek position in the smart large object
    LO_SEEK_END
    The end of the smart large object
    • The offset argument identifies the offset, in bytes, from the starting seek position (that the whence argument specifies) at which to begin locking bytes.

In addition to locking nbytes, you can also lock bytes from a specified offset to the end of the large object, which you can specify as either the current end or the maximum end of the large object. You can use two integer constants (LO_CURRENT_END and LO_MAX_END) to denote these values. To use one of these values, first convert it to an int8 value and then use it for the nbytes argument.

Return codes

0
The function was successful
< 0
The function was unsuccessful. The value returned is the sqlcode, which is the number of the HCL OneDB™ error message.