Concepts

The main concepts used by the Transaction Engine 3 are:

Transaction:

A Transaction is, in general terms, a set of operations that the server-side script must perform. The transaction has a main operation that is performed, that is generally a SQL statement. However, you can build transactions that do not use SQL commands at all.

As an example, a transaction can perform the following operations:

The schematics of a transaction shows that the transaction itself is the whole made up from the main operation and the smaller operations performed before, after or in case of an error:

 

Depending on the main operation';s type, there are several transaction types:

Whenever the transaction will throw an error, its execution will fail.

Dispatcher

It represents a container for the transactions, and it is needed to improve the flow when using multiple transactions on the same page. Any transaction that will be executed in a page will have to be registered with the dispatcher. The dispatcher is represented in page by the following line of code:

$tNGs = new tNG_dispatcher("");

The $tNGs variable will be created only once and it will act like a global variable throughout the entire request. The dispatcher is unique on page. It receives as parameter the current file's relative path from the site root.

The Dispatcher is very important, as it handles all interactions between the page and the Transactions that are registered to it (executes the Transactions, feeds the recordsets generated by the Transactions to the page, displays Transaction's error messages etc).

Trigger

Triggers represent operations that prepare or complete the Transaction's main operation. [They can exist only as a part of a Transaction and they are executed by the transaction].

It represents a code block that registers to a transaction, has access to the transaction's contextual information, and is executed before/after the transaction.

There are five types of triggers, based on the cascaded execution of a transaction: