Transactions handling

Informix® and Genero db handle transactions in a similar manner: In both Informix and Genero db, transactions must be started with BEGIN WORK and finished with COMMIT WORK or ROLLBACK WORK.

Statements executed outside a transaction are automatically committed.

Note: With Informix in native mode (non-ANSI), DDL statements can be executed (and cancelled) in transactions. Genero db does not support DDL statements inside transactions.
Informix version 11.50 introduces savepoints with the following instructions:
SAVEPOINT name [UNIQUE]
ROLLBACK [WORK] TO SAVEPOINT [name] ]
RELEASE SAVEPOINT name

Genero db supports savepoints too. However, there are differences:

  1. Savepoints cannot be declared as UNIQUE.
  2. Rollback must always specify the savepoint name.
  3. You cannot release savepoints (RELEASE SAVEPOINT).

Solution

  • Transaction control instructions - existing applications do not have to be modified in order to work with Genero db. However, you must extract the DDL statements from transaction blocks.
  • Transactions in stored procedures - avoid using transactions in stored procedures; allow the client applications to handle transactions, in accordance with the transaction model.
  • Savepoints - if you want to use savepoints:
    • Do not use the UNIQUE keyword in the savepoint declaration.
    • Always specify the savepoint name in ROLLBACK TO SAVEPOINT.
    • do not drop savepoints with RELEASE SAVEPOINT.

See also SELECT FOR UPDATE