Overview of transactions and versioning

Transactions are atomic. In other words, Adaptive Server IQ executes all the statements within a transaction as a unit. At the end of each transaction, changes can be committed to make them permanent. If for any reason all the commands in the transaction do not process properly, then some or all of the intermediate changes can be undone, or rolled back. The user application controls the conditions under which changes are committed or rolled back. In DBISQL the AUTO_COMMIT option can be used to control commits and rollbacks automatically.

Transactions break the work of each user into small blocks. The completion of each block marks a point at which the information is self-consistent. Transaction processing is fundamental to ensuring that a database contains correct information.

Note Adaptive Server IQ processes transactions quite differently from the way Adaptive Server Anywhere does when it operates without IQ. This chapter describes how Adaptive Server IQ handles transactions. If you are working in an Anywhere-only database, see the Adaptive Server Anywhere User’s Guide for information on transactions and locking.

Using transactions

Adaptive Server IQ allows commands to be grouped into transactions. In most cases, IQ transactions begin and end automatically, based on the commands being issued, and the options set. You can also issue explicit commands to begin or end a transaction.

Starting transactions

Transactions start automatically with one of the following events:

The first statement following a connection to a database.

The first statement following the end of a previous transaction.

Completing transactions

Transactions complete with one of the following events:

• A COMMIT statement makes the changes to the database permanent.

288

Page 308
Image 308
Sybase 12.4.2 Using transactions, Starting transactions, Completing transactions, Overview of transactions and versioning