Query of Queries with maxrows bug
June 19, 2003
I found a bug today in CFMX, CF5 executes the code as you would expect.
Essentially if you do a query of query with maxrows, and then do another q of q on that result, the resulting q of q is using the wrong query and returns the wrong number of rows.
<!--- make a query --->
<cfset q = QueryNew("a,b")>
<cfset r = QueryAddRow(q)>
<cfset QuerySetCell(q, "a", "a1", r)>
<cfset QuerySetCell(q, "b", "b2", r)>
<cfset r = QueryAddRow(q)>
<cfset QuerySetCell(q, "a", "a2", r)>
<cfset QuerySetCell(q, "b", "b3", r)>
<cfset r = QueryAddRow(q)>
<cfset QuerySetCell(q, "a", "a3", r)>
<cfset QuerySetCell(q, "b", "b1", r)>
<!--- dump it, 3 rows --->
<cfdump var="#q#">
<!--- select max rows of 2, 2 rows --->
<cfquery dbtype="query" name="result" maxrows="2">
SELECT * FROM q
ORDER BY a DESC
</cfquery>
<cfdump var="#result#">
<!--- select everything from the 2 row query returns 3 rows? --->
<cfquery dbtype="query" name="result2">
SELECT * FROM result
ORDER BY b DESC
</cfquery>
<cfdump var="#result2#" label="this should only have 2 rows, but it has 3">
I reported this to Macromedia, and they verified it as a bug.
Tweet
Trackbacks
Trackback Address: 46/9758E79A36FA91FF09AC86E52408B4A8
Post a Comment
Spell Checker by Foundeo
Recent Entries
- Speaking at ColdFusion Zeus Preview Event in DC
- Setup ColdFusion 9.0.1 Fully Patched
- Enabling Unlimited Strength Cryptography in ColdFusion
- Nginx redirect www to non www domain
- HashDOS and ColdFusion
- HackMyCF Updated for APSB11-29 Security Hotfix
- Adobe eSeminar on FuseGuard
- Determining Which Cumulative Hotfixes are Installed on ColdFusion


add to del.icio.us



