I would include isolation="serializable" in your cftransaction tag first to
see if that resolves your problem -- the db server you're using may not
default to serializeable for the transaction type, and I'm not sure if this
might cause partials ... If that still isn't working, then I would try
putting all of your db access in the transaction in the same cfc method.

Isaac
Certified Advanced ColdFusion 5 Developer

www.turnkey.to
954-776-0046

> I was wondering if there are any guidelines regarding
> cftransaction across
> multiple functions in a cfc

> ex:

> <cfcomponent>
>     <cffunction name="f1"...>
>         <!---do some initialization here    --->
>         <cftransaction action = "begin">
>             <!--- call another cfc method that performs
>             database
> interactions--->
>              <cfset rt = f2 (arg1, ...)>
>                   <cfif rt eq 1>
>                         <cftransaction action =
>                         "rollback"/>
>                         <cfreturn 1>
>                    </cfif>
>               <!---  if everything Ok continue with the
>               transaction--->
>               <cfset rt = f3 (arg1, ...)>
>               <cfif rt eq 1>
>                         <cftransaction action =
>                         "rollback"/>
>                         <cfreturn 1>
>               </cfif>
>             <!--- OK--->
>             <!--- do some more db stuff --->
>             <cftransaction action = "commit"/>
>        </cftransaction>
>         <cfreturn 0>
>   </cfunction>

>     <cffunction name="f2"...>
>         <cftry>
>             <cfquery 1>
>                 ......
>             </cfquery>

>             <cfquery 2>
>                 .....
>             </cfquery>
>                <cfcatch type = "database">
>                    <cfreturn 1>
>                 </cfcatch>
>             </cftry>
>     </cffunction>
> </cfcomponent>

> Each of the above function is doing some database
> updates/inserts that are
> surrounded by <cftry><cfcatch>
> that will return an error code to the main function which
> is doing the
> rollback.
> The above doesn't work as expected allowing partial
> commits. So if a db
> error happens in the f2 at the second <cfquery 2> the
> first <cfquery 1>
> actually update the database instead of rolling back .
> It seems that the transaction is not seen in the called
> functions and as
> such each cfquery in the those functions are on their own
> and not part of a
> transaction.

> Any pointers are appreciated.

> thanks

> Marius Milosav
> www.scorpiosoft.com
> It's not about technology, it's about people.
> Virtual Company (VICO) Application Demo
> www.scorpiosoft.com/vicodemo/login.cfm

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ~~~~~~~~~~~|
> Archives:
> http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
> Subscription: http://www.houseoffusion.com/index.cfm?sideb
> ar=lists&body=lists/cf_talk
> FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
> 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



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to