<cftransaction>Transactions and isolation levels are implemented using the <cftransaction> tag. This tag has a matching end tag and encloses all ColdFusion queries and logic pertinent to a given transaction. If no isolation levels are sent, the default is serializable. The following example demonstrates the wire transfer example. Notice that this example uses custom tag <cfx_sendwire> to send information to the son's bank. This tag does not really exist but is used to demonstrate the concept. This nonexistent tag returns the variable wireResult equal to 1 or 0 based on successful wire transfers: <cftransaction> <!--- remove $100 from the woman's account ---> <cfquery datasource="AccountDB"> UPDATE Account SET Balance = Balance - 100 WHERE AccountID = 4334044033 </cfquery> <!--- enter the woman's name in the wire transfer log ---> <cfquery datasource="TransferLog"> INSERT INTO transferLog (accountID,Time,BankID,wiredAmount,recipientAccountID) VALUES (4334044033,getDate(),3344212,100,4403343402) </cfquery> <!--- call C++ wire transfer library to send data to other bank ---> <cfx_sendwire bank amount="100" accountid ="4403343402"> <cfif wireResult is 0> <cfabort> </cfif> <!--- if aborted transaction won't finish--updates/inserts cancel ---> </cftransaction> <cftransaction> has no required attributes. The isolation attribute can be set to read_uncommitted, read_committed, repeatable_read, and serializable. The default isolation is serializable. |