Skip to main content

Dear community,

At Vezet we want to build some user logging functionality. However, we ran into an issue with the order_no's of the templates which handle the atomic transaction. Below is an example:

We want to weave functionality between tasks_start and transaction_start. This is impossible because there is no INT value between 1 and 2. We also want to weave functionality(a finally block of some sorts) between 99999 and 100000, this is also impossible. 

We can edit the control_procedure of sql_tasks to change these order_no's but because it's copied from a base project it resets after a generate. We can change the base project but this causes problems everytime we upgrade to a new version of the Software Factory. 

What is the best solution for this issue?

Hi Jordy,

This was done on purpose as this code is added when the task is marked as ‘Atomic transaction’ in the model at the task definition. 

If we’d allow code to be placed before the transaction is opened or after the transaction is finished, this setting would no longer do it’s job.

You can turn off the atomic transaction for the tasks and weave your own transaction code blocks at different positions in the program object. Note however, that the task may be called from an outer transaction. Logging would still be rolled back if done in this scenario.

I’ve used a trick with linked servers with transaction promotion disabled for logging outside of the transaction, which works for triggers and such as well. I found a nice instruction for this trick here: Logging from inside a transaction - CodeProject