Bob Kline bkline at rksystems.com
Thu Sep 14 10:11:31 EDT 2000

On Thu, 14 Sep 2000, Bob Kline wrote:

> Both MONEY and SMALLMONEY types are defined to preserve accuracy to
> a ten-thousandth of a monetary unit, but the JDBC driver in
> Tds.getMoneyValue appears to be discarding the two least significant
> decimal digits of this precision.  Is this intentional?  It seems
> like an (inappropriate) U.S.-centric view of monetary values.

In case this was unintentional (or even if it was but we can arrange for
a change of heart), here's a patch to fix the money bug in the JDBC
driver (this is against the latest I have locally, as I can't get to
the CVS server):

diff -Naur original/Tds.java modified/Tds.java
--- original/Tds.java   Mon Jul 17 00:41:06 2000
+++ modified/Tds.java   Thu Sep 14 09:49:27 2000
@@ -1804,8 +1804,7 @@
             throw new TdsConfused("Don't know what to do with len of "
                                   + len);
-         x = x.divide(BigInteger.valueOf(100));
-         result = new BigDecimal(x, 2);
+         result = new BigDecimal(x, 4);
       return result;
    } // getMoneyValue

If there is no consensus that it is inappropriate to discard information
here, perhaps we could at least come up with a way to control this
behavior at runtime by adding a property to the connection property set.

Bob Kline
mailto:bkline at rksystems.com

More information about the FreeTDS mailing list