Possible Bug in ColdFusion 10 Query Caching
I may have stumbled onto a bug when caching queries in ColdFusion 10. I wanted to see if anyone else had seen this before I submitted a bug report. It will be difficult to put together a complete test case, so hopefully a description will be enough to confirm if this is reproducible.
First, I create an array of structures. Each structure is a set of key/value pairs of arguments that will be passed to a query. The first two keys hold numeric values, the third a string value. I am querying a Microsoft SQL Server database. My query is inside an array loop. The query has the CachedWithin attribute set to 1 hour. In the query, I pass the values in the structure into the WHERE clause using CFQueryParam.
If two of the sets of numeric values are similar enough but not identical, ColdFusion will jumble the values and pull back an incorrect cached query result set. As an example, here are the values in my array:
[{BookNo=97,PageNo=1,MapType="Assessor's Map"},{BookNo=212,PageNo=50,MapType="Assessor's Map"},{BookNo=250,PageNo=12,MapType="Assessor's Map"},{BookNo=97,PageNo=1,MapType="Assessor's Map"}]
When I run the page for the first time with an empty query cache, here is what I get:
- Results for BookNo 97, PageNo 1. (not cached)
- Results for BookNo 212, PageNo 50. (not cached)
- Results for BookNo 212, PageNo 50. (cached)
- Results for BookNo 97, PageNo 1. (cached)
What I should get:
- Results for BookNo 97, PageNo 1. (not cached)
- Results for BookNo 212, PageNo 50. (not cached)
- Results for BookNo 250, PageNo 12. (not cached)
- Results for BookNo 97, PageNo 1. (cached)
Notice the problem with the third iteration - it's pulling back the same results from the second iteration. If I remove the CachedWithin, I get the expected results. If I create my own CacheID, I get the expected results. It's only when I let ColdFusion handle the cache on it's own that I get the erroneous results.
Anyone seen anthing like this? Does this look like a legitimate bug that should be filed?
-Carl V.
