tracker issue : CF-4121945

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

[ANeff] Doc Bug for: passing queries by reference

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 02/25/2016

Components: Documentation

Versions: 2016

Failure Type: Unspecified

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Trivial / Few users will encounter

Locale/System: English / Platforms All

Vote Count: 0

https://helpx.adobe.com/coldfusion/developing-applications/accessing-and-using-data/using-query-of-queries/query-of-queries-user-guide.html says:
--------------------------------------------
Passing queries by reference

A Query of Queries is copied by reference from its related query; which means that ColdFusion does not create a query when you create a Query of Queries. It also means that changes to a Query of Queries, such as ordering, modifying, and deleting data, are also applied to the base query object.
If you do not want the original query to change, use the Duplicate function to create a copy and create the Query of Queries using the copied query.
--------------------------------------------

That is not true. In a QoQ, the source query is copied by value. Repro:

<cfscript>
  q1 = queryExecute("SELECT artName FROM art WHERE artID <= 3", [], {datasource="cfartgallery"});
  q2 = queryExecute("SELECT artName FROM q1 ORDER BY artName", [], {dbtype="query"});
  q3 = queryExecute("SELECT artName FROM q2", [], {dbtype="query", maxrows=1});
  querySetCell(q3, "artName", "Foobar", 1);
  writeDump(q1);
  writeDump(q2);
  writeDump(q3);
</cfscript>

Actual and expected result: The queries were copied by value (good). Confirmed in CF11 Update 7 and CF2016.

Thus, that entire "Passing queries by reference" section should be removed from the docs.

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

Watson Bug ID:	4121945

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email:

Attachments:

Comments:

Hi Aaron, Updated the doc at: https://helpx.adobe.com/coldfusion/developing-applications/accessing-and-using-data/using-query-of-queries/query-of-queries-user-guide.html Thank you.
Comment by External U.
4456 | February 26, 2016 02:07:25 AM GMT
Hi Saurav, You're very welcome! I've confirmed the update. Thanks!, -Aaron
Comment by External U.
4457 | March 11, 2016 02:11:24 PM GMT