here is a test of simple & complex values. That statement that the rep told
you is false.
HTH,
Robert Hinojosa
[EMAIL PROTECTED]
972.243.4343 x7446
<cflock scope="session" type="exclusive" timeout="4">
<!--- SIMPLE VALUES Passed by value, no duplicate needed.--->
<cfset session.a = "I am A, not B">
<cfset b = "empty">
<cfoutput><li>B:#b#</cfoutput>
<cfset b = session.a>
<cfset session.a = "If B was a pointer, I would be showing">
<cfoutput><li>B: #b#</cfoutput>
<!--- Complex Structure, Duplicate needed --->
<cfset session.test2 = structNew()>
<cfset session.test2.a = structNew()>
<cfset session.test2.a.str = "I am a nested complex structure">
<cfset referenceStruct = structNew()>
<cfset valueStruct = Duplicate(session.test2.a)>
<cfset referenceStruct = session.test2.a>
<cfoutput>
<li> REFERENCE STRUCT: #referenceStruct.str# <li> VALUE
STRUCT:#valueStruct.str#
<cfset session.test2.a.str = "No longer a nested complex structure,
but a pointer">
<li> REFERENCE STRUCT: #referenceStruct.str# <li> VALUE STRUCT:
#valueStruct.str#
</cfoutput>
</cflock>
-----Original Message-----
From: Chris Norloff [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 08, 2001 12:42 PM
To: CF-Talk
Subject: cfset and/or Duplicate() [was:RE: I don't understand session
locking :(
We're right in the throes of this, too. We've been operating under the
understanding that using Duplicate() was necessary ONLY when dealing with
complex variables.
Thus,
<cfset request.variablename = session.variablename>
would work fine as long as session.variablename is not complex.
NOT SO, says MM Tech Support. Seems like cfset ALWAYS sets a pointer rather
than making a copy when dealing with shared-scope variables (session,
application, server).
I gotta test this out, 'cause we've been having some real serious "variable
vanishes" problems, and this could be it.
Sure wish CF worked like it's documented to work.
Chris Norloff
---------- Original Message ----------------------------------
from: David Shadovitz <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
date: Tue, 07 Aug 2001 11:04:21 -0700
>But these variables are simple strings (I think "str" here means "string",
not
>"structure"). There's no need to use Duplicate() for simple CFML
variables.
>
>You may want to use Duplicate() on the entire Session structure, but not on
a
>string.
>
>-David
>
>On Tuesday, August 07, Matthew W Jones
[SMTP:[EMAIL PROTECTED]]
>wrote:
>> Yes
>>
>> -----Original Message-----
>> From: Ken Wilson [mailto:[EMAIL PROTECTED]]
>> Sent: Tuesday, August 07, 2001 10:01 AM
>> Subject: RE: I don't understand session locking :(
>>
>> Wouldn't you actually need to use the Duplicate() function here when
>> referencing the session variable? I seem to recall past discussions that
the
>> process of making a copy in this way actually only created a pointer to
the
>> session variable and left you vulnerable to the locking issue. Using
>> Duplicate(), however, made a true clone of the variable that was free
from
>> the locking issues. As in.....
>>
>> <cfset request.session.strFirstName = Duplicate(session.strFirstName)>
>>
>>
>> #############
>> <!--- lock session and read name/email address --->
>> <cflock scope="session" type="readonly" timeout="30">
>> <cfset request.session.strFirstName = session.strFirstName>
>> <cfset request.session.strLastName = session.strLastName>
>> <cfset request.session.strEmail = session.strEmail>
>> </cflock>
>> #############
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists