structs with int members -
09-18-2006
, 05:09 AM
I am having a strange problem.
I define the following struct to be the value of a BDB database record
typedef struct my_struct
{
int a;
int b;
} MY_STRUCT;
BUT the procedure of inserting a new record in the database actually
does not work. I am thinking whether there is a general problem of BDB
with integers, because if I use char * for the members of the struct,
the record is inserted. Or maybe I don't set correctly the value
object.
MY_STRUCT test;
test.a = given_a;
test.b = given_b;
tuple.data = &test;
tuple.size = sizeof(test);
dbp->put(dbp, NULL, &key, &tuple, 0)
The key is also an integer but it works fine.
Any ideas?
I also have associated two secondary databases with my primary using
key extractors (in case of integer members) like
skey->data = ((MY_STRUCT*)pdata->data)->a;
skey->size = sizeof(((MY_STRUCT*)pdata->data)->a);
Is it possible that the association of secondary databases is
responsible for the problem? |