Dave,
I thought that in earlier posts you recommended the following construct:

<cftry>
        <cftransaction>
                <cfquery ...>
                <cfquery ...>
                <cfquery ...>
        </cftransaction>
        <cfcatch>
</cftry>

I thought that you didn't need to explicitly perform commit/rollback.  Is
this correct?

Andy

-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2003 1:09 PM
To: CF-Talk
Subject: RE: Complex <cftransaction> constructions.


> Ok, I've got a <cftransaction> construct such as the pseudo
> code below.
>
> <cftransaction action="begin">
>       <cfquery name=one/>
>
>       <cfquery name=two/>
>
>       <cfquery name=three/>
>
>       <cfquery name=four/>
>
>       <cfif Success>
>               <cftransaction action="commit"/>
>       <cfelse>
>               <cftransaction action="rollback"/>
>       </cfif>
> </cftransaction>

Out of curiosity, why do you have the nested commit and rollback tags? If
you're determining the success of the transaction based on the success of
the queries it contains, you can omit the nested CFTRANSACTION tags.

As for how to handle the nested queries, I think you may have problems if
you try to encapsulate those queries within custom tags or components. I'm
not sure how well database transactional logic works across them. If
possible, I'd recommend using stored procedures, which can easily be wrapped
within transactional logic (which can itself be placed in a stored
procedure). Personally, I find that a more easily manageable way to handle
transactions.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to