cfqueryparam with scale attribute didn't work

Description

When using the cfqueryparam with scale attribute, it didn't work

<cfquery datasource="testdsn"> CREATE TABLE testTable ( amount decimal(18,4)) </cfquery> <cfquery datasource="testdsn"> INSERT INTO testTable (amount) values(<cfqueryparam cfsqltype="CF_SQL_DECIMAL" value="27.178" scale="2">); </cfquery> <cfquery name="queryResult" datasource="testdsn"> select * from testTable </cfquery> <cfdump var="#queryResult#"> // Lucee returns 27.1780 and ACF returns 27.1800

Environment

None

Activity

Show:

Zac Spitzer 2 March 2023 at 01:22
Edited

which didn’t seem to have any effect, at least with sql server. should we be rounding ourselves before passing?

https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/runtime/db/SQLCaster.java#L209

case Types.DECIMAL: case Types.NUMERIC:             int scale = item.getScale();             if (scale == 0) stat.setDouble(parameterIndex, (Caster.toDoubleValue(value)));             else stat.setObject(parameterIndex, (Caster.toDoubleValue(value)), type, scale);             return;

Zac Spitzer 2 March 2023 at 00:57

Pothys - MitrahSoft 22 December 2022 at 07:50

I added a testcase to this ticket
Pull Request: https://github.com/lucee/Lucee/pull/1918

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 21 December 2022 at 11:42
Updated 2 March 2023 at 01:22

Flag notifications