Skip to main content

Transactions

List of JSON DB API actions for running database transactions

Abstract

This section lists the JSON actions that manage transactions in a FairCom database. You can use these actions to create, list, commit, and rollback transactions. You can also create a savepoint within a transaction, and revert back to the savepoint. These actions work for all FairCom products that include the FairCom database engine.

This section lists the JSON actions that manage transactions in a FairCom database. You can use these actions to create, list, commit, and rollback transactions. You can also create a savepoint within a transaction, and revert back to the savepoint. These actions work for all FairCom products that include the FairCom database engine.

A transaction allows multiple actions to be committed or rolled back as a group. FairCom transactions are ACID compliant: they support atomicity, consistency, durability, and isolation.

Atomicity ensures changes made by actions in a transaction are committed or rolled back all-or-nothing. Durability ensures changes made by actions in a transaction are safely persisted in storage after the transaction has been committed. Isolation ensures changes made by actions inside a transaction are invisible outside it. Isolation prevents queries from seeing uncommitted changes, including inserts, updates, and deletes by other transactions.

Limitations of using SQL actions inside a JSON DB transaction

Once you run a "getRecordsUsingSQL" or "runSqlStatements" action within a transaction, it invalidates that transaction's previously created save points; thus, you cannot run the "revertTransactionToSavepoint" action to revert to a previously created save point.

You can, however, run "createTransactionSavePoint" after a "getRecordsUsingSQL" or "runSqlStatements" action to create a new savepoint, and you can later revert to that savepoint.

Action

Description

createTransaction

returns a "transactionId" property that you can add to other actions to put them under control of this transaction. Until you run "commitTransaction", changes made inside the transaction are invisible outside the transaction and are not durably persisted; thus, if the server fails before the transaction commits, all actions in the transaction are automatically rolled back.

createTransactionSavePoint

bookmarks the current point in the transaction process. You can create multiple savepoints and use "revertTransactionToSavepoint" to undo changes made after the savepoint.

revertTransactionToSavepoint

reverts a transaction back to a savepoint previously created by "createTransactionSavepoint" . It keeps the transaction open so you can continue to do more actions under transaction control.

commitTransaction

closes a transaction and makes its changes durable and visible to other transactions. You can include the "transactionSavepointId" property to commit changes in the transaction up to the savepoint. "commitTransaction" always closes a transaction. Once a transaction is closed, you can no longer use its "transactionId".

rollbackTransaction

closes a transaction and discards all changes made under the control of the transaction. Once a transaction is closed, you can no longer use its "transactionId".

listTransactions

returns a list of all active transactions that the logged-in account is authorized to see.