The reason some developers use application variables for this case is the
variable protection in custom tags. That is, a local variable set in
application.cfm isn't available in a custom tag except with use of the
caller scope. A better approach, and one that avoids the need to <cflock>,
is use of the request scope (not well documented). In application.cfm:
<cfset request.dsn="mydsn">
And everywhere else:
...datasource="#request.dsn#"...
The request scope is non-persistent and non-shared, so it doesn't need to be
locked, but it's available for the entire page request, including custom
tags.
> -----Original Message-----
> From: Al Musella, DPM [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 28, 2000 7:31 AM
> To: [EMAIL PROTECTED]
> Subject: RE: CFLOCKs.... is this really necessary?
>
>
>
> For things like datasource names, wouldn't it just be easier to define
> it in application.cfm as a local variable? Why add the overhead of
> locking / checking if it is defined then setting it, etc... at all?
>
> <cfset DSN = 'mydata'>
>
> instead of
>
> <cflock ...>
> <cfif not(isdefined(application.dsn))>
> <cfset application.dsn = 'mydata'>
> </cfif>
> </cflock>
>
>
> I am getting away from all application and session variables on my new
> sites. They became more trouble than they are worth.
>
> Al Musella
> a1webs.com
>
>
>
>
>
> >They *should* be locked. Realisticly, I've got a million-hit-a-month
> >site that does:
> ><Cfquery name="blah"
> >datasource="#Application.OLEDBDSN#">...</cfquery>
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/[email protected]/
> 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.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.