TurboDB Engine Documentation Record Locks Feature is only supported in TurboDB Native |
Previous Top Next |
TurboDB automatically locks a record when a user begins to edit it. This prevents two different users working on the same record in the database at the same time. The lock is removed when the user commits or cancel his changes or when he closes the table.
When a user tries to access a record which is already locked by another user, the call returns an error and the record cannot be edited by the second user. Most component libraries (e.g. VCL and CLX) issue an exception, if this error occurs. The user must wait until the first user has finished editing and then try again.
In TurboDB record locks can coexist with table locks. It is possible that one user starts editing a record and than another user runs an update command against the table before the first user posts his changes. This will work fine as long as the update command does not touch the locked record. If it does the update command will fail. In both cases the first user can edit the record and post it any time afterwards.
For some applications with a lot of users and a loose network connection (e.g. Web applications), keeping a record lock while the user edits the record is not a good idea. In this case you should prefer a disconnected data access model.