Adobe COLDFUSION 9 Manual page 27

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
The CFML Programming Language
lock scope = "request" timeout = "30" type = "Exclusive" {
request.number = 1;
writeoutput("E-Turtleneck has now sold "& request.number &"
turtlenecks!");
}
cftransaction
To use the transaction operation you specify a begin action parameter. A transaction has the following general form:
TRANSACTION action="begin" [isolation="isolationValue"] {
transaction code
}
Within the transaction block you call the following methods to manage the transaction:
transactionCommit()
transactionRollback([savepoint])
transactionSetSavepoint([savepoint])
The
parameter is a string identifier for the savepoint.
savepoint
Note: You can also use theses methods in a
You can nest transaction operations. For more information on nested transactions, see cftransaction in CFML
Reference.
The following example uses nested transaction operations:
<cfscript>
qry = new Query();
qry.setDatasource("test");
qry.setSQL("delete from art where artid=62");
qry.execute();
TRANSACTION action="begin"
{writeoutput("Transaction in cfscript test");
TRANSACTION action="begin" {
qry.setSQL("insert into art(artid, artistid, artname, description, issold, price)
values ( 62, 1, 'art12', 'something', 1, 100)");
qry.execute();}
transactionSetSavepoint("sp01");
qry.setSQL("update art set artname='art45' where artid=62");
qry.execute();
transactionSetSavepoint("sp02");
qry.setSQL("update art set artname='art56' where artid=62");
qry.execute();
transactionrollback("sp02");
transactioncommit();
}
</cfscript>
cfthread
To use the thread operation you specify a run action parameter. The thread runs the code in the operation body. A
thread block has the following general form:
tag body.
cftransaction
Last updated 8/5/2010
22

Advertisement

Table of Contents
loading

Table of Contents