I think you have it right. The following is an alternative:
<CFQUERY
NAME="REQUEST.getstates"
DATASOURCE="#REQUEST.State_DSN#"
CACHEDWITHIN="#CreateTimeSpan(0,12,0,0)#">
SELECT States
FROM StateTable
ORDER BY State_Name
</CFQUERY>
Put the above in application.cfm or app_globals.cfm
No locking required whenever you refer to REQUEST.getstates.states
best, paul
At 10:48 PM 10/23/00 -0400, you wrote:
>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>
>
>tom
>
>------------------------------------------------------------------------------------------------
>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]
------------------------------------------------------------------------------------------------
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]