I'm not sure about the commit and roll back.  They exist so I use them.  Got
it from some example or the other when I learned <cftransaction>.  There is
other logic in the If blocks that log and report any errors and such.  There
is also a <cftry> block integrated, that I stripped out for simplicity of my
example.

--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA


-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2003 11:09 AM
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

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to