PDA

View Full Version : MySQL currency storage problem



MarkoSan
15th April 2008, 06:33
Hi to all again, my expert friends! :D

I have, I think it is, basicly non-qt question, but maybe gods like wysota or jpn can help me crack it with qt tricks. Here is it: In MySql database I have a table, which field stores price in EUR in form "x.xx EUR" (2.34 EUR). But what I want is price in form "x,xx EUR" (2,34 EUR). So, when I try to enter a value into MySql table using MySql query browser application with "x,xx EUR", I get error and data is not entered into table. So prices are in MySql stored in a "x.xx EUR" fashion. Is there any way to switch to "x,xx EUR" dynamcilly using Qt? Or how do I set "," char as a legal input char in MySql?

Sincerely,
Marko

marcel
15th April 2008, 08:08
It doesn't work because comma is a column separator in MySQL (and most DBMS's).
One solution would be to convert it in your application to the current locale, or whatever you need.

MarkoSan
15th April 2008, 10:04
So, then I will simply do following:

when the value of price will be read from table into QString, the "." char will be replaced with ",". Thanks, I just wondered if this is possible at MySQL Level.