Yeah, the request rounte it the way to go. I also have a "Settings" table in
my apps for application/request vars used in a particular application. Take
a look at this snip from my application.cfm

<cfscript>
        request.dsSQL = "whatever";
        request.RootURL = "http://whatever.com";;
        request.RootPath = "x:\whatever\whatever.com";
        request.zeroGUID = "00000000-0000-0000-0000-000000000000";

</cfscript>


<!--- create application.setting.Struct and request.setting.Struct --->
<cflock type="READONLY" scope="APPLICATION" timeout="10">
        <cfset locAppDefined = isDefined("application.setting")>
</cflock>

<cfif locAppDefined eq 0 or isDefined("url.resetapp")>
        <cfquery name="qrySettings" datasource="#request.dsSQL#">
                SELECT SettingName, SettingValue
                FROM Settings
        </cfquery>

        <cflock type="EXCLUSIVE" scope="APPLICATION" timeout="10">
                <cfscript>
                        structDelete(application, "setting");
                        application.setting = StructNew();
                        for (i=1; i lte qrySettings.recordCount; i=i+1) {
                                "application.setting.#qrySettings.SettingName[i]#" =
qrySettings.SettingValue[i];
                        }
                </cfscript>
        </cflock>
</cfif>

<cflock type="READONLY" scope="APPLICATION" timeout="10">
        <cfscript>
                request.setting = StructNew();
                request.setting = Duplicate(application.setting);
        </cfscript>
</cflock>


Justin Hansen
--------------------------
Uhlig Communications
Web Developer / Programmer
--------------------------
[EMAIL PROTECTED]
913-498-0123 ext 284
--------------------------

-----Original Message-----
From: Sharon DiOrio [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 26, 2002 11:10 AM
To: CF-Talk
Subject: Re: cfparam vs. cfif/isDefined/cfset


I tend to set all the commonly used defaults as Request scope variables.  No
locking, no <cfparam>, available anywhere.

<cfscript>
    REQUEST.dsn = "myDSN";
    REQUEST.dbType = "dbtype";
    REQUEST.webRoot = "C:/inetpub/wwwroot/";
    etc...
</cfscript>

PS, Good to know that UDFs are faster.  Are there any exceptions to the
rule?

Sharon
----- Original Message -----
From: "Michael Dinowitz" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, March 26, 2002 11:35 AM
Subject: Re: cfparam vs. cfif/isDefined/cfset


> 1. You should lock the entire group with a CFLOCK and a scope of
application.
> 2. An IsDefined() with a set is actually slightly faster than a
CFAPPLICATION. There's even a UDF that does just this and its still faster
even with the small UDF overhead. Note that this is limited to the
isdefined() then default. When you start doing the other things that a
CFPARAM is useful for then the balance changes.
>
> At 11:21 AM 3/26/02, you wrote:
> >Here is my application.cfm file:
> >
> ><cfapplication name="appname" applicationtimeout=#CreateTimeSpan(2, 0, 0,
> >0)#>
> >
> ><cfparam name="application.appnameroot" default="/appname">
> ><cfparam name="application.includesDir" default="/appname/includes">
> ><cfparam name="application.imagesDir" default="/appname/images">
> ><cfparam name="application.menusDir" default="/appname/menus">
> ><cfparam name="application.templatesDir" default="/appname/templates">
> ><cfparam name="application.smapDir" default="/appname/smap">
> >
> >Should I be locking these cfparam tags? Should I wrap them all in one
lock
> >or should I lock each one individually?
> >
> >What is the difference between using cfparam tags as I have above and
using
> >cfif with isDefined and cfset to accomplish the same thing? Is one method
a
> >better practice than the other?
> >
> >Thanks!
> >
> >George
> >[EMAIL PROTECTED]
> >
>

______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to