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:
> Here's the scenario:
>
> A small query (session.cache_query) is cached in each user session at login.
> It is referenced in the following manner in a number of templates:
>
> --------------------
>
> <cfif isdefined("session.cache_query")>
> <cfset q = session.cache_query>
> <cfelse>
> <!--- user w no session or google is here. so we do a query --->
> <Cfquery datasource=ds name=q>
> select...
> </cfquery>
> </cfif>
>
> <cfloop query=q>
> ...
> </cfloop>
>
> ---------------------
>
> Now to my question: I assume that the line <cfset q = session.cache_query>
> copies the query structure to the q variable (instead of passing a pointer)
> because copying by value is what CF likes to do. In this case that is
> needless overhead.
>
> Can anyone suggest a way that I can get around the copying of that query by
> value?
>
> I know that I could do <Cfloop query="session.cache_query">, but then the
> Google "q" query wouldn't work. I really want to be able to reference either
> the cached query or the runtime query by the same variable name, "q".
>
> Thanks,
> Terry
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228466
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