cftransaction
427
Usage
If you do not specify a value for the
action
attribute, automatic transaction processing proceeds
as follows:
•
If the
cfquery
operations within the transaction block complete without an error, the
transaction is committed.
•
If a
cfquery
tag generates an error within a
cftransaction
block, all
cfquery
operations in
the transaction roll back.
If you do not specify a value for the
isolation
attribute, ColdFusion uses the default isolation
level for the associated database.
Using CFML error handling and the
action
attribute, however, you can also explicitly control
whether a transaction is committed or rolled back, based on the success or failure of the database
query. Within a transaction block, you can do the following:
•
Commit a database transaction by nesting the
<cftransaction action = "commit"/>
tag
within the block
•
Roll back a transaction by nesting the
<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 roll back a transaction to one database before writing a query to another.
To control how the database engine performs locking during the transaction, use the
isolation
attribute.
Example
<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>
--->
Содержание COLFUSION MX 7 - INSTALLING AND USING COLDFUSION MX
Страница 1: ...COLDFUSION MX7 CFML Reference...
Страница 20: ...20 Chapter 1 Reserved Words and Variables...
Страница 50: ...50 Chapter 2 ColdFusion Tags cfelse br Searching cfif cfloop cfif...
Страница 101: ...cfdefaultcase 101 cfdefaultcase cfswitch cfoutput Your grade is grade cfoutput...
Страница 115: ...cfdocumentsection 115 cfdocumentsection cfoutput cfdocument...
Страница 311: ...cfNTauthenticate 311 Please Try again H2 cfif cfoutput cfinclude template loginform cfm cfabort cfif cfif cflogin...
Страница 411: ...cftable 411 cftable body html...
Страница 515: ...Chr 515 maxlength 5 p input type Submit name input type RESET cfform...
Страница 605: ...GetEncoding 605 WriteOutput The encoding is theEncoding cfscript cfif...
Страница 629: ...GetProfileString 629 tr td input type Submit name Submit value Submit td td td tr table form...
Страница 655: ...IIf 655 cfoutput IIf Hour Now GTE 12 DE It is afternoon or evening DE It is morning cfoutput b...
Страница 664: ...664 Chapter 3 ColdFusion Functions cfelse h3 Conversion error h3 cfif...
Страница 687: ...IsStruct 687 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Страница 693: ...IsWDDX 693 struct data wddxPacket hr xmp cfoutput packet xmp IsWDDX returns IsWDDX packet br cfoutput...
Страница 751: ...LSDateFormat 751 hr noshade cfoutput cfloop...
Страница 861: ...StructFind 861 cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Страница 869: ...StructIsEmpty 869 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Страница 903: ...Val 903 value Is the beginning numeric name form...
Страница 932: ...932 Chapter 3 ColdFusion Functions...
Страница 944: ...944 Chapter 4 ColdFusion MX Flash Form Style Reference...
Страница 962: ...962 Chapter 5 Application CFC Reference...
Страница 1008: ...1008 Chapter 6 ColdFusion MX Event Gateway Reference cfset retValue Reason reason cfreturn retValue cffunction...
Страница 1054: ...1054 Chapter 6 ColdFusion MX Event Gateway Reference...