As I mentioned earlier, I never use the cfquery struct, however, I get frustrated by 
all the inconsistencies in CFMX+.

I think it should be changed to match the "expected" behavior of what the majority of 
developers think it should do.

Macromedia needs to cut down on the "side-effect" issues that force developers to 
create work-arounds.

Along these lines, I would love to see a release of CFMX that included only fixes and 
changes that bring more consistencies to CFMX.  No new features.

-----Original Message-----
From: Christian Cantrell [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 13, 2004 8:54 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] How should I define variable in a CFC?

It's just as we all suspected.  You should indeed scope things like query variables, 
like this...

<cffunction name="myFunction"...>
����� <cfset var q = ""/>
����� <cfquery name="q">
����������� SELECT * FROM Users
����� </cfquery>
����� <cfreturn q/>
</cffunction>

... 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>

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.

Also, are there any other questions in this thread left unanswered?

Christian
----------------------------------------------------------
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