2.1. Locking - Locking features
Locking features are provided for instances and collections (database entry). Locking a database entry is done by locking a virtual position in the database file. The virtual position is derived from database entry number. In case of 32-bit systems, the position is the negative value of the database entry used as an unsigned integer. Since database files in 32-bit applications must not exceed 2GB (0x7FFFFFFF bytes), locking positions are never real database file positions.
In case of 64-bit systems it is the database entry number + 0x1000000000000, which always exceeds the maximum database file size, which is limited to 0x1000000000000 bytes.
Virtual locking positions are also used for internal locking. When storing database entries in transactions or when accessing instances in write mode, database entries are locked by locking virtual file positions. This may conflict with database entries locked by application, i.e. locking an instance by application will prevent the instance from later modifications within the application.
Virtual file positions locked by the application are reset when terminating the process. In order to achieve persistent write locks, one may set the writeProtect property.
- collectionLocked - Is collection locked
- collectionLockedForUpdate - Is collection locked for update
- instanceLocked - Check whether instance is locked
- lockCollection - Lock collection
- lockCollectionForUpdate - Lock collection
- lockInstance - Lock instance
- unlockCollection - Unlock collection
- unlockCollectionForUpdate - Unlock collection for update
- unlockInstance - Unlock instance
- writeProtected - Persistent write protection property