Bryan,

There was a lot of talk about this on another list a few months ago, the
problem is that cftransaction cannot be split across functions. However
there is no reason why you can not use the SQL transaction to begin and end
it.

If you want more details, when I get to work I'll post the code that was
posted in this list.

Regards,
Andrew Scott



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bryan Nolen
Sent: Sunday, 15 February 2004 10:28 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: cfc's and cftransactions

Didn't think it would be this complex, but:

<!--- process order --->
<cfset dbManager = new DatabaseManager />
<cfset canContinue = "false" />
<cftransaction action="BEGIN" />
        <cfset uniqOrderId = generateID() />
        
        <cfset canContinue = dbManager.doInsert(cartObject.getDatabase(),
uniqOrderId, cartObject.generateQueryString()) />

        <cfif canContinue>
                <cfset canContinue =
dbManager.doInsert(paymentObject.getDatabase(), uniqOrderId,
paymentObject.generateQueryString()) />
        <cfelse>
                <cftransaction action="ROLLBACK" />
        </cfif>

        <cfif canContinue>
                <cfset canContinue =
dbManager.doInsert(shopperObject.getDatabase(), uniqOrderId,
shopperObject.generateQueryString()) />
        <cfelse>
                <cftransaction action="ROLLBACK" />
        </cfif>

<cfif canContinue>
        <cftransaction action="COMMIT" />
</cfif>


The DatabaseManager.cfc handles the actual CFQuery calls.

My question is - could this work?

Its probably rubbish code, but hey - its 10.30 on a Sunday night :)

-Bryan


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of barry.b
> Sent: Sunday, 15 February 2004 10:04 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: cfc's and cftransactions
> 
> 
> mate, can you put the idea down as pseudocode, just to make 
> it clear what
> you want to do?
> 
> cheers
> barry.b
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to 
> [EMAIL PROTECTED]
> 
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004
> 


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004




---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to