All complex data types are always passed by reference. Where you set them makes no difference. (Except arrays, which are passed by value due to a staggeringly poor decision eons ago.)
On Thu, Mar 24, 2011 at 3:49 PM, Eric Cobb <[email protected]> wrote: > > I know that complex data types (structs, CFCs, queries, COM/JavaObjects, > etc...) are passed by reference, not by value. But I'm wondering how > that works when storing them in the session scope. > > For example, let's say I have a query that returns a really large result > set, and after that query runs I store the query results as a variable > in the session scope. > > <cfquery name="variables.qry"> > select * > FROM bigTable > </cfquery> > > <cfset session.myQry = variables.qry> > > Would the above code just create a reference to the result set already > in memory, or would it actually create a copy of the results in the > session? > In a similar scenario, what would happen if I had a CFC object stored in > the session, then passed my query results to it to be stored in that > CFCs "variables" scope? > > <cfquery name="variables.qry"> > select * > FROM bigTable > </cfquery> > > <cfset session.myCFC.blah(variables.qry)> > > -- > > Thanks, > > Eric Cobb > http://www.cfgears.com > Help me make a difference this summer. http://bit.ly/i8dJvQ > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343254 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

