![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
What I have tried is calling set_dup_compare(dup_compare_fcn_type dup_compare_fcn) on the index. The problem I have is that I was surprised to find that the values passed by Berkeley DB to my dup_compare_fcn are the primary keys rather than the primary values. |
#3
| |||
| |||
|
|
In article <a6ae23bc.0308201927.4fae7cf7 (AT) posting (DOT) google.com>, michael.hollins (AT) silverbrookresearch (DOT) com (Mick Hollins) writes: What I have tried is calling set_dup_compare(dup_compare_fcn_type dup_compare_fcn) on the index. The problem I have is that I was surprised to find that the values passed by Berkeley DB to my dup_compare_fcn are the primary keys rather than the primary values. Did you apply the dup_compare to the primary DB? |
|
I think that you have to apply it to the secondary DB only. |
|
Duplicate keys are not allowed on the primary DB I don't think. Also, I think you should check to make sure that the primary DB has duplicate keys disabled. If there are duplicate keys in the primary DB then there is now way to systematically determine which one is referenced by the secondary. |
#4
| |||
| |||
|
|
I have now gone for a completely different solution to my problem which avoids the use of set_dup_compare altogether. I am now using an index which is totally ordered (i.e. no duplicates) by last-name and then by age so that I can now use Dbc::get(DB_SET_RANGE) to position a cursor at a particular last-name and then use Dbc::get(DB_NEXT) to iterate over all the people with that last-name in age order. Still curious, however, to get a definitive response on whether my belief is true that set_dup_compare is not useful with indexes. |
![]() |
| Thread Tools | |
| Display Modes | |
| |