Ahh thanks Niphlod!

On Thursday, November 22, 2012 2:49:28 PM UTC-8, Niphlod wrote:
>
> yep, support for decimal is kinda absent so it's treated "like a string".
>
> On Thursday, November 22, 2012 10:10:23 PM UTC+1, Mark Li wrote:
>>
>> Yes this is on SQLite, is this a problem unique to SQLite?
>>
>> On Thursday, November 22, 2012 1:58:41 AM UTC-8, Niphlod wrote:
>>>
>>> is this on SQLite ?
>>>
>>> On Thursday, November 22, 2012 3:44:38 AM UTC+1, Mark Li wrote:
>>>>
>>>> I currently have a table with 'scores' as one of the fields, with the 
>>>> field type 'double'. 
>>>>
>>>> When I go to fetch a row (ordered by scores) and print the scores, they 
>>>> come back sorted as if they were strings.
>>>> I use the following:
>>>>
>>>> rows = db(db.song_table).select(orderby = db.song_table.scores)
>>>> for x in rows:
>>>>     print x.scores
>>>>
>>>> this prints out the following:
>>>>
>>>> -15.0
>>>> -16.0
>>>> -17.0
>>>> -2.0
>>>> -20.0
>>>> -34.0
>>>> 0.0
>>>> 0.0
>>>> 15.0
>>>> 2.0
>>>> 20.0
>>>>
>>>>
>>>> The scores are ordered as if they were strings, not numbers. However, 
>>>> when you fetch a score, it is still a float, not a string. 
>>>>
>>>> Is this intended behavior, or a bug with field type 'double'? 
>>>>
>>>>
>>>> I am aware that for field type 'integer', the scores are sorted 
>>>> properly, but I will have decimals in my scores.
>>>>
>>>>
>>>>
>>>>

-- 



Reply via email to