If so, whats the default <cflock?
Something like this (in the Application.cfm). This assumes that you're
using the session scope on CFMX - if you're using CF 5 or below you
should lock the accesses to the session scope to prevent server
instability:
<cfif NOT IsDefined("Session.Init")>
<cfquery name="myQuery"...>
Your query
</cfquery>
<!--- Do whatever you have to do with your variables
You might only set the results of the query into the session
scope like this: --->
<cfset Session.myQuery = myQuery>
<!--- Now set your marker variable - once this is done this
section of code won't run on the next request for this user --->
<cfset Session.init = true>
</cfif>
There are actually many other ways to do this. One that you might look
into if you're only caching the query (and using it as it's returned) is
to cache the query using the CachedWithin and CachedAfter attributes of
CFQuery. Once you set these if the SAME EXACT query is run again before
the refresh period CF will pull the information from the cache and not
bother hitting the database.
This makes for VERY fast access of the cached query and a very simple
page (no marker variables or persistent scopes needed). There are
limitations - you read the docs on this, but it may be the way to go.
Jim Davis
-----Original Message-----
From: Bushy [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 11:49 AM
To: CF-Talk
Subject: re: application.cfm
HI,
I need to load my database fields into session and cookie variables for
my application. The catch is I only need <cfquery the database once upon
initial log in via Windows NT
authentication. I don't want the datbase queried if a "refresh" is
performed. Where or how can I do this. Sould the <cfquery be in my
application.cfm off the main root of the
website?
/inetpub/wwwroot/website/application.cfm
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

