tracker issue : CF-4073791

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

[ANeff] Bug for: inconsistency when referencing unset query cell

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

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

Created: 10/14/2015

Components: Language

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win XP All

Vote Count: 1

Listed in the version 2016.0.0.297996 Issues Fixed doc
Verification notes: verified_fixed on August 22, 2019 using build 2016.0.01.298513
When referencing an unset query cell, CF behaves inconsistently.

These return empty string "":
1) myQuery[myCol][myIndex] returns ""
2) myRow.myCol returns "" within a for(myRow in myQuery) loop

This returns NULL:
3) myStruct.myCol returns NULL when myStruct was created via queryGetRow(myQuery, myIndex)

Steps to reproduce:

  q = queryNew("a,b", "", [{a="foo"}]);//leave b[1] unset
  s = queryGetRow(q, 1);//convert the row to a struct

  //reference b[1] in original query object
  writeOutput(isNull(q.b[1]));//returns NO
  writeOutput(q.b[1]);//returns ""

  //reference b[1] in for(row in query)
  for(row in q) {
    writeOutput(isNull(row.b));//returns NO
    writeOutput(row.b);//returns ""
  //reference b[1] in new struct
  writeOutput(isNull(s.b));//returns YES
  writeOutput(s.b);//throws "Element b is undefined in S."

Actual result: inconsistency (sometimes ""; sometimes NULL)

Expected result: consistency (referencing b[1] should behave consistently, regardless of how it's being accessed)

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

Watson Bug ID:	4073791

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email:  
External Test Config: Verified in CF11 Update 5 (build 11,0,05,293506)



+1 ........................
Vote by External U.
5573 | October 15, 2015 03:54:09 AM GMT
We are planning to replace null with empty string in queryGetRow as it happens in for(row in query) s = queryGetRow(q, 1); writeOutput(s.b); will output an empty string.
Comment by Himavanth R.
5570 | October 27, 2015 02:43:17 AM GMT
Hi Himavanth, Excellent! Thank you very much! -Aaron
Comment by External U.
5571 | October 27, 2015 02:51:07 AM GMT
This issue is fixed and the fix for this issue will be available as part of next major release of ColdFusion.
Comment by Nimit S.
5572 | October 28, 2015 05:02:26 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.
31143 | August 22, 2019 08:33:34 AM GMT