Also, it may help in these situations to think of <cftransaction> as a
kind of DB-based <CFLOCK>

Transactions, depending on the isolation level, may need to lock the db
(either on a row or table basis) to stop any other process making a
change while the transaction completes. It's worth bearing this in mind
if the loop is going to be more than just a few records. I always try
and put the cftransaction around the least amount of code possible, for
this very reason.

  _____  

From: Steve Nelson [mailto:[EMAIL PROTECTED]
Sent: 10 June 2004 19:16
To: CF-Talk
Subject: cftransaction inside or outside cfloops?

Which is better and why?

<cfloop query="whatever">

            <cftransaction>

                        <cfquery>insert....</cfquery>

                        <cfquery>insert....</cfquery>

                        <cfquery>insert....</cfquery>

            </cftransaction>

</cfloop>

Vs.

<cftransaction>

<cfloop query="whatever">

                        <cfquery>insert....</cfquery>

                        <cfquery>insert....</cfquery>

                        <cfquery>insert....</cfquery>

</cfloop>

</cftransaction>

Steve Nelson

  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to