Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active January 3, 2020 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamoCA/bc948b141eea337a1927a311e6b500e9 to your computer and use it in GitHub Desktop.
Save JamoCA/bc948b141eea337a1927a311e6b500e9 to your computer and use it in GitHub Desktop.
Misleading QueryAddColumn Error Message (ColdFusion 2016 & 2018)
<!--- 20190103
Tested using ColdFusion 2016,0,13,316217 & 2018,0,06,316308. Lucee 5.3.3.62 does not throw an error.
GIST: https://gist.github.com/JamoCA/bc948b141eea337a1927a311e6b500e9
BLOG: https://dev.to/gamesover/misleading-coldfusion-queryaddcolumn-error-message-1lih
TRYCF: https://www.trycf.com/gist/bc948b141eea337a1927a311e6b500e9
NOTE: Test code on CFFiddle.org to view actual error message. (TryCF displays sanitized error message.)
--->
<cfset myQuery = QueryNew("id", "int")>
<cfset QueryAddColumn(myQuery, "Name", "varchar")>
<!---
To correct error, pass arrayNew(1) as the 4th parameter.
NOTE: No rows exist in this sample, so only an empty array makes sense and probably shouldn't be required.
The misleading error message is:
"Parameter validation error for the QUERYADDCOLUMN function.
The value of parameter 3, which is currently varchar, must be a interface java.util.List value."
The error message should be indicateregarding the missing 4th required param:
"The value of parameter 4 is missing, must be an array value."
--->
<cfdump var="#myQuery#">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment