Why wouldn't he put it in an Application variable? If it's the same for everyone that 
would make the most sense to me.
<!--- Application.cfm --->
<cflock scope="application" timeout="30" type="exclusive">
  <cfif NOT IsDefined("application.ds")>
    <cfset Application.ds = "mydatasource">
   </cfif>
</cflock>

If you never EVER EVER set it anywhere else, you shouldn't need to lock it for reads, 
would you?

At 04:45 PM 8/29/00 -0400, Dave Watts wrote:
>> In my application.cfm I set a session var for all my queries' 
>> datasource like this:
>> 
>> <cflock scope="session" timeout="30" type="exclusive">
>>  <cfset session.ds = "something_dev">
>> </cflock>
>> 
>> So... Do I need to read-only lock every reference to 
>> session.ds in all my other templates where I have a query 
>> using that datasource session var? e.g.,
>> 
>> <cfquery name="get_year" datasource=#session.ds#>
>> select sysdate from dual
>> </cfquery>
>> 
>> Since session.ds is always identical for every user of this 
>> site, what does it matter if it's locked or not?
>
>The short answer is, yes, you should lock it, because there's a potential
>for memory corruption with multiple concurrent reads, which can occur even
>with session variables.
>
>The longer answer is that if the value is going to be the same for everybody
>using the application, you should store it as a "constant" by putting it
>into the local Variables scope within application.cfm, or even better, the
>Request scope:
>
><cfset Request.ds = "something_dev">
>
>There's no reason to store this on a per-user basis in memory unless each
>user actually gets a different datasource.
>
>Dave Watts, CTO, Fig Leaf Software
>http://www.figleaf.com/
>voice: (202) 797-5496
>fax: (202) 797-5444
>------------------------------------------------------------------------------
>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body. 


---------------------------------------------------------------------------
Peter Theobald, Chief Technology Officer
LiquidStreaming http://www.liquidstreaming.com
[EMAIL PROTECTED]
Phone 1.212.545.1232 Fax 1.212.679.8032

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to