Acquired table locks

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Acquired table locks

Return to chapter overview

If an application needs to place a lock on a table that was opened in share mode, it calls the BDE function DbiAcqTableLock. If a lock cannot be obtained, an error is returned.

DbiAcqTableLock can place a read or a write lock on the table.

A write lock prevents other users from updating a table, so that updates can be made cleanly and without interference. Only one write lock can exist on a table at a time.

A read lock prevents anyone from updating the table and prevents other users from placing a write lock on the table, so that table data cannot change while you are reading it. Multiple read locks can co-exist.

If a driver does not support read locks, a read lock is upgraded to a write lock. For example, for dBASE tables, read locks are upgraded to write locks. For SQL tables, a write lock is the same as a read lock and behavior varies according to the server.

More than one lock can be acquired on the table.

Releasing acquired table locks

DbiRelTableLock is used to release a table-level lock placed with DbiAcqTableLock. For each lock acquired, a separate call to DbiRelTableLock is required to release it.

 

hmtoggle_plus1Locking topics