Using byte-range locks

By default, the database server places a lock on the smart large object. Instead, you can enable byte-range locking.

To use byte-range locks, you must perform one of the following actions:
  • To set byte-range locking for the sbspace that stores the smart large object, use the onspaces utility. The following example sets byte-range locking for the new sbspace:
    onspaces -c -S slo -g 2 -p /ix/9.2/liz/slo -o 0 -s 1000
       -Df LOCK_MODE=RANGE

    When you set the default locking mode for the sbspace to byte-range locking, the database server locks only the necessary bytes when it updates any smart large objects stored in the sbspace.

  • To set byte-range locking for the smart large object when you open it, use one of the following methods:
    • In DB-Access: Set the MI_LO_LOCKRANGE flag in the mi_lo_open() DataBlade® API function.
    • In ESQL/C: Set the LO_LOCKRANGE flag in the ifx_lo_open() function. When you set byte-range locking for the individual smart large object, the database server implicitly locks only the necessary bytes when it selects or updates the smart large object.
  • To lock a byte range explicitly, use one of the following functions:
    • For DB-Access:mi_lo_lock()
    • For ESQL/C:ifx_lo_lock()

      These functions lock the range of bytes that you specify for the smart large object. If you specify an exclusive lock with either function, UPDATE statements do not place locks on the smart large object if they update the locked bytes.

      The database server releases exclusive byte-range locks placed with mi_lo_lock() or ifx_lo_lock() at the end of the transaction. The database server releases shared byte-range locks placed with mi_lo_lock() or ifx_lo_lock() based on the same rules as locks placed with SELECT statements, depending upon the isolation level. You can also release shared byte-range locks with one of the following functions:

    • For DB-Access:mi_lo_unlock(). For more information about the DataBlade API functions, see the HCL OneDB™ DataBlade API Programmer's Guide.
    • For ESQL/C:ifx_lo_unlock(). For more information about functions, see the HCL OneDB ESQL/C Programmer's Manual.