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:228454
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to