tracker issue : CF-3941304

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

Query data type should support keyExists member function

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Tuttle / Adam Tuttle (Adam Tuttle)

Created: 02/17/2015

Components: Language

Versions: 11.0

Failure Type: Usability Issue

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Minor / Some users will encounter

Locale/System: ALL / Platforms All

Vote Count: 1

Listed in the version 2016.0.0.297996 Issues Fixed doc
Verification notes: verified_fixed on August 24, 2019 using build 2016.0.01.298513
You can use structKeyExists() on a query to determine whether or not it includes a column of a specified name. This is useful, for instance, in validating uploaded spreadsheets, because cfspreadsheet gives you a query object back.

However, the .keyExists() member function for queries is not implemented.

I think it should be. What's the harm?

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

Watson Bug ID:	3941304

External Customer Info:
External Company:  
External Customer Name: Adam
External Customer Email:  
External Test Config: N/A



While Calling structKeyExists(), Coldfusion explicitly convert an object to Map if possible. Same can't be done in for member function call. For member function, the object has to be an instance of Map object.
Comment by Awdhesh K.
8398 | August 18, 2015 07:39:16 AM GMT
I do not accept that response, Awdhesh. "It's hard" is not a valid excuse for doing something that will make the language better. Here, let me do part of your job for you: You write a KeyExists member function on your query class that converts the row to a map, then checks to see if the key exists.
Comment by External U.
8399 | August 18, 2015 08:16:01 AM GMT
Same as with exceptions: just implement the same interface on queries. Simple. And what is the status of "open / totest" supposed to mean?
Comment by External U.
8400 | August 19, 2015 12:12:24 AM GMT
Added keyExists for Query via query object. Added new Query function (not diverting the call to StructKeyExists).
Comment by Awdhesh K.
8401 | September 22, 2015 02:58:33 AM GMT
Fix verified on build no: 295636 Test case location: //depot/qa/cf/regression/coretests/coldfusion/member-functions/Struct/Bugs/CF-3941304.cfm
Comment by Suchika S.
8402 | September 22, 2015 05:42:26 AM GMT
+1 ......................
Vote by External U.
8403 | September 23, 2015 12:13:25 AM GMT
Hi Adobe, I've verified this is fixed in CF2016 Update 1 (build 2016.0.01.298513). Thanks!, -Aaron
Comment by Aaron N.
31186 | August 24, 2019 09:41:53 AM GMT