I am using Berkeley DB 11g Release 2, library version 220.127.116.11.21.
I am Beginner.
To describe my Situation.
I need to store 5-10 millions data sets.
The actual data is just one float number.
The write speed doenst matter.
Reads should run fast.
I dont need duplicate items.
The primary key, for these float numbers consists of:
a month date ( type doenst matter that much )
I need to grab the float values with the complete compound key(1digit int&1digit int&1digit int&a month date).
Here comes my problem...
I also need to grad the float values with just one of these, maybe all float numbers of a specifc month date, or of the first digit.
Should I compose the key as a sequence of bytes ?
I guess i don't come around with a secondary database.
In the documentation "Getting started with Berkeley DB C++"
Under the section "Implementing Key Extractors"
They mention "Typically you will base your key on some
information found in a record's data, _but you can also use information found in the primary_
Are my guesses correct or is there something better ?
If i need a Key Extractor, that bases its information found in the primary records key,
can you give me an (code) example ?
I will check this Thread regularly, if i missed something, plz tell me.
Thanks in advance
I solved it myself.
In the primary Database, i am using the keys, comma seperated as one big unique key.
I wrote those keyExtractors for each of the single keys.
associated them to the primary db, and for each of them, one secondary DB.
Some Database Joins / Cursor joins now allow me to get some Data, based on more than one of these single keys.
Its easy to specify the queries i need in SQL, but it took some time to translate that to Berkeley.
I have a new Problem.
My Application must use COleDateTime Class.
This Class includes oledb.h.
Inside of oledb.h they define a DWORD called "DBTYPE", for some structs etc.
Berkeley db.h is using "DBTYPE" for an enumeration.
So i get "error c2371 redefinition different basic types"
Is it a good idea to make a new namespace for this part of Berkeley ?
If so, where is a good place for that.
Any other solution ?
Edit: Looks like i solved this...
#define DBTYPE BDBTYPE
(got this from the forum)
I noticed, saving key.data with less than 4 number of digits causes my Berkeley DB to save the key.data as hexadecimal.
With 4 or more number of digits, Berkeley is storing the actual value.
Is this conventional ?
Thanks in advance
Edited by: 976684 on 20.12.2012 06:32
Edited by: 976684 on 20.12.2012 23:29
Could you please provide more information about your problem, like your BDB code piece? Berkeley DB would not change the data storage if any data type is supported on that platform.
Oracle Berkeley DB