Steve:

Let me see if I got this straight.

1. I assume qry_globals.cfm is CFINCLUDED in every FuseAction
Right?

2. Does <cfset request.app=application.requestapp> take much time?
For 100,000 rows, for example.

3. I assume the following is included just an example of an additional 
structure/query that could be stored in application.requestapp:
<cfset request.app.state_rows=structnew()>
         <cfloop query="request.app.getstates">
                 <cfset request.app.state_rows[state_id]=currentrow>
         </cfloop>
Right?

Thanks for making my head hurt (one more time ;-)

best,  paul

At 10:34 AM 8/26/00 -0400, you wrote:
>I've just hit upon a technique that would mean we only ever need to use
>cflock two times in a fusebox home application. This is for application
>variables, session and server variables would need to do the same too i
>imagine (personally i never use them)
>
>First I want to propose a new filename, qry_globals.cfm the point of the
>file is to store application wide queries, it would sit in the root
>directory of your home application.  It would run queries from the
>database upon booting up the server then store the variables into
>memory.  This massively reduces stress on the database, generally it's
>an excellent technique.  The problem has been with cflock.  people
>forget to use it and CF WILL blow up on you if you forget to use
>CFLOCK.  So I figured out a way to bypass all the cflock nonsense and
>only require two cflocks in your entire application, which do very small
>tasks.
>
>Check this code out.  It's wicked cool  (Hal let me know how I did on my
>fusedocs, i'm just starting to get into them, and love 'em!     :)
>
><cfsetting enablecfoutputonly="yes">
><!--- qry_globals.cfm --->
><!---
>|| I start by doing a check to see if the variable
>application.requestapp exists if this
>|| variable exists then I set request.app=application.requestapp and I
>do not rerun any
>|| application wide queries.  If this variable does not exist I rerun
>all the queries
>|| and set application.requestapp=request.app
>||
>|| Then anytime I want one of these values I call it as:
>request.app.queryname instead
>|| of application.queryname.  By doing this I no longer need to use
>cflock in anywhere
>|| other than this file.
>
>|| [EMAIL PROTECTED]
>
>||
>-->
><-- request.app - this is a copy of an application variable called
>application.requestapp
>++> application.requestapp - this is where all application wide queries
>sit
>+++
>--->
><cfset request.maindsn="valuemusiclocal">
><cfapplication name="blbl"
>applicationtimeout="#createtimespan(0,1,0,0)#">
><cflock name="#application.applicationname#" timeout="60"
>type="readonly">
>         <cfif isdefined("application.requestapp")>
>                 <cfset request.app=application.requestapp>
>                 <cfset runrequest="no">
>         <cfelse>
>                 <cfset runrequest="yes">
>         </cfif>
></cflock>
><cfif runrequest>
>         <cfset request.app=structnew()>
>         <cfquery name="request.app.getstates" datasource="#request.maindsn#">
>                 select * from states
>                 where active=1
>                 order by state_name
>         </cfquery>
>         <cfset request.app.state_rows=structnew()>
>         <cfloop query="request.app.getstates">
>                 <cfset request.app.state_rows[state_id]=currentrow>
>         </cfloop>
>         <cflock name="#application.applicationname#" timeout="60"
>type="exclusive">
>                 <cfset application.requestapp=request.app>
>         </cflock>
></cfif>
><cfsetting enablecfoutputonly="no">
>
>
>
>
>
><!--- dsp_address.cfm --->
><!---
>|| I'm demonstrating the use of a request.app variable, note that
>|| I do not need cflock, and I do not need to rerun the getstates query
>
>|| [EMAIL PROTECTED]
>
>||
>-->
><--
>++> request.app.getstates - this is a query with all the states in it
>+++
>--->
><select name="state_id">
><cfoutput query="request.app.getstates">
>         <option value="#state_id#">#state_name#
></cfoutput>
></select>
>
>
>Now that's a beautiful thing! eh?
>
>Steve
>------------------------------------------------------------------------------
>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