Transaction Handling in Baan


With respect to database actions, a transaction is a sequence of related actions that are treated as a unit. The actions that make up a transaction are processed in their entirety, or not at all. 


A transaction ends with the function commit.transaction() (all changes made during the transaction are stored in the database) or with the function abort.transaction() (no changes are stored in the database). A transaction starts either at the beginning of a process, with the function set.transaction.readonly(), with the function db.lock.table(), or after the preceding transaction has ended. A transaction is automatically rolled back (that is, it is undone) when a process is canceled and if a program ends without a commit.transaction() or abort.transaction() after the last database call. Undoing a transaction is only possible if the underlying database system supports this. 


Certain database actions cannot be placed within a transaction, because they can not be rolled back. These actions are: db.create.table(), db.drop.table(), and set.transaction.readonly(). These functions can be called only at the start of a program or after the end of the preceding transaction. 


You can set a retry point immediately before a transaction. In case of an error, the system returns to this point and re-executes the transaction from there.


A read-only transaction is a transaction in which you are permitted only to read records (without lock) from the database. You retain read consistency during the entire transaction. This means that during the transaction your view of the database does not change, even if other users update the records. A read-only transaction starts with the function set.transaction.readonly() (this must be called after ending the preceding transaction or at the beginning of the program) and ends with a commit.transaction() or abort.transaction(). A consistent view consumes a large amount of memory, so a read-only transaction must be as short as possible; user interaction during the transaction is not recommended

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s