Skip to Content.
Sympa Menu

freetds - JDBC SYBMONEY bug [was: Negative SYBMONEY BUG]

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Bob Kline <bkline AT rksystems.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: JDBC SYBMONEY bug [was: Negative SYBMONEY BUG]
  • Date: Thu, 14 Sep 2000 10:11:31 -0400 (EDT)


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
http://www.rksystems.com





  • JDBC SYBMONEY bug [was: Negative SYBMONEY BUG], Bob Kline, 09/14/2000

Archive powered by MHonArc 2.6.24.

Top of Page