Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

ctLOKDYN

Alters user-wide default locking mechanisms.

Declaration

NINT ctLOKDYN( LONG action )

Description

Calls to ctLOKDYN() can alter the user-wide lock state where action is one of:

  • ctLOKDYNoptions - return ctLOKDYN state
  • ctLOKDYNdemote - turn off nodemote
  • ctLOKDYNfree - turn off nofree
  • ctLOKDYNnotranPersist - turn off tranPersist
  • ctLOKDYNnolockDefer - turn off lockDefer
  • ctLOKDYNnodemote - requesting a read lock on a write locked record that has not been modified preserves the write lock rather than demoting the write lock to a read lock
  • ctLOKDYNnofree - deny an attempt to free a lock acquired before the last savepoint (if any) — free returns NO_ERROR and sysiocod is set to SAVP_COD.
  • ctLOKDYNtranPersist - deny unlocking a record in a transaction controlled file when the caller has an active transaction even if the record has not been updated —the unlock call returns NO_ERROR and sysiocod is set to UDLK_TRN
  • ctLOKDYNlockDefer - defer the close of a transaction controlled file when the caller has an active transaction if the caller holds any locks on the file

Inside of a transaction, an unlock request on a record behaves differently depending on whether or not the record has been updated. If it has not been updated the unlock request succeeds. If it has been updated, the unlock returns a NO_ERROR, but the lock remains and the sysiocod is set to UDLK_TRN (-3).

The ctLOKDYNtranPersist mode will enable a user-wide state such that the lock persists, even if the record has not been updated. The ctLOKDYNnotranPersist will disable this state. The PUTHDR() ctTRNPERShdr mode toggles the file state. The tranPersist state (whether user-wide or file specific) only affects behavior at the time an unlock request is made. Whether it is on or off at the time the lock is granted does not affect unlock behavior.

The ctLOKDYNlockDefer mode will defer the close of a file, for the user-wide state, if there are locks pending on the file, whether or not any records are updated. ctLOKDYNnolockDefer turns off this state. The PUTHDR() ctLOCKDFRhdr mode is the equivalent file state call.

The user-wide and/or file-specific routines need only be called once. The states persist until the user logs off or the file is closed, respectively. However, they can be turned on and off as the application desires.

Return Values

Value

Symbolic Constant

Explanation

See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.

TOCIndex