ColdFusion provides support for database
transaction processing using the
CFTRANSACTION tag lets you treat all
query operations with the
</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 a
query within the transaction fails, all previous queries are
automatically rolled back. The exception to this occurs when the
database itself is changed, as in the case when a table or column is
created or deleted.
tag accepts two optional attributes for controlling how transactions
Specifies the transaction action to take. Valid options include:
Specifies the beginning of the block of code to execute
Commits a pending transaction
Rolls back a pending transaction
Specifies the ODBC lock type to use for the transaction. The
following ODBC lock types are supported:
Note that not all databases and/or database drivers support isolation levels. Many support only a subset of those listed. Refer to your particular database/driver’s documentation for more information on the isolation levels supported.
Example 11-26 shows how to use the
CFTRANSACTION tag with two queries that delete records from different tables within the same data source. You need ...