N
Ninan Thomas
I am posting this to two not so directly related groups. But i feel it
belongs to both.
I am trying to create a database at runtime in Berkeley DB and insert
and retrieve values from it. So I cannot pre compile the schema into a
C++ struct, as explained in the sleepycat documentation.
1) What is the most effecient way to do this? (This is a Berkeley DB
question)
Now coming to the C++ part. To explain the context to C++ newsgroup
readers, Berkeley DB has the concept of key , value pairs to insert
data
Dbt key, value
struct Dbt {
void *data;
int size;
----
-----// some other not so relevant fields
}
They are defined as generic pointers.Also one has to enter the size
in bytes occupied by the pointer.
The solution I came up with is to define a vector.
vector<myType> *x
where myType is a union of int , string and may be some more data
types like timestamp.
Insert the column values into the vector.
My question is how to convert x into a void * pointer and serialize
the data.
I need to find the length in bytes occupied by vector to serialize it.
How to find it. Is raw_storage_iterator the way to go?
belongs to both.
I am trying to create a database at runtime in Berkeley DB and insert
and retrieve values from it. So I cannot pre compile the schema into a
C++ struct, as explained in the sleepycat documentation.
1) What is the most effecient way to do this? (This is a Berkeley DB
question)
Now coming to the C++ part. To explain the context to C++ newsgroup
readers, Berkeley DB has the concept of key , value pairs to insert
data
Dbt key, value
struct Dbt {
void *data;
int size;
----
-----// some other not so relevant fields
}
They are defined as generic pointers.Also one has to enter the size
in bytes occupied by the pointer.
The solution I came up with is to define a vector.
vector<myType> *x
where myType is a union of int , string and may be some more data
types like timestamp.
Insert the column values into the vector.
My question is how to convert x into a void * pointer and serialize
the data.
I need to find the length in bytes occupied by vector to serialize it.
How to find it. Is raw_storage_iterator the way to go?