Berkeley DB: DB->set_append_recno
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++

# DB->set_append_recno |

`

###

    #include <db.h>

    int
    DB->set_append_recno(DB *,
        int (*db_append_recno_fcn)(DB *dbp, DBT *data, db_recno_t recno));

# Description

When using the DB_APPEND option of the DB->put method, it may be useful to modify the stored data based on the generated key. If a callback function is specified using the DB->set_append_recno function, it will be called after the record number has been selected, but before the data has been stored. The callback function must return 0 on success and errno or a value outside of the Berkeley DB error name space on failure.

The called function must take three arguments: a reference to the enclosing database handle; the data DBT to be stored; and the selected record number. The called function may then modify the data DBT.

If the callback function needs to allocate memory for the data field, the flags field of the returned DBT should be set to DB_DBT_APPMALLOC, which indicates that Berkeley DB should free the memory when it is done with it.

The DB->set_append_recno interface may be used only to configure Berkeley DB before the DB->open interface is called.

The DB->set_append_recno function returns a non-zero error value on failure and 0 on success.

# See Also

db_env_create, DB_ENV->close, DB_ENV->err, DB_ENV->errx DB_ENV->open, DB_ENV->remove, DB_ENV->set_alloc, DB_ENV->set_cachesize, DB_ENV->set_data_dir, DB_ENV->set_errcall, DB_ENV->set_errfile, DB_ENV->set_errpfx, DB_ENV->set_feedback, DB_ENV->set_flags, DB_ENV->set_mutexlocks, db_env_set_pageyield, DB_ENV->set_paniccall, db_env_set_panicstate, DB_ENV->set_recovery_init, DB_ENV->set_rpc_server, db_env_set_region_init, DB_ENV->set_shm_key, db_env_set_tas_spins, DB_ENV->set_tmp_dir, DB_ENV->set_verbose, db_strerror and db_version.`

Copyright Sleepycat Software