Re: Bug when retrieving money datatype.
От | Mikko Tiihonen |
---|---|
Тема | Re: Bug when retrieving money datatype. |
Дата | |
Msg-id | 4ED5D369.30902@nitorcreations.com обсуждение исходный текст |
Ответ на | Re: Bug when retrieving money datatype. (Oliver Jowett <oliver@opencloud.com>) |
Ответы |
Re: Bug when retrieving money datatype.
|
Список | pgsql-jdbc |
On 11/29/2011 11:51 PM, Oliver Jowett wrote: > On 30 November 2011 10:36, Thomas Kellerer<spam_eater@gmx.net> wrote: > >> Bad value for type double : €100,00 > > Looks like an internationalization problem - the code that handles > parsing money values isn't expecting a euro sign, just a dollar sign. > Is there a standard way to correctly interpret money values formatted > by the server when the client's locale might be different to the > server's? I was planning to add the binary format support for money to the jdbc driver when I had some free time. It will solve all parsing problems related to locale and give nice speed boost at the same time. The current way is a hack where the generic number parsing knows how to ignore $ and (). Of course we should also fix the text format parsing. In both cases I think the correct way is to handle the money as a PGmoney type in jdbc driver. Here is my mental list of what should be improved around the PGmoney: - Use BigDecimal instead of double - Support sending the text format in the server locale - Proper conversion when requested with getBigDecimal, getDouble, getInt, getLong in the driver - Making sure getString of money type will no longer return the $/€ or whatever currency the user might have - add binary encoding support -Mikko
В списке pgsql-jdbc по дате отправления: