You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Jeremy Boynes <jb...@apache.org> on 2004/11/22 02:19:07 UTC

Format of getString() for DECIMAL type?

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