> I know that this topic has been addressed many times, but is 
> the following code the preferred method of CFLOCKING an 
> application variable for a CFQUERY that will only execute 
> once, or should the lock go around the whole thing because 
> of the IsDefined block?
> 
> <CFIF Not IsDefined("application.States")>
>      <CFQUERY NAME="getStates" DATASOURCE="#dsn#">
>      SELECT States from StateTable
>      </CFQUERY>
>      <CFLOCK SCOPE="Application" TIMEOUT="30" TYPE="Exclusive">
>           <CFSET application.States = ValueList(getStates.States)>
>      </CFLOCK>
> </CFIF>

The IsDefined should be locked, so you'd be better off wrapping the entire
block within the CFLOCK.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to