tracker issue : CF-3041864

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 83783:In ColdFusion 9

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Rob Bilson / Rob Brooks-Bilson (Rob Bilson)

Created: 08/09/2010

Components: Caching

Versions: 9.0.1

Failure Type: Unspecified

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Major / Unknown

Locale/System: English / Win All

Vote Count: 0

Duplicate ID:	CF-3041863

Problem:

In ColdFusion 9.x, if you take a query object and place it in cache (ehcache using cachePut()), then make any changes to the original query object such as adding colums, ColdFusion is also applying those changes to the query object stored in cache.I understand that query objects are passed by value, but I would not expect that to be the case for items that are stored in cache.   I'm attaching code that demonstrates the problem in two ways.The workaround for now is to use the duplicate() function when you do a cachePut().
Method:

<!--- Demo code to show that ColdFusion's passig query values by reference is crossing boundaries and updating a query stored in cache ---><cfquery name="getArtists" datasource="cfartgallery">select *from artists</cfquery><!--- dump the original query ---><cfdump var="#getArtists#"><!--- put the query in cache ---><cfset cachePut("artistsQuery", getArtists, '#createTimeSpan(0,0,5,0)#', '#createTimeSpan(0,0,5,0)#')><!--- add a column to the query ---><cfset queryAddColumn(getArtists,"newColumn",arrayNew(1))><cfdump var="#getArtists#"><!--- clear the query ---><cfset getArtists=""><cfdump var="#getArtists#"><!--- get the query from cache again - note that the added column is there! ---><cfdump var="#cacheGet("artistsQuery")#"><!--- here's the second example, based on a bug that Ray shows here:  http://www.coldfusionjedi.com/index.cfm/2009/8/28/Another-example-of-the-QofQ-Bug   Note that in this code the dates are being reformatted in cache based on a query of a query ---><cfset mydata = queryNew("mydate, rannum")>    <cfloop index="loop1" from="1" to="5">   <cfset newrow = queryaddrow(mydata, 1)>   <cfset temp = querysetcell(mydata, "mydate", #dateformat(now()-loop1,"dd-mmm-yy")#, #loop1#)>   <cfset temp = querysetcell(mydata, "rannum", 55.65, #loop1#)>  </cfloop><cfdump var="#mydata#"><cfset cachePut("myQuery", myData, '#createTimeSpan(0,0,5,0)#', '#createTimeSpan(0,0,5,0)#')><cfdump var="#mydata#"><cfquery dbtype="query" name="query4graph">  select mydate, rannum from mydata  </cfquery>   <cfdump var="#query4graph#">  <cfdump var="#cacheGet("myQuery")#">
Result:

No error, unexpected behavior.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3041864

External Customer Info:
External Company:  
External Customer Name: Rob Brooks-Bilson
External Customer Email: 6B546ECA439559160AAC0C16
External Test Config: 08/09/2010

Attachments:

Comments: