Transaction Control
Introduction: You can find a description of this phase in section Phase 4 (Introduction).
Normally, all SQL statements are written to a database in one transaction. However, the transaction behaviour can be changed with target structure node attribute Transaction control. See section Phase 4 - SQL Execution. The following settings are possible.
After record |
When exiting the node, there is no commit sent to the database. This is the default setting. If all nodes of the target structure have this setting, Lobster_data does not trigger a commit (to all involved database aliases) until the last node of the (partial) target tree of a record has been exited. A commit for a node is triggered if the parent node triggers a commit (starting with the (virtual) root node). So there is at least one commit per record. |
All open statements |
When exiting the node, a commit is triggered for all database aliases with open transactions. If the database cannot execute the commit, Lobster_data will execute a rollback for the affected database alias. Note: This is not a two-phase commit! An executed commit for a database alias cannot be undone! Note: If a node with this setting is entered, already open transactions will not be closed but used. |
Only DB alias of this node |
This is the most common commit setting. When exiting the node, a commit is triggered for the associated database alias of the node. If the database cannot execute the commit, Lobster_data will execute a rollback for the affected database alias. Note: If a node with this setting is entered, already open transactions will not be closed but used. |
After all records |
With this setting, a commit is sent to the database after the last record has been processed. That means either all data of the node ends up in the database or none. Note: If a node with this setting is entered, already open transactions will not be closed but used. |
In response path |
The transaction behaviour is controlled with custom classes in phase 6. See sections CommitSqlSessionResponse a nd RollbackSqlSessionResponse . |