Contents IndexAn overview of transactions Isolation levels and consistency

User's Guide
   Part III. Using SQL Anywhere
     Chapter 19. Using Transactions and Locks
      How locking works

When a transaction is reading or writing a row in a database table, the database engine automatically locks the individual row (row level locking) to prevent other transactions from interfering with the data, or from obtaining unreliable data. The transaction that has access to the row is said to hold the lock. Depending on the type of lock, other transactions may have limited access to the locked row, or none at all.

All locks for a transaction are held until the transaction is complete (COMMIT or ROLLBACK), with a single exception noted below.

SQL Anywhere allows users to determine the extent to which transactions can operate concurrently by setting isolation levels. Isolation levels are discussed in the next section.

Types of locks

There are three distinct types of locks:

Uses for locks

They have the following uses:

Contents IndexAn overview of transactions Isolation levels and consistency