We have some code that we use inside unit tests. This particular code has some code which checks to see if the function was run inside a cftransaction block. This is done as a safety mechanism to make sure the function is always called inside a transaction block.
If ACF, we could use the following code:
If the getCurrent() returns null, then we know the code is not running inside a transaction block.
I’m trying to find some way to do something equivalent in Lucee. I think maybe I could try setting a “savepoint” using cftransaction, but that doesn’t throw an exception when not inside a transaction block.
I’ve been poking around the source code, but I’m not seeing anything that would appear to help me.
Is there a way to determine if the current executing call is inside a transaction block?