Skip to main content
Solved

Atomic transactions and order_no of program object items

  • July 14, 2023
  • 1 reply
  • 45 views

Forum|alt.badge.img

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?

Best answer by Anne Buit

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

View original
Did this topic help you find an answer to your question?
This topic has been closed for replies.

1 reply

Anne Buit
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 653 replies
  • Answer
  • July 14, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings