<cftransaction>
Groups multiple queries into a single unit.
The cftransaction tag provides commit and rollback processing.
This tag must have a body.
This tag is also supported within <cfscript>
<cftransaction
action=begin|commit|setSavePoint|rollback
isolation=string
><!--- body ---></cftransaction>
Examples
<cffunction name="updateAddress" access="remote" output="false">
<cfargument name="addressId" type="number" required="yes">
<cfargument name="newAddress" type="string" required="yes">
<cftransaction isolation="read_committed">
<cfquery name="changeAddress" datasource="#application.config.DSN#">
update address
set login_address = <cfqueryparam value="#arguments.newAddress#" cfsqltype="VARCHAR">
where id = <cfqueryparam value="#arguments.addressId#" cfsqltype="INTEGER">
</cfquery>
</cftransaction>
</cffunction>
See also
- ORM
- Queries
- IsWithinTransaction()
- TransactionCommit()
- TransactionRollback()
- TransactionSetSavePoint()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)