![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a way of permanently associating a secondary index with a primary rather than having to do it explicitly in each application? |
|
I'm looking for the ability to add indices to a database, and maintaining them, without have to recompile my applications. |
|
I can define the keys in terms of integer pairs (location and length of field in the record) so I can write a generic "callback" function to extract the key. |
#3
| |||
| |||
|
|
* Mike: Is there a way of permanently associating a secondary index with a primary rather than having to do it explicitly in each application? No, I don't think so. OK, it seemed like that to me. I was just hoping against hope. :-( |
|
I'm looking for the ability to add indices to a database, and maintaining them, without have to recompile my applications. You could add this information to a configuration file, or a designated database. Yes, that's the sort of thing I was thinking of - a database keyed on |
|
I can define the keys in terms of integer pairs (location and length of field in the record) so I can write a generic "callback" function to extract the key. Sounds useful, but in some cases (most cases for me), column offsets vary with column widths. |
#4
| |||
| |||
|
|
[...] My difficulty is in extracting the key fields from the data record. The "callback" function prototype doesn't allow for suitable parameters to be passed so, it seems, I need a separate "callback" function for each secondary. |
#5
| |||
| |||
|
|
Mike <spamdump (AT) fensoft (DOT) co.uk.invalid> writes: [...] My difficulty is in extracting the key fields from the data record. The "callback" function prototype doesn't allow for suitable parameters to be passed so, it seems, I need a separate "callback" function for each secondary. The callback function gets passed a DB* (of the secondary database), and each of these has an app_private void* field that you can use any way you like. You could point it to a suitable const key extraction info struct when you open the secondary database. Thanks, Patrick. That looks like just the thing I need. :-) |
#6
| |||
| |||
|
|
Florian Weimer wrote: * Mike: Is there a way of permanently associating a secondary index with a primary rather than having to do it explicitly in each application? No, I don't think so. OK, it seemed like that to me. I was just hoping against hope. :-( |
|
Yes, that's the sort of thing I was thinking of - a database keyed on "filename" holding a list of secondary indices. The application would be written to read through that database and open all the secondaries, together with the primary, and automatically associate them. My difficulty is in extracting the key fields from the data record. The "callback" function prototype doesn't allow for suitable parameters to be passed so, it seems, I need a separate "callback" function for each secondary. |
#7
| |||
| |||
|
|
In addition to what Patrick wrote, it might be possible to use subclassing in the C++ version of the library (I haven't checked). You could also keep a hash table of DB pointers. My concern is that once you use the app_private field, you lose generality (because some application might already be using it). |
![]() |
| Thread Tools | |
| Display Modes | |
| |