Name
CFTRANSACTION
Synopsis
<CFTRANSACTION>
CFML code
</CFTRANSACTION>Treats all query operations between
<CFTRANSACTION>/</CFTRANSACTION>
tags as a single transaction. Changes to the database aren’t
committed until all queries in the transaction have executed
successfully. In the event that a query within the transaction fails,
all previous queries are automatically rolled back.
CFTRANSACTION tags may be nested to allow portions
of the transaction to be committed or rolled back within the main
CFTRANSACTION block. More than one database may be
written to within a single CFTRANSACTION block if
each transaction is committed or rolled back prior to writing a query
to the next database. Exception handling using
CFTRY/CFCATCH gives you full
control over how queries are committed and rolled back within
CFTRANSACTION blocks.
Attributes
-
ACTION="action" The action to take. Optional. The default value is
Begin, which specifies the beginning of a block of code to execute as a transaction.Commitcommits a pending transaction, andRollbackrolls back a pending transaction.-
ISOLATION="ODBC_lock_type" The ODBC lock type to use for the transaction. The following ODBC lock types are supported:
Read_Uncommitted,Read_Committed,Repeatable_Read, andSerializable.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access