dbTalk Databases Forums  

Secondary Databases

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Secondary Databases in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
niagara_man@hotmail.com
 
Posts: n/a

Default Secondary Databases - 11-09-2005 , 02:42 PM






Is it possible to create and load records into a database then create a
secondary database(s)?
How would you recommend populating the secondary databases?
Should I scan through the database and update every record (with the
original value) to create the secondary database(s)?
Thanks


Reply With Quote
  #2  
Old   
Borislav
 
Posts: n/a

Default Re: Secondary Databases - 11-09-2005 , 03:56 PM






There is an option that allows you to tell BDB to do that automatically
for you. In Java, it's:

secondaryConfig.setAllowPopulate(true);

In C/C++ there mus be something similar...

Best,
Boris


Reply With Quote
  #3  
Old   
Michael Cahill
 
Posts: n/a

Default Re: Secondary Databases - 11-09-2005 , 04:59 PM



Yes, this is possible. Just create an empty secondary database and
pass the DB_CREATE flag to the DB->associate call.

Regards,
Michael.


Reply With Quote
  #4  
Old   
niagara_man@hotmail.com
 
Posts: n/a

Default Re: Secondary Databases - 11-10-2005 , 02:31 PM



Is it possible to pass parameters to the call-back function used with
associate()?
How would you recommend creating a call back function for database
layouts that are dynamic (layouts that are not in a structure)?
Thanks


Reply With Quote
  #5  
Old   
Michael Cahill
 
Posts: n/a

Default Re: Secondary Databases - 11-10-2005 , 06:02 PM



Quote:
Is it possible to pass parameters to the call-back function used with
associate()?
The database handle is passed to the callback, so you can hang
additional information from the DB->app_private field.

Quote:
How would you recommend creating a call back function for database
layouts that are dynamic (layouts that are not in a structure)?
I'm not sure exactly what you're asking here, but the main thing to be
aware of is that your callback must return the same secondary for a
given (primary key, data) pair every time it is called. You can't
assume that the callback will only be called the first time the data is
inserted. For example, when you overwrite or delete a record, the
callback is called with the original values, and must return the
original secondary key.

Regards,
Michael.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.