문제

I am using BerkeleyDB 6.0 with bsddb3 python drivers. I have a dataset with BTREE access method having keys as strings representing floating point numbers. I have set a compare function to be used in set_bt_compare().

When I try to use db.set_range(key) function, the keys that the compare function receives are sometimes truncated. for instance,

--------------------------------------------------
'left :1378934633890000.0'
--------------------------------------------------
'right:13789346362'

Here, the right key should be '1378934636286548.8'.

Has anyone seen this problem? have any suggestions as to how to fix it?

Thank you.

도움이 되었습니까?

해결책

Actually it was my fault. I hadn't set the bt_compare method when adding the data. I did that and now there's no truncated data. Just in case anyone else having the same problem, make sure you correctly set the comparison method each time you read/write data.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top