secondary index key generation function, documentation error?
526209Aug 2 2006 — edited Aug 2 2006Hi all,
I've been looking at documentation on secondary indexes here:
http://www.sleepycat.com/docs/ref/am/second.html
I noticed in the example code a reference to Dbt flag "DB_DBT_APPMALLOC", but it seems as though this flag does not exist. Looking at the Dbt reference page here:
http://www.sleepycat.com/docs/api_cxx/dbt_class.html
the valid Dbt flags are: DB_DBT_MALLOC, DB_DBT_REALLOC, DB_DBT_USERMEM, DB_DBT_PARTIAL. So does this "DB_DBT_APPMALLOC" refer to DB_DBT_USERMEM?
In any case, the problem I'm working through is this; I have a secondary key which must be extracted from Dbt * pdata and stored in user allocated memory. Unfortunately, the documented example doesn't go over this explicitly and I'm a bit new to BDB, so I'm hesitant..
When allocating memory for use by the Dbt secondary key, how long does this memory have to be valid for the secondary index to do its thing? When is it safe to free this? I'm guessing it's intimately tied to the lifetime of the primary key/data Dbt pair, but it isn't very clear from docs.
Thanks for any help!