Database Driver in 5.3.10.120 returns 0E-8 instead of 0.00000000

Have updated to latest stable release for webp support on image uploads (Great work ! Thank-you !)

Now seeing a strange result, MS SQL DB, where if the field is decimal with 0 value I am getting what looks like a “toString” version of the decimal 0.00000000. Instead I get “0E-8”. Values that are not 0.00000000 in the same query, such as 6.00000000, return correctly.

OS: Windows 10
Lucee: 5.3.10.120
Java: 1.8.0_451
JTDS Driver:
class: ‘net.sourceforge.jtds.jdbc.Driver’
, bundleVersion: ‘1.3.1’

Confirmed that the previous working 5.2.9.31 Lucee instance had identical character encodings to 5.3.10.120:

MS SQL: SQL_Latin1_General_CP1_CI_AS
Lucee Charset:

  • template charset: windows-1252
  • web charset: UTF-8
  • resource charset: windows-1252

And identical DB drivers, both use JTDS 1.3.1

Also happens with MS Driver:
class: ‘com.microsoft.sqlserver.jdbc.SQLServerDriver’
, bundleName: ‘org.lucee.mssql’
, bundleVersion: ‘7.2.2.jre8’

@taivo It starts from 5.3.9.157-SNAPSHOT onwards. For this ticket [LDEV-4103] - Lucee to handle the Large Numbers, we implemented the BigDecimal. After that it return 0E-8 instead of 0 in lucee. Seems ACF also returns 0E-8 instead of 0 in query result.

@cmfmitrah thank-you for this! very interesting.

now I need to figure out how to deal with strings instead of numbers coming from percentage fields from the database…

BigDecimal.toPlainString() does the trick

i.e.
qResult.decimalPercentageFromDatabase.toPlainString()
will give me “0.00000000” (which is a string type) instead of 0E-8 (which is a number type)

Thanks for the help!

1 Like