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
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: