--=====================_184807419==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Right.  This is what Allaire recommends in "ColdFusion Best Practices"

<cfquery name="variables.qUser" datasource="#request.dsn#">
         SELECT FirstName, LastName
         FROM Users
         WHERE UserID = #request.UserID#
</cfquery>
<cflock scope="application" timeout="2" type="exclusive">
         <cfset application.qUser = variables.qUser>
</cflock>

at http://www.allaire.com/handlers/index.cfm?id=17318&method=full

But for Structures, this was thrashed out recently in the Fusebox list.  I 
thought the consensus there was not to bother with the additional step of 
copying the structures, and use something like the following in 
qry_globals.cfm or Application.cfm:

<cflock scope="Application" type="ReadOnly" ...>
<CFSET Init = (NOT isDefined("Application.MyStruct") OR Not
isStruct(Application.MyStruct))>
</cflock>
<CFIF Init>
<cflock scope="Application" type="exclusive" ...>
<CFSET Application.MyStruct = StructNew()>
...read data here into Application.MyStruct for some
time....
</cflock>
</CFIF>

(See the posting by BOROVOY on 29 Aug 2000)

best,  paul

At 09:29 PM 9/1/00 -0400, you wrote:
>At 01:48 PM 9/1/2000 -0400, Peter Theobald wrote:
> >Paul, why did you set the data in a temporary structure, then copy it to
>the application structure?
> >Did you intend to put a lock around the application structure?
>
>I don't know about Paul, but I generally build structures in local scope
>and then copy them to application (or session) scope with a single cflock
>for the copy, instead of locking the entire process.  Particularly if I'm
>initializing a bunch of structures, I'll build them all and copy them all
>under one cflock.
>
>Sharon




Paul Smith, Web/Database Droid
A: SupportNet, Inc, 3871 Piedmont Ave, Oakland, CA 94611
P: (510) 763-2358
C: (510) 205-6755
F: (510) 763-2370
E: [EMAIL PROTECTED]
W: http://www.support.net

--=====================_184807419==_.ALT
Content-Type: text/html; charset="us-ascii"

<html>
Right.&nbsp; This is what Allaire recommends in &quot;ColdFusion Best
Practices&quot;<br>
<br>
&lt;cfquery name=&quot;variables.qUser&quot;
datasource=&quot;#request.dsn#&quot;&gt;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>SELECT
FirstName, LastName<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>FROM
Users<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>WHERE
UserID = #request.UserID#<br>
&lt;/cfquery&gt;<br>
&lt;cflock scope=&quot;application&quot; timeout=&quot;2&quot;
type=&quot;exclusive&quot;&gt;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&lt;cfset
application.qUser = variables.qUser&gt;<br>
&lt;/cflock&gt;<br>
<br>
at
<a href="http://www.allaire.com/handlers/index.cfm?id=17318&amp;method=full" 
eudora="autourl">http://www.allaire.com/handlers/index.cfm?id=17318&amp;method=full</a><br>
<br>
But for Structures, this was thrashed out recently in the Fusebox
list.&nbsp; I thought the consensus there was not to bother with the
additional step of copying the structures, and use something like the
following in qry_globals.cfm or Application.cfm:<br>
<br>
&lt;cflock scope=&quot;Application&quot; type=&quot;ReadOnly&quot;
...&gt; <br>
&lt;CFSET Init = (NOT isDefined(&quot;Application.MyStruct&quot;) OR Not
<br>
isStruct(Application.MyStruct))&gt; <br>
&lt;/cflock&gt; <br>
&lt;CFIF Init&gt; <br>
&lt;cflock scope=&quot;Application&quot; type=&quot;exclusive&quot;
...&gt; <br>
&lt;CFSET Application.MyStruct = StructNew()&gt; <br>
...read data here into Application.MyStruct for some <br>
time.... <br>
&lt;/cflock&gt; <br>
&lt;/CFIF&gt;<br>
<br>
(See the posting by BOROVOY on 29 Aug 2000)<br>
<br>
best,&nbsp; paul<br>
<br>
At 09:29 PM 9/1/00 -0400, you wrote:<br>
<blockquote type=cite cite>At 01:48 PM 9/1/2000 -0400, Peter Theobald
wrote:<br>
&gt;Paul, why did you set the data in a temporary structure, then copy it
to<br>
the application structure?<br>
&gt;Did you intend to put a lock around the application structure?<br>
<br>
I don't know about Paul, but I generally build structures in local
scope<br>
and then copy them to application (or session) scope with a single
cflock<br>
for the copy, instead of locking the entire process.&nbsp; Particularly
if I'm<br>
initializing a bunch of structures, I'll build them all and copy them
all<br>
under one cflock.<br>
<br>
Sharon<br>
</blockquote><br>

<br>
<br>
<br>
Paul Smith, Web/Database Droid <br>
A: SupportNet, Inc, 3871 Piedmont Ave, Oakland, CA 94611 <br>
P: (510) 763-2358 <br>
C: (510) 205-6755<br>
F: (510) 763-2370<br>
E: [EMAIL PROTECTED]<br>
W:
<a href="http://www.support.net/" eudora="autourl"><font 
color="#0000FF"><u>http://www.support.net</a><br>
</font></u></html>

--=====================_184807419==_.ALT--

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
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.

Reply via email to