> No need to have a separate "CommitWrite" variable. Just do 
> this:
> 
> <cftransaction><!--- Begin is implied --->
> <cftry>
>       <cfloop>
>       ...DB Inserts here...
>       </cfloop>
> <cfcatch type="Database">
>       <cftransaction action="rollback"/>
> </cfcatch>
> </cftry>
> 
> </cftransaction><!--- Commit is implied --->
> 
> Provided you want all inserts to be performed or none at 
> all...otherwise you need to adjust where the loop is etc.

There's no need to have a CFTRY/CFCATCH just to rollback, either - if any
query fails, the entire transaction will rollback automatically. You only
need to use ACTION="COMMIT" or ACTION="ROLLBACK" within a CFTRANSACTION tag
if you want a partial commit or rollback.

<cftransaction isolation="a_level_that_will_be_safe_for_your_transaction">
        <cfloop>
        ... DB inserts here ...
        </cfloop>
</cftransaction>

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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
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

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to