I would normally expect that any cfquery that errors in a transaction will force all other previous cfquery blocks in the same transaction to rollback. But I noticed that if one cfquery block has multiple DML statements, it behaves differently between Lucee and Coldfusion.
On ColdFusion, if any one of the statements in the cfquery block fails, then it will error.
On Lucee, if the first statement succeeds, then any failure in the subsequent statements will be silent.
<cftransaction>
<cftry>
<cfquery name="insertIntoMultipleTables">
INSERT INTO [A] VALUES('a', 'b')
INSERT INTO [B] VALUES('a', 'b')
INSERT INTO [C] VALUES('a', 'b')
</cfquery>
<cftransaction action="commit" />
<cfcatch>
<cftransaction action="rollback" />
</cfcatch>
</cftry
</cftransaction>
If we posit that object [B] doesn’t exist in the database, then on Lucee, the server does not raise an exception and the insertion into [A] will not rollback whereas on ColdFusion, the server raises an exception and everything in the transaction is rolled back.
Are there any settings on Lucee that changes this behavior or is it just how Lucee’s cfquery works and I just need to avoid having multiple statements in a single cfquery?
OS: Windows 10
Tomcat Version: Tomcat 9
Lucee Version: 5.3.8.199
Database: MS SQL Server 2019
Thank you.