dirigible icon indicating copy to clipboard operation
dirigible copied to clipboard

DB Update API doesn't work correctly when using floating-point types

Open iliyan-velichkov opened this issue 2 years ago • 1 comments

Example usage of the update API:

import { update } from "sdk/db";

const UPDATE_BY_CODE = "UPDATE `oc_order_total` SET `value` = ? WHERE (`order_id` = ? AND `code`=?)";

const orderId = 1;
const value = 13.13;
const code = 'total';
const params = [value, orderId, code];
update.execute(UPDATE_BY_CODE, params, 'ElectronicsStoreOpenCartDB');

Results in incorrect value 13, must be 13.13: image

Most probably due to the following code

 parameterElement.getAsInt()

in here

image image

iliyan-velichkov avatar May 14 '24 09:05 iliyan-velichkov

PR: https://github.com/eclipse/dirigible/pull/3929

iliyan-velichkov avatar May 14 '24 10:05 iliyan-velichkov