[redland] Bug w/ remove statement under BDB storage
Dave Beckett
dave.beckett at bristol.ac.uk
Tue May 14 16:06:13 BST 2002
>>>Chad House said:
> I poked around the source a bit, and think I've found the problem.
Super! Just when I was going to apologise for not having the time to
investigate for a week or two (am stuck fixing libxml entity bug
resolving which turned out to be a buffer problem in libxml)
> 'librdf_hash_bdb_delete_key_value' in rdf_hash_bdb.c calls the
> database cursor's c_get function with a flag of DB_SET:
>
> /* V2/V3 prototype:
> * int DBcursor->c_get(DBC *cursor, DBT *key, DBT *data, u_int32_t flags);
> */
> ret=dbc->c_get(dbc, &bdb_key, &bdb_value, DB_SET);
> if(ret) {
> dbc->c_close(dbc);
> return 1;
> }
>
> but according to the BDB documentation[1] for the DB_SET flag, "In the
> presence of duplicate key values, DBcursor->c_get will return the
> first data item for the given key" -- which would explain the
> behaviour I was seeing.
>
> I think the flag should be DB_GET_BOTH:
>
> /---
> | DB_GET_BOTH
> |
> | The DB_GET_BOTH flag is identical to the DB_SET flag, except that
> | both the key and the data arguments must be matched by the key and
> | data item in the database.
> \---
>
> I changed the flag in my local copy and now my testcase does the right
> thing.
That looks plausible.
BDB is such a pain sometimes. And now there is V4 as well so I need
to check if Redland works with that while letting V1-3 continue to work.
Cheers
Dave
More information about the redland-dev
mailing list