My bad.... ignore my last response.... (my mail server is going slow)
this is the proper way to do locking on qry_globals.cfm...

<cfsetting enablecfoutputonly="yes">
<cflock name="#application.applicationname#" timeout="30"
type="readonly">
        <cfset runrequest="no">
        <cfif not isdefined("application.runrequest")>
                <cfset runrequest="yes">
        </cfif>
</cflock>
<cfif runrequest>
        <cfquery name="variables.getlogstart" datasource="#request.logdsn#">
                select min(date_added) as min_date
                        from page_logs
        </cfquery>
        <cfquery name="variables.getstates" datasource="#request.maindsn#">
                select * from states
                where active=1
                order by state_name
        </cfquery>
        <cfset variables.state_rows=structnew()>
        <cfloop query="variables.getstates">
                <cfset variables.state_rows[state_id]=currentrow>
        </cfloop>
        <cfquery name="variables.getcountries" datasource="#request.maindsn#">
                select * from countries
                where active=1
                order by country_id
        </cfquery>
        <cfset variables.country_rows=structnew()>
        <cfloop query="variables.getcountries">
                <cfset variables.country_rows[country_id]=currentrow>
        </cfloop>
        <cfquery  name="variables.getallpaymentmethods"
datasource="#request.maindsn#">
                select * 
                        from payment_methods
                        where active=1
        </cfquery>
        <cfquery  name="variables.k" datasource="#request.maindsn#">
                select * 
                        from k
        </cfquery>
        <cfquery name="variables.gettestdetails"
datasource="#request.maindsn#">
                select t.test_id,t.description,t.how_to_fix,l.language,et.error_type
                        from tests t, languages l,error_types et
                        where t.language_id=l.language_id
                        and t.error_type_id=et.error_type_id
                        and t.active=1
        </cfquery>
        <cfset variables.teststruct=structnew()>
        <cfloop query="variables.gettestdetails">
                <cfset
temp=structinsert(variables.teststruct,test_id,currentrow,"true")>
        </cfloop>
        <cflock name="#application.applicationname#" timeout="30"
type="exclusive">
                <cfset application.getlogstart =variables.getlogstart>
                <cfset application.getstates =variables.getstates>
                <cfset application.state_rows =variables.state_rows>
                <cfset application.getcountries =variables.getcountries>
                <cfset application.country_rows =variables.country_rows>
                <cfset application.getallpaymentmethods
=variables.getallpaymentmethods>
                <cfset application.k =variables.k>
                <cfset application.gettestdetails =variables.gettestdetails>
                <cfset application.teststruct =variables.teststruct>
                <cfset application.runrequest="no">
        </cflock>
</cfif>
<cflock name="#application.applicationname#" timeout="30"
type="readonly">
        <cfset request.k="#request.k##application.k.k#">
</cflock>

<cfif isdefined("client.user_id")>
        <cfquery name="request.getuser" datasource="#request.maindsn#">
                select *
                        from users
                        where user_id=#val(client.user_id)#
        </cfquery>
</cfif>
<cfsetting enablecfoutputonly="no">



Neil Peaslee wrote:
> 
> I just read through the allaire article on locking shared scope variables
> http://www.allaire.com/handlers/index.cfm?ID=17318 and I noticed that there
> are a lot of pitfalls involved in using them. The one place that I thought
> developers should use them is in naming the datasource. However, the article
> claims that the request scope should be used as a datasource variable.
> 
> What are the benefits to using shared scope variables? and what types of
> variables should be set using that scope?
> 
> Neil Peaslee
> 
> ------------------------------------------------------------------------------
> To Unsubscribe visit 
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a 
>message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to