tracker issue : CF-3949417

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

queryExecute null flag on a param doesn't like evaluating statements

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Tim Mixell / Tim Mixell (Tim Mixell)

Created: 03/06/2015

Components: Database

Versions: 11.0

Failure Type: Crash

Found In Build/Fixed In Build: CF11_Final / CF11 Update7

Priority/Frequency: Normal / Unknown

Locale/System: English / Windows 7 64-bit

Vote Count: 3

Listed in the version 11.0.07.296330 Issues Fixed doc
Related Bugs:
CF-3943345 - Similar to
CF-3944215 - Similar to


I'm used to <cfqueryparam>'s null flag, which will evaluate a statement to determine whether or not to set a field to NULL:

<cfqueryparam cfsqltype="cf_sql_varchar" value="#myValue#" null="#len(myValue) EQ 0#" />

I an error when trying to do something similar using the queryExecute method in cfscript:

queryExecute(
"SQL STATEMENT",
{ myValue: { value: myValue, cfsqltype: "cf_sql_varchar", null: len(myValue) == 0 } },
{ datasource: myDatasource }
);

Throws something along these lines:

{"STACKTRACE":[{"RAW_TRACE":"\tat cfApplication2ecfc663942932$funcLOGREQUEST.runFunction(C:\\gc\\wwwroot\\myApp\\Application.cfc:32)","ID":"CF_CFPAGE","TEMPLATE":"C:\\gc\\wwwroot\\myApp\\Application.cfc","LINE":32,"TYPE":"CFML","COLUMN":0},{"RAW_TRACE":"\tat cfApplication2ecfc663942932$funcONABORT.runFunction(C:\\gc\\wwwroot\\myApp\\Application.cfc:63)","ID":"CF_UDFMETHOD","TEMPLATE":"C:\\gc\\wwwroot\\myApp\\Application.cfc","LINE":63,"TYPE":"CFML","COLUMN":0}],"TAGCONTEXT":"C:\\gc\\wwwroot\\myApp\\Application.cfc [Line 32]","DETAIL":"","ERROR":"java.lang.Boolean cannot be cast to java.lang.String"}

If I use a ternary to return true/false explicitly, the parameter functions as expected:

queryExecute(
"SQL STATEMENT",
{ myValue: { value: myValue, cfsqltype: "cf_sql_varchar", null: len(myValue) == 0 ? true : false } },
{ datasource: myDatasource }
);

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

Watson Bug ID:	3949417

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

Attachments:

Comments:

Alternately, if I wrap the expression in yesNoFormat(), it appears to work as well.
Comment by External U.
8149 | March 06, 2015 09:46:23 AM GMT
This is a frustrating bug for us, as we'd like to move to cfscript syntax, but when the behavior isn't consistent that makes it hard to do.
Vote by External U.
8154 | March 06, 2015 09:51:33 AM GMT
This issue is fixed and the fix will be available as part of next major release of ColdFusion.
Comment by Nimit S.
8150 | September 29, 2015 04:10:38 AM GMT
+1 ......................
Vote by External U.
8155 | September 30, 2015 01:39:33 AM GMT
Um, it's a bug in CF11 so it should be *fixed* for CF11, not CF12.
Comment by External U.
8151 | September 30, 2015 03:41:54 AM GMT
Some people live more in 20 years than others do in 80. It’s not the time that matters, it’s the person.
Vote by External U.
8156 | September 30, 2015 06:41:39 AM GMT
I've noticed a lot of tickets being closed w/ "will be fixed in the next major release". I think CF10 and CF11 should still be supported.. since.. they are. Thanks!, -Aaron
Comment by External U.
8152 | September 30, 2015 01:17:54 PM GMT
Verified this is fixed in CF11 Update 7 (build 11,0,07,296330). Thanks!, -Aaron
Comment by External U.
8153 | December 03, 2015 05:40:41 AM GMT