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.Commit
commits a pending transaction, andRollback
rolls 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
.
Get Programming ColdFusion now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.