I have a simple CFML code block that calls a function in a
cftry and if this runs without an exception, it commits. Else, it rolls back. The function handles some queries and all.
The issue is when I run the code, it runs successfully but doesn’t commit. (This was working on a different environment, Windows - I think on a lesser version. can’t remember the version).
When I uncomment the
cftransaction, the code blocks runs fine.
Am I doing something wrong?
PS: I also noticed the
cftransaction works for only bodies with
cfquery and leave others
<cftransaction> <cftry> <cfif allow_update> <cfset update_column = query_with_sql("UPDATE table set column....",false)/> <cfif require_global_update> <cfset update_column_global = update_pricing_tables("update_from_product",db_column_name,db_column_value)/> </cfif> <cftransaction action="commit"/> success <cfelse> Action isn't allowed. </cfif> <cfcatch> <cftransaction action="rollback"/> failure <cfoutput>#cfcatch.message#</cfoutput> </cfcatch> </cftry> </cftransaction>
Don’t forget to tell us about your stack!
OS: Linux NGINX Docker
Java Version: 11.0.11
Tomcat Version: 9.0.48
Lucee Version: 220.127.116.11