TurboDB Engine Documentation

Table Locks

See also


TurboDB Engine works with two kinds of locks on its database tables:

A read lock (also called a shared lock) prevents other applications from writing to the table. Write locks are used to guarantee a consistent database table during a sequence of read operations, e.g. while an index is created. More than one application can acquire a read lock on a database table at the same time.

A write lock (also called an exclusive lock) prevents other applications from any access to the table. Total locks are needed for multiple write operations to a table, e.g. altering the table structure. Only one application at a time can acquire a write lock on the table.

A table can be opened in exclusive mode as well. This mode opens the underlying database file in the exclusive file mode which prevents any other application from opening it. Opening a table in exclusive mode has a similar result to a write lock, but there are some differences:

Write locks are managed by TurboDB, whereas exclusive mode is manage by the file system.
Write locks can be acquired while the database table is already open. Exclusive mode can only be set before opening the table.


If working with the VCL components for TurboDB you will notice that read locks are called write locks here and write locks are called total locks. This is because the BDE confuses the lock types and we try to be half-way compatible.