I hope someone will correct me if I'm wrong on this, but...


When you don't scope a variable, including a query, in a function, it
defaults to the variables scope, which means it can be seen outside of the
function. To make it local to the function you var scope it, this is what
<cfset var queryName = "" /> does. This kind of makes sense to me, annoying
to have to use cfset for a query though.


Are all variables global? No, only if you make them so, or in this case,
don't tell them overwise. Do a dump of the variables scope to see what's in
there, you might be surprised.


<cfdump var="#VARIABLES#" />


Also, does anyone know a similar way to see all var scoped variables?
Dumping var doesn't work.


Ade

-----Original Message-----
From: Jason Wagstaff [mailto:[EMAIL PROTECTED]
Sent: 08 October 2003 15:54
To: CF-Talk
Subject: RE: problems with recursion in cfmx

--- Adrian Lynch <[EMAIL PROTECTED]> wrote:
> Ignore that. I meant to say, in the recursive functions, locally
> scope your
> queries.

that is essentially what i do with using the arguments.foo and it
solved the problem.  but is this what is supppose to happen/intended?
it seems to me that the the query should be scoped to the local
function automatically.  why is it global? why can the other
recursive function calls see it?   Are all variables global?    I
would prefer to have an understanding of why and how instead of (imo)
a workaround.  

jason


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to