Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Justin Treher / Justin Treher ()
Created: 06/16/2017
Versions: 2016
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: Latest / CF 2016 Update 5
Priority/Frequency: Normal / Some users will encounter
Locale/System: / Windows 10 64 bit
Vote Count: 1
Problem Description: If a query has the cachedWithin attribute, it does not appear to sort using the sort member method with a callback.
Steps to Reproduce:
<cfset colours = queryNew(
"id,en,mi"
, "integer,varchar,varchar", [
[1,"red","apple"]
, [2,"orange","karaka"]
, [3,"yellow","karaka"]
, [4,"green","kakariki"]
, [5,"blue","kikorangi"]
, [6,"indigo","karaka"]
, [10,"violet","papura"]
]
)>
<cfquery dbtype="query" name="colours" result="r">
SELECT *
FROM colours
</cfquery>
<cfquery dbtype="query" name="colours_cached" result="r" cachedwithin="#createTimespan(0, 0, 0, 0)#">
SELECT *
FROM colours
</cfquery>
<cfscript>
writeOutput('Unsorted');
writeDump(colours);
sorter = function(a,b){ return -1;};
colours.sort(sorter);
colours_cached.sort(sorter);
// the order of these should be identical
writeOutput('Colours sorted');
writeDump(colours);
writeOutput('Colours cached sorted (should match colors sorted)');
writeDump(colours_cached);
</cfscript>
https://trycf.com/gist/15213ec7430b83753b758442e3b9417b/acf2016?theme=monokai
Actual Result:
The cached query is not sorting.
Expected Result:
The cached query should sort.
Any Workarounds:
Run duplicate to deep copy the query first.
Attachments:
Comments: