Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Record Locking

Record locking controls which user is going to be able to access and update a given record. When multiple users are accessing a data file in ctSHARED file mode use record locking to prevent several users from updating the same record at the same time. For low-level functions, use LockCtData(). For ISAM functions, use LockISAM().

FairCom DB provides optimistic and pessimistic record locking.

  • All FairCom APIs can use optimistic locking for record updates, which provides the best scalability.
  • SQL automatically locks records as needed, which provides good scalability.
  • The record buffer APIs provide complete control over all locking, which includes optimistic locks and a wide variety of pessimistic record locking mechanisms.

All types of record locks are compatible across all APIs, allowing data to be processed safely by all APIs simultaneously.

In FairCom DB, we define two types of record locks: write locks and read locks.

Write Locks

A write lock can be considered an exclusive lock. Only one user can have a write lock on a given record. A write lock also prevents anyone from getting a read lock on the same record. This is used when a user must update a record, and needs to prevent other users from updating at the same time. Use the record lock mode of ctENABLE.

Read Locks

A read lock can be considered a shared lock. Any number of users can have a read lock on a record simultaneously. A read lock on a record will prevent another user from getting a write lock on this record. Use this to allow one or more users to look at a record while ensuring that it cannot be changed or deleted by another user while they are looking at it. Use a record lock mode of ctREADREC.

The FairCom DB client and the FairCom Server DO support read locks in addition to write locks.

In This Section

Optimistic Locking

Checklock

ISAM Level Data Record Locks

Low-Level Data Record Locks

FairCom Server enhanced locking control for files opened multiple times in the same connection

Table Lock Support

TOCIndex