I would recommend not setting that as an application variable.
I would do
<cfset request.ds = 'my_datasource'>
You can then reference this on all of your pages without worry of locking
Locking only works if you lock ALL reads and writes
If you choose to use an application scope, you should definately lock the
read, but again, I would not use an application scope for this variable
-----Original Message-----
From: Scott Mulholland [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 15, 2000 9: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]
------------------------------------------------------------------------------------------------
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]