Hey Terry,

That's not quite how reference types work...trust me, it's passed by
reference.

Here's a long explanation:

Doing this:

<cfset qry1 = queryNew("column") />

Creates two things:

[query instance] - somewhere in memory
qry1 - a reference to the instance you can use in your code

Doing this:

<cfset qry2 = qry1 />

....we now have three things:
[query instance] - somewhere in memory
qry1 - a reference to [query instance] you can use in your code
qry2 - a reference to [query instance]  you can use in your code

So if we do this (like your struct delete):

<cfset structDelete(variables, "qry1") />

....we don't actually delete the query, but just one of the references
to it, leaving us with this:

[query instance] - somewhere in memory
qry2 - a reference to [query instance]  you can use in your code

If we then deleted qry2 using structDelete, the [query instance] would
no longer have any references, and would then be eligible for garbage
collection.

-Joe

On 1/5/06, Terry Ford <[EMAIL PROTECTED]> wrote:
> Hi Joe,
>
> That's what I used to think, too.  But take the following code:
>
> <cfset q = session.qncache_qn>
> <cfset structdelete(session,"qncache_qn")>
> <cfdump var="#q#">
>
> That cfdump works.  This shows that the whole query HAS been copied to Q.
>
> Regards,
> Terry
>
>
>
> >Hey Terry,
> >
> >Queries are references types in CF, so it's not an issue.   Example:
> >
> ><cfset qry1 = queryNew("column") />
> ><cfset queryAddRow(qry1) />
> ><cfset querySetCell(qry1, "column", "foo") />
> >
> ><cfset qry2 = qry1 />
> ><cfset querySetCell(qry2, "column", "bar") />
> >
> ><cfdump var="#qry1#" />
> ><cfdump var="#qry2#" />
> >
> >-Joe
> >
> >
> >On 1/5/06, Terry Ford <[EMAIL PROTECTED]> wrote:
> >>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228500
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to