Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Record Locking

Record locking requirements are the same with and without transaction processing. Records to be updated or deleted should be locked. Use of ctCHECKLOCK as a file mode will ensure that no updates are performed without locks.

Begin

When you invoke Begin() you can OR the constants ctENABLE or ctREADREC into the transaction mode. If you want the locks to block when they are not available, also OR ctLK_BLOCK into the transaction mode. This automatically invokes LockISAM(), so all ISAM update functions automatically lock records. During the transaction, you can modify the ISAM lock mode by further calls to LockISAM().

Low-level functions still require explicit record locks with LockCtData().

Commit

At the end of the transaction you have different options in the Commit() call:

  • You can use a mode of ctFREE to free all locks, both ISAM and low-level locks, automatically (all locks initiated before or during the transaction).
  • You can use a mode of ctKEEP to hold onto all current record locks.
  • Use ctKEEP_OUT to release only locks obtained during the transaction or on records altered during the transaction, keeping most or all locks obtained before the transaction.
  • Use ctKEEP_OUT_ALL to keep all locks obtained before the transaction.

To free any kept locks you must make a LockISAM( ctFREE ) call, or a LockCtData( ctFREE ) call for each low-level record lock.

TOCIndex