Depends on what effect you want. For example, if you want ALL the
cfqueries to be processed for your entire loop or NONE of them processed
(for example if one fails), then you would want to put the
<cftransaction> outside the loop. However, if you want each record of
'whatever' that is processed by the cfquery's to be committed to the
database even if the app fails before the next record of 'whatever' ,
then you would put it inside the cfloop.
It all depends on your desired result. Bottom line is that if you put
it outside the cfloop, and app or server fails before the entire loop is
finished, then NO changes will be made to your database.
Sincerely,
Dave Phillips
National Marketing Director
Legacy for Life
615-746-3851
[EMAIL PROTECTED]
________________________________
From: Steve Nelson [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 10, 2004 1:16 PM
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]

