You are doing an exclusive lock
on those variables.
No where are you setting any of those
session variables so the exclusive
lock is not needed.
Just
<CFLOCK SCOPE="session" timeout="30" TYPE="ReadOnly">
<cfif #session.susertype# is not "admin">
<cfquery name="get_message" datasource=#variable.ds#>
select message_text
from vcross.messages
where
<cfif #session.susertype# is "student"> [LOCK HERE?]
message_type = 'student'
</cfif>
<cfif #session.susertype# is "faculty"> [LOCK HERE?]
message_type = 'faculty'
</cfif>
</cfquery>
<cfquery name="get_specific_message" datasource=#variable.ds#>
select message_text
from vcross.messages
where message_type = 'specific'
and user_id = #session.suser_id# [LOCK HERE?]
</cfquery>
</cfif>
</CFLOCK>
No nesting you just Lock the session scope to read only
do your processing of session variables and release
the lock.
Were you to do *ANY* setting of the variables
you would need to make the lock exclusive.
The only time a readonly lock actually has to wait
is when there is an exclusive lock on the scope
then thye wait for the exclusive lock to be
released and they read the variables.
Otherwise readonly locks can 'peek' at the variables
all day long until an exclusive lock gets ahold
of a scope :)
Also just to nit pick doing string comparison
is going to be more effecient using the
Compare function :)
try this instead of
<CFIF stringFoo is "faculty">
<CFIF NOT Compare(session.suserType, "faculty")>
<!--- Strings are equal do something --->
</CFIF>
The reason you use the NOT Compare syntax is because
If the strings are equal Compare returns 0 if Lhs string is
less than rhs string it returns a negative value if the string
is greater it returns a positive value (the strings were not equal
yet just doing compare would then mean the statement would evaluate
to the truth which is not what you would intend)
Anyhow ill hush now :)
Jeremy Allen
[EMAIL PROTECTED]
Insert Quarter Here ---->[ ]<----
-----Original Message-----
From: Ricq Pattay [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 31, 2000 10:28 AM
To: [EMAIL PROTECTED]
Subject: YAFLQ (Yet Another "Fine" Locking Question)
If I have references to session variables that are nested, do I need to lock
each reference separately or can I wrap the whole thing in one lock?
e.g.,
<cflock scope="session" timeout="30" type="exclusive">
<cfif #session.susertype# is not "admin">
<cfquery name="get_message" datasource=#variable.ds#>
select message_text
from vcross.messages
where
<cfif #session.susertype# is "student"> [LOCK HERE?]
message_type = 'student'
</cfif>
<cfif #session.susertype# is "faculty"> [LOCK HERE?]
message_type = 'faculty'
</cfif>
</cfquery>
<cfquery name="get_specific_message" datasource=#variable.ds#>
select message_text
from vcross.messages
where message_type = 'specific'
and user_id = #session.suser_id# [LOCK HERE?]
</cfquery>
</cfif>
</cflock>
~~~~~~~~~~~~~~~~~~~~~~~~
Ricq Pattay <[EMAIL PROTECTED]>
Univ of Minnesota - Twin Cities
College of Veterinary Medicine
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
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.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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.