[Qt-interest] SQL (ODBC) retreiving doubles incorrectly

Andre Somers andre at familiesomers.nl
Fri Oct 2 15:43:18 CEST 2009


Julien Cugnière wrote:
>
>> I have hacked around the issue for now by multiplying the value I am
>> after in my query, and deviding it by the same value again after
>> retreiving it. Still, this is an extremely ugly hack, and I'd like to
>> get rid of it...
>>     
>
> A slightly better hack would be to prepend "0.0" to the value you get
> if it starts with 'E' or 'e'. Then you can use QString::toDouble().
>
>   
I disagree. My hack actually gets the value I was after, instead of 
returning 0. Only if the value is smaller than 0.000001, I will still 
get 0. That is not a big issue. It remains a very ugly hack nontheless.

André



More information about the Qt-interest-old mailing list