mariadb-corporation / mariadb-connector-nodejs

MariaDB Connector/Node.js is used to connect applications developed on Node.js to MariaDB and MySQL databases. MariaDB Connector/Node.js is LGPL licensed.
GNU Lesser General Public License v2.1
363 stars 93 forks source link

decimal values still string in result of query with decimalAsNumber true #278

Closed mithrandirii closed 2 months ago

mithrandirii commented 4 months ago

I found a problem with values of decimal columns in query result even if decimalAsNumber is set to true.

I think the problem is located here: https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/deca8e11198a9c07a4328c054f0f5b9095d26574/lib/cmd/decoder/text-decoder.js#L155

because Number.isSafeInteger(Number(valDec)) is always returning false if valDec is an decimal value. it's only working correctly for integer values.

how could we solve that ?

mithrandirii commented 4 months ago

Ping

anything missing in my issue?

rusher commented 4 months ago

Thanks for reporting this error, it fell through the cracks in terms of testing. This is now corrected with https://github.com/mariadb-corporation/mariadb-connector-nodejs/commit/8f88f9db129a9c8750a7603511676fb1cb573bdc . (Will be corrected in next version 3.3.0, probably release this week)

mithrandirii commented 4 months ago

ok, thx a lot!

rusher commented 2 months ago

closing since released in 3.3.0