Yep. Something like this:
<cftransaction action="Begin">
<cftry>
<cfquery name="SomeUpdate"...>
</cfquery>
<!--- The Error Handler handles any controled errors --->
<cfmodule
template="MyErrorHandler.cfm"...>
<cftransaction action="commit">
<cfcatch type="Database">
<!--- The Error Handler also takes care of unhandled errors
--->
<cfmodule template="MyErrorHandler.cfm" ...>
</cfcatch>
</cftry>
</cftransaction>
Error Handler Code is similar to this (the parts that matter for this
discussion... <grins>):
<cfif ErrorExists>
<cfif ListFindNoCase(GetBaseTagList(), "CFTRANSACTION") gt 0>
<cftransaction action="rollback">
</cfif>
<cfabort>
</cfif>
But, I get the error I initially reported on the Rollback line.
Hope that helps some.
Shawn Grover
-----Original Message-----
From: Justin Scott [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 11:29 AM
To: CF-Talk
Subject: Re: CFTransaction & Rollback on error?
You are using action="begin" on the opening CFTRANSACTION call right?
-Justin Scott, Lead Developer
Sceiron Internet Services, Inc.
http://www.sceiron.com
----- Original Message -----
From: "Shawn Grover" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, April 16, 2002 1:28 PM
Subject: RE: CFTransaction & Rollback on error?
> Nope, got the same error. Thanks though.
>
> Any other ideas/insight?
>
> Shawn Grover
>
> -----Original Message-----
> From: Justin Scott [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 16, 2002 10:23 AM
> To: CF-Talk
> Subject: Re: CFTransaction & Rollback on error?
>
>
> Just before the CFABORT, try placing the CFTRANSACTION check in again and
> close the transaction if there is one open.
>
> -Justin Scott, Lead Developer
> Sceiron Internet Services, Inc.
> http://www.sceiron.com
>
>
> ----- Original Message -----
> From: "Shawn Grover" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, April 16, 2002 12:17 PM
> Subject: CFTransaction & Rollback on error?
>
>
> > I have a custom tag that handles errors for us. I added these lines of
> code
> > to the tag to do a rollback, if an error occurs and a transaction is in
> the
> > process:
> >
> > <!--- If we are in a transaction, do a rollback --->
> > <cfif ListFindNoCase(getbasetaglist(),"CFTRANSACTION") gt 0>
> > <cftransaction action="ROLLBACK"/>
> > </cfif>
> >
> > However, I keep getting an error saying the rollback MUST be between
> > <cftransaction action=begin> and </cftransaction> tags.
> >
> > My custom tag eventually does a <cfabort> if an error occurs (after
> > displaying appropriate messages). Is that where the problem is? If so,
> do
> > I need to do an explicit rollback like this?
> >
> > Any suggestions are appreciated. Thank you.
> >
> > Shawn Grover
> >
> >
>
>
______________________________________________________________________
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
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists