tracker issue : CF-4073759

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

cfquery/queryExecute - Add Return Type

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): Abram Adams / Abram Adams (Abram Adams)

Created: 10/14/2015

Components: Language, Wishlist

Versions: 11.0

Failure Type: Enhancement Request

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Trivial / Unknown

Locale/System: English / Linux

Vote Count: 3

Let's add a return type argument to cfquery and queryExecute that allows at least:

* query - default
* struct - array of structs, like [{id:1,name="bob"},{id:2,name="jill"}] (named struct after the undocumented "struct" serializeByColumn option of serializeJSON - I'd rather it be called "array")
* json - the "struct" option returned as a JSON string

Optionally you could add:
* object - instance of an object that has getters/setters for each column in the query - perhaps another arg to pass a base cfc?
* array - the same as deSerializeJSON( serializeJSON( qry ) )
* jsonArray - the same as serializeJSON( qry )
* custom - function that implements a serializer

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

Watson Bug ID:	4073759

External Customer Info:
External Company:  
External Customer Name: Abram Adams
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

+1 - I'd especially use the array of structs option, which I agree should be called "array"
Vote by External U.
5588 | October 14, 2015 12:40:42 PM GMT
+1 I really like the idea of Array of Structs, and the option of an object with getters /setters.
Vote by External U.
5589 | October 14, 2015 04:19:54 PM GMT
I agree with the premise of this request, but not necessarily the suggestions. Do not repeat the mistakes of the past and just use "array" for an array of structs. Like Lucee, the "struct" returntype should also take a "columnkey" which would need to be unique and output a(n ordered) struct of structs. Like functions, "json" should not be a returntype but perhaps a "returnformat" or just skip it since it can be serialized easily enough.
Comment by Kama S.
5587 | October 13, 2017 05:39:01 PM GMT