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> </DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial size=2><cflock
scope="Application" timeout="30" type="Exclusive"><BR> <cfif not
IsDefined("application.DS")><BR>  
;
<cfset application.DS = 'my_datasource'><BR>
</cfif><BR></cflock></FONT></SPAN></DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=270081315-15112000><FONT face=Arial size=2>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?
</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> </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> </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. 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.</FONT></P>
<P><FONT SIZE=3D2>e.g.</FONT>
</P>
<P><FONT SIZE=3D2><!--- set the app and session vars to local in the =
locks ---></FONT>
</P>
<P><FONT SIZE=3D2><cflock type=3D"READONLY" =
scope=3D"SESSION" timeout=3D"10"></FONT>
</P>
<P> <FONT SIZE=3D2><CFSET =
variables.dsnSelectFields =3D session.dsnSelectFields></FONT>
<BR> <FONT SIZE=3D2><CFSET =
variables.dsnTables =3D session.dsnTables></FONT>
<BR> <FONT SIZE=3D2><CFSET =
variables.dsnWhere =3D session.dsnWhere></FONT>
</P>
<P><FONT SIZE=3D2></cflock></FONT>
</P>
<P><FONT SIZE=3D2><!--- this is relevant to your =
question ---></FONT>
</P>
<P><FONT SIZE=3D2><cflock type=3D"READONLY" =
scope=3D"APPLICATION" timeout=3D"10"></FONT>
</P>
<P> <FONT SIZE=3D2><cfset =
variables.dsn =3D application.dsn></FONT>
</P>
<P><FONT SIZE=3D2></cflock></FONT>
</P>
<P><FONT SIZE=3D2><!--- /this is relevant to your =
question ---></FONT>
</P>
<P><FONT SIZE=3D2><!--- /set the app and session vars to local in =
the locks ---></FONT>
</P>
<BR>
<P><FONT SIZE=3D2><!--- do the query ---></FONT>
</P>
<P><FONT SIZE=3D2><cfquery name=3D"qryRice" =
datasource=3D"#variables.dsn#"></FONT>
</P>
<P> <FONT SIZE=3D2>SELECT =
#variables.dsnSelectFields#</FONT>
</P>
<P> <FONT =
SIZE=3D2>FROM #variables.dsnTables#</FONT>
</P>
<P> <FONT =
SIZE=3D2>WHERE #variables.dsnWhere#</FONT>
</P>
<P><FONT SIZE=3D2></cfquery></FONT>
</P>
<P><FONT SIZE=3D2><!--- /do the query ---></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> <FONT =
SIZE=3D2>charset=3D"iso-8859-1"</FONT>
</P>
<P><FONT SIZE=3D2>I am setting my datasource value in application.cfm =
with the following:</FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2><cflock scope=3D"Application" =
timeout=3D"30" type=3D"Exclusive"></FONT>
<BR><FONT SIZE=3D2> <cfif not =
IsDefined("application.DS")></FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; <cfset application.DS =3D 'my_datasource'></FONT>
<BR><FONT SIZE=3D2> </cfif></FONT>
<BR><FONT SIZE=3D2></cflock></FONT>
<BR><FONT SIZE=3D2> </FONT>
<BR><FONT SIZE=3D2>Now in my application whenever I reference that =
variable (<cfquery name=3D"X"</FONT>
<BR><FONT SIZE=3D2>datasource=3D"#application.DS#">) is it =
ok not to do a read only lock? </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> </FONT>
<BR><FONT SIZE=3D2>Thanks,</FONT>
<BR><FONT SIZE=3D2>Scott</FONT>
<BR><FONT SIZE=3D2> </FONT>
</P>
<P><FONT SIZE=3D2>------_=3D_NextPart_001_01C04F16.E999BB70</FONT>
<BR><FONT SIZE=3D2>Content-Type: text/html;</FONT>
<BR> <FONT =
SIZE=3D2>charset=3D"iso-8859-1"</FONT>
</P>
<P><FONT SIZE=3D2><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 =
Transitional//EN"></FONT>
<BR><FONT SIZE=3D2><HTML><HEAD></FONT>
<BR><FONT SIZE=3D2><META HTTP-EQUIV=3D"Content-Type" =
CONTENT=3D"text/html; charset=3Diso-8859-1"></FONT>
</P>
<BR>
<P><FONT SIZE=3D2><META content=3D"MSHTML 5.50.4207.2601" =
name=3DGENERATOR></HEAD></FONT>
<BR><FONT SIZE=3D2><BODY></FONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial size=3D2>I am =
setting my </FONT>
<BR><FONT SIZE=3D2>datasource value in application.cfm with the =
following:</FONT></SPAN></DIV></FONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2></FONT></SPAN>&nbsp;</DIV></F=
ONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial =
size=3D2>&lt;cflock </FONT>
<BR><FONT SIZE=3D2>scope=3D"Application" =
timeout=3D"30" =
type=3D"Exclusive"&gt;<BR>&nbsp; &lt;cfif =
not </FONT>
<BR><FONT =
SIZE=3D2>IsDefined("application.DS")&gt;<BR>&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp; </FONT>
<BR><FONT SIZE=3D2>&lt;cfset application.DS =3D =
'my_datasource'&gt;<BR>&nbsp; </FONT>
<BR><FONT =
SIZE=3D2>&lt;/cfif&gt;<BR>&lt;/cflock&gt;</FONT=
></SPAN></DIV></FONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2></FONT></SPAN>&nbsp;</DIV></F=
ONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial size=3D2>Now in =
my </FONT>
<BR><FONT SIZE=3D2>application whenever I reference that variable =
(&lt;cfquery name=3D"X" </FONT>
<BR><FONT SIZE=3D2>datasource=3D"#application.DS#"&gt;) =
is it ok not to do a read only lock?&nbsp; </FONT>
<BR><FONT SIZE=3D2></FONT></SPAN></DIV></FONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial size=3D2>Or do I =
need to lock </FONT>
<BR><FONT SIZE=3D2>it each time I call =
it?</FONT></SPAN></DIV></FONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial size=3D2>The =
value of DS will </FONT>
<BR><FONT SIZE=3D2>never really =
change.</FONT></SPAN></DIV></FONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2></FONT></SPAN>&nbsp;</DIV></F=
ONT>
<BR><FONT SIZE=3D2><DIV><SPAN =
class=3D270081315-15112000><FONT face=3DArial </FONT>
<BR><FONT =
SIZE=3D2>size=3D2>Thanks,</FONT></SPAN></DIV></FONT=
>
<BR><FONT SIZE=3D2><DIV><FONT face=3DArial =
size=3D2>Scott</FONT></DIV></FONT>
<BR><FONT SIZE=3D2><DIV><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV></BODY></HTML>=
;</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]