ProcessMIX Guide
Ask or search…
K

DB transactions

A transaction is a set of operations for working with a database (DB), combined into one atomic bundle. It is used when it is important to perform a set of actions altogether, if each separate action does not make any sense without the others, or if the data in different places must be in a consistent state. If at least one operation from the transaction fails as an error or exception, the system cancels each transaction operation included.
To group operations into one atomic batch, a transaction should be used.
The transaction must:
  • begin by using the “Begin transaction” node;
  • perform all inside operations;
  • be closed by the following options:
    • by the system. If an error or exception occurs within any transaction operation, the system performs a “Rollback”, а cancellation of each operation included in the transaction. If there is no error or exception, the system performs “Сommit”, and stores the result of the transaction in the Database;
    • self-configuration by using “Commit Transaction” and “Rollback Transaction” nodes. You can specify the condition “Сommit“ or “Rollback“ performance if the transaction results are required to be saved or canceled depending on the operation’s result. If only one node is used (“Commit Transaction” or “Rollback Transaction”), the system performs the missing function by default after all operations included in the transaction have been performed.
  1. 1.
    Using the “Begin transaction” node is required to create a transaction.
  2. 2.
    “Commit Transaction” and “Rollback Transaction” use optionally. If the nodes have not been used, the system performs the “Commit” or “Rollback” function the same way as “Commit Transaction“ and “Rollback Transaction“.
  3. 3.
    Such transactions can be used several times in one flow.

How to Create a Transaction using nodes?

DB transaction nodes description
  1. 1.
    Drag and drop the “Begin transaction” node. The Error indicator is displayed, because the DB Connector is required to be filled in. To fill in, click the input field.
  2. 2.
    Select the DB connector in the opened window and click “Confirm“.
  3. 3.
    Then drag and drop the “DB Connector” node and select the variable created by the node “Begin transaction”. The “DB Connector” node can be used more than once, but all queries must be to the same database as the database in the “Begin transaction“ node. Otherwise, these requests will not be included in the transaction, “Commit Transaction“ and “Rollback Transaction“ nodes also will perform only for DB, to which this transaction has been opened.
  4. 4.
    (Optional) After all operations have been added to the Flow, the nodes “Commit Transaction“ and “Rollback Transaction“ can be used:
    • Drag and drop “Commit Transaction” and select the variable created by the “Begin transaction” node. The “Transсaction” field is required in the node setting panel. If the field is empty, the error indicator will be displayed, the field borders will be highlighted in red. When the error is fixed, the red highlight disappears, and the error is not displayed in the panel.
    • Drag and drop the “Rollback Transaction” and select the variable created by the “Begin transaction” node. The “Transсaction” field is required in the node setting panel. If the field is empty, the error indicator will be displayed, the field borders will be highlighted in red. When the error is fixed, the red highlight disappears, and the error is not displayed in the panel.