> There does not appear to be a way to scope the "cfquery" struct just
> to the myFunction function.  Is this something people feel they need?
> I personally have never had an issue with behavior, but if others
> have, we can see about getting it changed.

>> I think that every tag that creates its own 'scope' like this ought to
>> do so as if it were declared with 'var' so that the tags are thread
>> safe...

Do you mean that it's better to put a 'var' scope for cffile, cfquery and
Custom tags when it's being called by a persistent CFC!.. I have inside a
persistent CFC a call to a Custom Tag that return me imageinfo.width...
etc... If I'm not declaring imageinfo as 'var' scope... Do I have the risk
that the value that I'm reading is a value of someone else!... Is it what I
can understand of that thread... It's not very clear for me... and of course
I would like to understand!...

Stephane
----- Original Message ----- 
From: "Sean A Corfield" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 13, 2004 11:55 AM
Subject: Re: [CFCDev] How should I define variable in a CFC?


On Feb 13, 2004, at 6:53 AM, Christian Cantrell wrote:
> ... and the "cfquery" struct is stored in the variables scope, which
> is why this works:
>
> <cffunction name="myFunction"...>
> <cfset var q = ""/>
> <cfquery name="q">
> SELECT * FROM Users
> </cfquery>
> <cfset reportExecutionTime()/>
> <cfreturn q/>
> </cffunction>
>
> <cffunction name="reportExecutionTime">
> <cflog text="#cfquery.executionTime#"/>
> </cffunction>

Which means that using "cfquery.*" is not thread safe if your CFC
instance is in a shared scope. That's not good.

What about other 'tag scope' variables like "cfhttp.*" and "cffile.*"?
It sounds like we can't write a CFC to handle file upload and store it
in application scope, for instance, since multiple simultaneous
requests to upload files would trample on each other's
(variables.)cffile.* information?

> There does not appear to be a way to scope the "cfquery" struct just
> to the myFunction function.  Is this something people feel they need?
> I personally have never had an issue with behavior, but if others
> have, we can see about getting it changed.

I think that every tag that creates its own 'scope' like this ought to
do so as if it were declared with 'var' so that the tags are thread
safe...

Sean A Corfield -- http://www.corfield.org/blog/

Got Mach II? -- http://www.mach-ii.com/

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to