This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C04F1F.F90F8BE0
Content-Type: text/plain;
        charset="iso-8859-1"



I might recommend setting the app var to a local var in that application.cfm
or the top of the cf page.  Then you lock once.  I preffer not to lock a
query because of session or app vars.  I do all of the locking before the
query by setting all the vars as local.  Seeing how some queries take a good
amount of time to get results form the db the extra hold time on the vars
seems to be quite inefficient.

e.g.

<!--- set the app and session vars to local in the locks --->

<cflock type="READONLY" scope="SESSION" timeout="10">

        <CFSET variables.dsnSelectFields  = session.dsnSelectFields>
        <CFSET variables.dsnTables  = session.dsnTables>
        <CFSET variables.dsnWhere  = session.dsnWhere>

</cflock>

<!---   this is relevant to your question --->

<cflock type="READONLY" scope="APPLICATION" timeout="10">

        <cfset variables.dsn = application.dsn>

</cflock>

<!---   /this is relevant to your question --->

<!--- /set the app and session vars to local in the locks --->


<!---   do the query --->

<cfquery name="qryRice" datasource="#variables.dsn#">

        SELECT #variables.dsnSelectFields#

        FROM     #variables.dsnTables#

        WHERE    #variables.dsnWhere#

</cfquery>

<!---   /do the query --->






-JR

-----Original Message-----
From: Scott Mulholland [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 15, 2000 10:16 AM
To: CF-Talk
Subject: Locking


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C04F16.E999BB70
Content-Type: text/plain;
        charset="iso-8859-1"

I am setting my datasource value in application.cfm with the following:
 
<cflock scope="Application" timeout="30" type="Exclusive">
  <cfif not IsDefined("application.DS")>
            <cfset application.DS = 'my_datasource'>
  </cfif>
</cflock>
 
Now in my application whenever I reference that variable (<cfquery name="X"
datasource="#application.DS#">) is it ok not to do a read only lock?  
Or do I need to lock it each time I call it?
The value of DS will never really change.
 
Thanks,
Scott
 

------_=_NextPart_001_01C04F16.E999BB70
Content-Type: text/html;
        charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 5.50.4207.2601" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=270081315-15112000><FONT face=Arial size=2>I am setting my 
datasource value in application.cfm with the following:</FONT></SPAN></DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial size=2>&lt;cflock 
scope="Application" timeout="30" type="Exclusive"&gt;<BR>&nbsp; &lt;cfif not

IsDefined("application.DS")&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp; 
&lt;cfset application.DS = 'my_datasource'&gt;<BR>&nbsp; 
&lt;/cfif&gt;<BR>&lt;/cflock&gt;</FONT></SPAN></DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial size=2>Now in my 
application whenever I reference that variable (&lt;cfquery name="X" 
datasource="#application.DS#"&gt;) is it ok not to do a read only
lock?&nbsp; 
</FONT></SPAN></DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial size=2>Or do I need to
lock 
it each time I call it?</FONT></SPAN></DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial size=2>The value of DS
will 
never really change.</FONT></SPAN></DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial 
size=2>Thanks,</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2>Scott</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV></BODY></HTML>

------_=_NextPart_001_01C04F16.E999BB70--
----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]

------_=_NextPart_001_01C04F1F.F90F8BE0
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>RE: Locking</TITLE>
</HEAD>
<BODY>
<BR>
<BR>

<P><FONT SIZE=3D2>I might recommend setting the app var to a local var =
in that application.cfm or the top of the cf page.&nbsp; Then you lock =
once.&nbsp; I preffer not to lock a query because of session or app =
vars.&nbsp; I do all of the locking before the query by setting all the =
vars as local.&nbsp; Seeing how some queries take a good amount of time =
to get results form the db the extra hold time on the vars seems to be =
quite inefficient.</FONT></P>

<P><FONT SIZE=3D2>e.g.</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!--- set the app and session vars to local in the =
locks ---&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;cflock type=3D&quot;READONLY&quot; =
scope=3D&quot;SESSION&quot; timeout=3D&quot;10&quot;&gt;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;CFSET =
variables.dsnSelectFields&nbsp; =3D session.dsnSelectFields&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;CFSET =
variables.dsnTables&nbsp; =3D session.dsnTables&gt;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;CFSET =
variables.dsnWhere&nbsp; =3D session.dsnWhere&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;/cflock&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!---&nbsp;&nbsp; this is relevant to your =
question ---&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;cflock type=3D&quot;READONLY&quot; =
scope=3D&quot;APPLICATION&quot; timeout=3D&quot;10&quot;&gt;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>&lt;cfset =
variables.dsn =3D application.dsn&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;/cflock&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!---&nbsp;&nbsp; /this is relevant to your =
question ---&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!--- /set the app and session vars to local in =
the locks ---&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>&lt;!---&nbsp;&nbsp; do the query ---&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;cfquery name=3D&quot;qryRice&quot; =
datasource=3D&quot;#variables.dsn#&quot;&gt;</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=3D2>SELECT =
#variables.dsnSelectFields#</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>FROM&nbsp;&nbsp;&nbsp;&nbsp; #variables.dsnTables#</FONT>
</P>

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>WHERE&nbsp;&nbsp;&nbsp; #variables.dsnWhere#</FONT>
</P>

<P><FONT SIZE=3D2>&lt;/cfquery&gt;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!---&nbsp;&nbsp; /do the query ---&gt;</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
<BR>

<P><FONT SIZE=3D2>-JR</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Scott Mulholland [<A =
HREF=3D"mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Wednesday, November 15, 2000 10:16 AM</FONT>
<BR><FONT SIZE=3D2>To: CF-Talk</FONT>
<BR><FONT SIZE=3D2>Subject: Locking</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>This message is in MIME format. Since your mail =
reader does not understand</FONT>
<BR><FONT SIZE=3D2>this format, some or all of this message may not be =
legible.</FONT>
</P>

<P><FONT SIZE=3D2>------_=3D_NextPart_001_01C04F16.E999BB70</FONT>
<BR><FONT SIZE=3D2>Content-Type: text/plain;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>charset=3D&quot;iso-8859-1&quot;</FONT>
</P>

<P><FONT SIZE=3D2>I am setting my datasource value in application.cfm =
with the following:</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>&lt;cflock scope=3D&quot;Application&quot; =
timeout=3D&quot;30&quot; type=3D&quot;Exclusive&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp; &lt;cfif not =
IsDefined(&quot;application.DS&quot;)&gt;</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; &lt;cfset application.DS =3D 'my_datasource'&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp; &lt;/cfif&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;/cflock&gt;</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>Now in my application whenever I reference that =
variable (&lt;cfquery name=3D&quot;X&quot;</FONT>
<BR><FONT SIZE=3D2>datasource=3D&quot;#application.DS#&quot;&gt;) is it =
ok not to do a read only lock?&nbsp; </FONT>
<BR><FONT SIZE=3D2>Or do I need to lock it each time I call it?</FONT>
<BR><FONT SIZE=3D2>The value of DS will never really change.</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
<BR><FONT SIZE=3D2>Thanks,</FONT>
<BR><FONT SIZE=3D2>Scott</FONT>
<BR><FONT SIZE=3D2>&nbsp;</FONT>
</P>

<P><FONT SIZE=3D2>------_=3D_NextPart_001_01C04F16.E999BB70</FONT>
<BR><FONT SIZE=3D2>Content-Type: text/html;</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2>charset=3D&quot;iso-8859-1&quot;</FONT>
</P>

<P><FONT SIZE=3D2>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 =
Transitional//EN&quot;&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;HTML&gt;&lt;HEAD&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;META HTTP-EQUIV=3D&quot;Content-Type&quot; =
CONTENT=3D&quot;text/html; charset=3Diso-8859-1&quot;&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>&lt;META content=3D&quot;MSHTML 5.50.4207.2601&quot; =
name=3DGENERATOR&gt;&lt;/HEAD&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;BODY&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial size=3D2&gt;I am =
setting my </FONT>
<BR><FONT SIZE=3D2>datasource value in application.cfm with the =
following:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;</F=
ONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial =
size=3D2&gt;&amp;lt;cflock </FONT>
<BR><FONT SIZE=3D2>scope=3D&quot;Application&quot; =
timeout=3D&quot;30&quot; =
type=3D&quot;Exclusive&quot;&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;cfif =
not </FONT>
<BR><FONT =
SIZE=3D2>IsDefined(&quot;application.DS&quot;)&amp;gt;&lt;BR&gt;&amp;nbs=
p;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;=
&amp;nbsp;&amp;nbsp;&amp;nbsp; </FONT>
<BR><FONT SIZE=3D2>&amp;lt;cfset application.DS =3D =
'my_datasource'&amp;gt;&lt;BR&gt;&amp;nbsp; </FONT>
<BR><FONT =
SIZE=3D2>&amp;lt;/cfif&amp;gt;&lt;BR&gt;&amp;lt;/cflock&amp;gt;&lt;/FONT=
&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;</F=
ONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial size=3D2&gt;Now in =
my </FONT>
<BR><FONT SIZE=3D2>application whenever I reference that variable =
(&amp;lt;cfquery name=3D&quot;X&quot; </FONT>
<BR><FONT SIZE=3D2>datasource=3D&quot;#application.DS#&quot;&amp;gt;) =
is it ok not to do a read only lock?&amp;nbsp; </FONT>
<BR><FONT SIZE=3D2>&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial size=3D2&gt;Or do I =
need to lock </FONT>
<BR><FONT SIZE=3D2>it each time I call =
it?&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial size=3D2&gt;The =
value of DS will </FONT>
<BR><FONT SIZE=3D2>never really =
change.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/DIV&gt;</F=
ONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;SPAN =
class=3D270081315-15112000&gt;&lt;FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2&gt;Thanks,&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;</FONT=
>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;FONT face=3DArial =
size=3D2&gt;Scott&lt;/FONT&gt;&lt;/DIV&gt;</FONT>
<BR><FONT SIZE=3D2>&lt;DIV&gt;&lt;FONT face=3DArial =
size=3D2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt=
;</FONT>
</P>

<P><FONT SIZE=3D2>------_=3D_NextPart_001_01C04F16.E999BB70--</FONT>
<BR><FONT =
SIZE=3D2>---------------------------------------------------------------=
---------------------------------</FONT>
<BR><FONT SIZE=3D2>Archives: <A =
HREF=3D"http://www.mail-archive.com/cf-talk@houseoffusion.com/" =
TARGET=3D"_blank">http://www.mail-archive.com/cf-talk@houseoffusion.com/=
</A></FONT>
<BR><FONT SIZE=3D2>Unsubscribe: <A =
HREF=3D"http://www.houseoffusion.com/index.cfm?sidebar=3Dlists" =
TARGET=3D"_blank">http://www.houseoffusion.com/index.cfm?sidebar=3Dlists=
</A> or send a message with 'unsubscribe' in the body to =
[EMAIL PROTECTED]</FONT></P>

</BODY>
</HTML>
------_=_NextPart_001_01C04F1F.F90F8BE0--
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to