Groups database queries into a unit. Provides database commit and rollback processing.
<cftransaction
action = "begin" or "commit" or "rollback"
isolation = "read_uncommitted" or "read_committed" or
"repeatable_read" >
</cftransaction>
cfinsert, cfprocparam, cfprocresult, cfquery, cfqueryparam, cfstoredproc, cfupdate
Within a transaction block, you can do the following:
<cftransaction action = "commit"/> tag within the block
<cftransaction action = "rollback"/> tag within the block (In these examples, the slash is alternate syntax that is the equivalent of an end tag.)
Within a transaction block, you can write queries to more than one database, but you must commit or rollback a transaction to one database before writing a query to another. Using CFML error handling, you control whether each transaction is committed, based on the success or failure of the database query. To control how the database engine performs locking during the transaction, use the isolation attribute.
<p>CFTRANSACTION can be used to group multiple queries that use CFQUERY
into one business event. Changes to data that is requested by the queries
are not committed to the datasource until all actions within the transaction
block have executed successfully.
<p>This a view-only example.
<!---
<cftransaction>
<cfquery name='makeNewCourse' datasource='Snippets'>
INSERT INTO Courses
(Number, Descript)
VALUES
('#myNumber#', '#myDescription#')
</cfquery>
<cfquery name='insertNewCourseToList' datasource='Snippets'>
INSERT INTO CourseList
(CorNumber, CorDesc, Dept_ID,
CorName, CorLevel, LastUpdate)
VALUES
('#myNumber#', '#myDescription#', '#myDepartment#',
'#myDescription#', '#myCorLevel#', #Now()#)
</cfquery>
</cftransaction>
--->
ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Tags-pt315.htm
Comments
earnshavian said on Dec 10, 2003 at 7:50 AM : ThisIsMe said on May 20, 2004 at 9:06 AM :