Transactions Clarification

I’m using sc_begin_trans() in onValidateSuccess and sc_commit_trans() in onAfterInsert. In between there are a number of sc_exec_sql statements which are SQL INSERTs and UPDATEs. I am not using sc_rollback_trans() anywhere as there is no specific test I wish to do except if any of the commands fail at db level. In SC, do I need to wrap each sc_exec_sql in a try…catch (with the rollback) or can I safely assume this all happens automatically?

Bump! Can anyone guide?

Transactions only works if your project is blessed. :slight_smile:

Not sure, I stopped to use transactions some time ago because didn’t worked. I will try again and report back

The transactions are only useful in blank applications. Within forms, scriptcase is already setting up a transaction which is committed at the very end. That’s why you must use a sc_commit_trans when you use a sc_redir. So within forms you don’t need to apply additional transactions imho.

@Aducom: what about in Grid ‘Run’ buttons?