So would this be correct?

<cfquery name="get_count" datasource="#application.datasource#">
        select * from builder where buildtime < '#cleardate#'
</cfquery>

<cfif get_count.RecordCount gt 100>

<cftransaction action="BEGIN">

<cfquery name="get_content" datasource="#application.datasource#">
        delete from boatbuilder where buildtime < '#cleardate#'
</cfquery>

</cftransaction>

</cfif>

Can I also put in a loop driven insert inside the transaction?

> -----Original Message-----
> From: Stephen Moretti [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 11:07 AM
> To: CF-Talk
> Subject: Re: Does this lock look right?
> 
> > <cflock timeout="120" throwontimeout="No" type="EXCLUSIVE">
> >
> > <cfquery name="remove_content"
datasource="#application.datasource#">
> > delete from builder where buildtime < '#cleardate#'
> > </cfquery>
> >
> > </cflock>
> >
> > I just want to make sure nobody triggers this once it has started.
> >
> What do you want to lock?  The use of the application variable or the
> delete
> query?
> 
> If you're after locking the SQL then you need a CFTRANSACTION.
> 
> You still need a lock around the use of the application variable, but,
> rule
> of thumb, never put a cflock around a query.  Your lock will be held
until
> the CFQUERY completes, locking other users out of the application
scope
> (particularly EXCLUSIVE locks) until that time.
> 
> Regards
> 
> Stephen
> 
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
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

Reply via email to