db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <jboy...@apache.org>
Subject Format of getString() for DECIMAL type?
Date Mon, 22 Nov 2004 17:32:32 GMT
When getString() is called on a DECIMAL value, Derby implements this by
calling toString() on the underlying BigDecimal object (in
SQLDecimal.getString()).

However, with JDK1.5 the format of the text returned from toString() has
changed; see:
http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html#toString()
http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#toString()
http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#toPlainString()

When running under JDK1.5, should use the VM's native formatting or have
a custom formatter that uses the representation from JDK1.4 and earlier
(perhaps by calling toPlainString())?

If we stick with the native conversion, behaviour will be consistent
with BigDecimal.toString() on any given platform but may vary between
pre- and post- JDK1.5 VMs. If we stick with the old format then the
output from Derby will remain consistent between platforms but on a
JDK1.5 platform will differ from BigDecimal.toString() which may be
surprising to users.

--
Jeremy



Mime
View raw message