Transactions
Most DBMSs support the concept of transactions. A transaction is a sequence of DML statements which constitute a logical unit of work.
The effect
of all statements can be made permanent in the database (for example,
when the commit
SQL statement
is executed successfully), or not (for example, when the rollback
SQL statement is executed
or an automatic rollback
is enforced
by the DBMS).
Local and Global Transactions
Transactions can be controlled by Uniface via a DBMS connector, in which case they are local transactions, or by a third-party transaction manager, in which case they are global transactions.
- A local transaction involves only one process on a single computer and it accesses only one DBMS. It is confined to the boundaries of the process, and one local transaction is needed for each DBMS.
- A global transaction can involve multiple DBMSs, multiple server processes and multiple computers. For this reason, global transactions are also called distributed transactions.
A database connector can be controlled by a transaction manager only if it is TM-capable.
Note: Uniface itself does not provide TM-capable connectors and does not directly support third-party transaction managers. You can use the APIs provided by the Database Connector Interface to build a custom database connector that does. For more information, see TM-Controlled DBMS Connectors.
Uniface Behavior
Uniface supports
the concept of transactions, but not implicitly. An application
developer has to explicitly force the commit
or rollback
. This occurs in ProcScript, the
procedural language available to application developers for event-driven
and data-driven processing at application run time. These ProcScript commands
result in connector requests.
Be careful to recognize the difference between Uniface transaction control and any transaction control which your DBMS might carry out independently of explicit instructions.
Database Transaction Limitations
Some DBMSs set
restrictions on the statements that can be issued in a transaction,
such as not allowing create table
.
Uniface does not take such restrictions into account. The connector
can check connector requests for the violation of such restrictions
by maintaining a transaction state.
Automatically Enforced Rollbacks
The
connector cannot inform Uniface about a rollback
that
is automatically enforced by the DBMS. This can happen, for instance,
when the DBMS detects a deadlock situation.
When an automatically enforced rollback
occurs on a Logon path (enforced
by the DBMS), the connector must ignore all subsequent Uniface connector
requests on that path, except for Info
, Message
, Rollback
, and Logoff
.
The connector should do this by returning an error to Uniface, until
the first Rollback
or Logoff
is requested.