Database Mashable Transactions
For database mashables created in MashZone NextGen 2.7.0 or earlier, you can add transaction handling using these MashZone NextGen extension statements:
<presto:beginTransaction>: opens a connection to the database associated with the mashable specified in the command and sets AutoCommit to false.
<presto:commitTransaction>: sends a commit message to the database associated with the mashable specified in the command and closes the database connection.
<presto:rollbackTransaction>: sends a rollback message to the database associated with the mashable specified in the command and closes the database connection. The
MashZone NextGen Server also automatically sends a rollback for any invocation failures for the specified Database service within the bounds of the transaction.
Important: | For transaction handling for database mashables created in later versions of MashZone NextGen, see SQL Transactions. |
The MashZone NextGen Server does not support distributed transactions. These commands only affect the invocations for a specific database mashable. All other commands are unaffected, including invocations of other services.
Transaction Example
This sample uses a database mashable with operations to insert, update or delete records in several Personnel tables.
...
<presto:beginTransaction service="personnel"/>
<invoke service="personnel" operation="addEmployee"
inputvariables="newEmployee" outputvariable="employeeResult"/>
<invoke service="personnel" operation="addDemographics"
inputvariables="newEmployee" outputvariable="$demoResult"/>
<invoke service="personnel" operation="addBenefits"
inputvariables="newEmployee" outputvariable="$benefitsResult"/>
<if condition="$employeeResult/response/response/errorcode = 300
or $demoResult/response/response/errorcode = 300
or $benefitsResult/response/response/errorcode = 300">
<presto:rollbackTransaction service="personnel"/>
<else>
<presto:commitTransaction service="personnel"/>
</else>
</if>
...