
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
Hi, I have a B-Tree database which has the following three columns: + Integer field + Object name field + Data field The integer field servers as the primary key, while the object name field serves as the duplicated key. For example, I have records like this: 1 abc data 1 def data ... ... 2 abc data 2 xyz data ... ... Each row is uniquely identified with the integer ID and the object name field. For some integer keys, say 1 and 2, I want the object name field to be case insensitive, while for some other integer keys, I want the object name field to be case sensitive. How do I achieve this? I call the "set_dup_compare" function to set up a callback function to compare strings. The callback function has this signature: int _dup_compare_fcn(DB* db, const DBT *arg1, const DBT *arg2) One idea is to call the "set_dup_compare" function to switch function pointer based on the integer key value. Another idea is to use the "app_private" member in the DB structure to indicate case sensitivity. Since the application is multi-threaded, I think that I need to mutex a record lookup session to prevent the function pointer from being switched. But then I lose concurrency when populating the table: one thread can populate records for an integer ID while another thread can populate records for another integer ID. Any suggestions? Regards, Jiebo Guan NetIQ Corp
| <-- __Chronological__ --> | <-- __Thread__ --> |