tracker issue : CF-4204298

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

query parameter for float or decimal errors out once scale is added

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Giancarlo G. / ()

Created: 05/09/2019

Components: Database, CFQuery

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.03.314033 / 314559

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Platforms All

Vote Count: 3

Problem Description:
 When the scale property is added to a query parameter it throws a java.lang.ClassCastException with the specific message of:

java.lang.Integer cannot be cast to java.lang.String

Steps to Reproduce:
 Use the following code. The first example works, the second example errors out.
{code:java}
queryExecute("SELECT :value AS value",{value:{cfsqltype:"decimal",value:2.50}});

queryExecute("SELECT :value AS value",{value:{cfsqltype:"decimal",value:2.50,scale:2}});
{code}
 

Actual Result:
 java.lang.ClassCastException on 2nd example

Expected Result:
 Query object returned

Any Workarounds:
 None

Attachments:

Comments:

This was not included in HF 4 for 2018. The following error is returned now. class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')
Comment by Giancarlo G.
30909 | June 12, 2019 08:35:19 PM GMT
Seems to be as the query is compiled. You can get the error by simply running even you you don't have a datasource setup: {code} <cfscript> result = queryExecute( "SELECT * FROM noDatabaseAtAll WHERE foo > :value", {value:{cfsqltype:"decimal",value:2.5, scale:2}} ); </cfscript> {code} Stacktrace on ACF 2018 Update 4: {code} java.lang.ClassCastException: java.base/java.lang.Integer cannot be cast to java.base/java.lang.String at coldfusion.tagext.sql.QueryUtils.parseAndAddParam(QueryUtils.java:300) at coldfusion.tagext.sql.QueryUtils.processQueryParam(QueryUtils.java:132) at coldfusion.tagext.sql.QueryUtils.executeQuery(QueryUtils.java:65) at coldfusion.runtime.CFPage.QueryExecute(CFPage.java:12280) {code}
Comment by John W.
30910 | June 13, 2019 08:27:32 AM GMT
This issue is fixed now. The fix for this issue will be included as part of next upcoming update. -Nimit
Comment by Nimit S.
30921 | June 14, 2019 10:18:43 AM GMT