As promised here is the code to be able to do cftransactions..

-------------------------------------------------------------
<cfset request.dsn = "test" />

<cffunction name="begin">
        <cfquery datasource="#request.dsn#" name="">begin</cfquery>
</cffunction> <cffunction name="rollback">
        <cfquery datasource="#request.dsn#" name="">rollback</cfquery>
</cffunction> <cffunction name="commit">
        <cfquery datasource="#request.dsn#" name="">commit</cfquery>
</cffunction>

<cffunction name="getstatus" output="true">
        <cfquery datasource="#request.dsn#" name="get">
                SELECT *
                FROM test
        </cfquery>
        <p>Current Table Status:</p>
        <cfdump var="#get#" />
</cffunction> 


 
Regards
Andrew Scott
Technical Consultant

NuSphere Pty Ltd
Level 2/33 Bank Street
South Melbourne, Victoria, 3205

Phone: 03 9686 0485  -  Fax: 03 9699 7976


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andrew Scott
Sent: Monday, 16 February 2004 8:28 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: cfc's and cftransactions

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




---
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