Results 1 to 3 of 3

Thread: MySQL currency storage problem

  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Question MySQL currency storage problem

    Hi to all again, my expert friends!

    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
    Qt 5.3 Opensource & Creator 3.1.2

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MySQL currency storage problem

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: MySQL currency storage problem

    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.
    Qt 5.3 Opensource & Creator 3.1.2

Similar Threads

  1. qt4.3.1 mysql problem
    By twells55555 in forum Qt Programming
    Replies: 5
    Last Post: 8th October 2007, 21:26
  2. problem with plugin mysql
    By jose.va18 in forum Installation and Deployment
    Replies: 2
    Last Post: 19th September 2007, 12:12
  3. qt and mysql encoding problem
    By ferasodh in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2007, 09:48
  4. MySQL starting problem
    By shamik in forum General Discussion
    Replies: 5
    Last Post: 25th April 2007, 07:20
  5. MySql Problem
    By vishesh in forum Installation and Deployment
    Replies: 7
    Last Post: 19th April 2007, 21:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.