Table of Contents

Data - Transaction (Trans(versal?) actions)

About

A single logical operation on the data is called a transaction. A physical operation is called a request and therefore a transaction is a queue of request.

For example, a transfer of funds from one bank account to another, even though that might involve multiple changes (such as debiting one account and crediting another), is a single transaction.

A transaction has a beginning and an end.

This is the command pattern for data.

Example

A single transaction consists of one or more independent units of work, each reading and/or writing information to a database or other data store. When this happens it is often important to ensure that all such processing leaves the database or data store in a consistent state.

Examples from double-entry accounting systems often illustrate the concept of transactions. In double-entry accounting every debit requires the recording of an associated credit. If one writes a check for €100 to buy groceries, a transactional double-entry accounting system must record the following two entries to cover the single transaction:

A transactional system would make both entries — or both entries would fail. By treating the recording of multiple entries as an atomic transactional unit of work the system maintains the integrity of the data recorded. In other words, nobody ends up with a situation in which a debit is recorded but no associated credit is recorded, or vice versa.

Transaction Process

A simple transaction is usually issued to the database system in a language like SQL wrapped in a transaction, using a pattern similar to the following:

Purposes of Transactions

Transactions in a database environment have 4 purposes (Data Property - ACID (atomicity, consistency, isolation, durability))

SQL Database

In the context of databases (“transactional databases”), a transaction is a logical, atomic unit of work that contains a series of SQL statements (one or more)

A database transaction consists of one or more statements. Specifically, a transaction consists of one of the following:

A commit ends the current transaction and makes permanent all changes performed in the transaction.

Documentation / Reference