Smart-large-object locks

When you open a smart large object the database server locks either the entire smart large object or a range of bytes that you specify to prevent simultaneous access to smart-large-object data, Locks on smart large objects are different from row locks. If you retrieve a smart large object from a row, the database server might hold a row lock as well as a smart-large-object lock. The database server locks smart-large-object data because many columns can contain the same smart-large-object data. You use the access-mode flags, LO_RDONLY, LO_DIRTY_READ, LO_APPEND, LO_WRONLY, LO_RDWR, and LO_TRUNC to specify the lock mode of a smart large object. You pass these flags to the ifx_lo_open() and ifx_lo_create() functions. When you specify LO_RDONLY, the database server places a share lock on the smart large object. When you specify LO_DIRTY_READ, the database server does not place a lock on the smart large object. If you specify any other access-mode flag, the database server obtains an update lock, which it promotes to an exclusive lock on first write or other update operation.

Share and update locks (read-only mode, or write mode before an update operation occurs) are held until your program takes one of the following actions:
  • Closes the smart large object
  • Commits the transaction or rolls it back
Exclusive locks are held until the end of a transaction even if you close the smart large object.
Important: You lose the lock at the end of a transaction, even if the smart large object remains open. When the database server detects that a smart large object has no active lock, it automatically obtains a new lock when the first access occurs to the smart large object. The lock it obtains is based on the original open mode of the smart large object.