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.