Using transactions

Transactions

SIRA_PRISE includes support for transactions, including the concept of nested transactions.  DML operations with SIRA_PRISE can only be done inside the context of a transaction, so usage of the transactions feature is actually required to get anything done by SIRA_PRISE.

SIRA_PRISE currently has no support for two-phase commit, so using transactions amounts just to starting them, committing them or rolling them back, and ending them. Users writing their own SIRA_PRISE client can find the needed documentation on how to achieve this in the documentation of the SIRA_PRISE message types. Users accessing SIRA_PRISE through the java client can find the needed documentation in the provided client JavaDoc.

Ending transactions properly is important because the server limits the amount of transactions that can be running simultaneously. If a client does not end a transaction properly, that transaction remains "active, but not doing anything" on the server until it times out. This amounts to reducing the total number of effectively available transactions by one. Note that in the freely available version, the amount of available transactions is limited to one.

Nested transactions and savepoints

SIRA_PRISE includes support for nested transactions, which feature allows the users to obtain the transaction behaviour that is possibly also known as "savepoints".The following rules apply to using nested transactions : 

  1. A nested transaction can only be started if a transaction has been started.
  2. Any newly started nested transaction is always nested within the most recently started nested transaction, so it is never possible to have "sibling nested transactions" (i.e. more than one transaction) nested inside some other transaction.
  3. Any "open" transaction (i.e. a transaction that has been started and has not been ended) can be committed or rolled back.
  4. Committing or rolling back any transaction will always cause any transactions nested within it to be committed or rolled back, respectively, and thereafter ended. So committing or rolling back a transaction always has the effect of making that transaction the "most recent open transaction".
  5. The maximum nesting level is 12 (including the outermost transaction, which corresponds to the implicit savepoint "start-of-transaction"), and hence the maximum number of savepoints is 11.