Berkeley DB Reference Guide:
Access Methods

PrevRefNext

Storing records with a cursor

The DBcursor->c_put function is the standard interface for storing records into the database with a cursor. In general, DBcursor->c_put takes a key and inserts the associated data into the database, at a location controlled by a specified flag.

There are several flags that you can set to customize storage:

DB_AFTER
Create a new record, immediately after the record currently referenced by the cursor.

DB_BEFORE
Create a new record, immediately before the record currently referenced by the cursor.

DB_CURRENT
Replace the data part of the record currently referenced by the cursor.

DB_KEYFIRST
Create a new record as the first of the duplicate records for the supplied key.

DB_KEYLAST
Create a new record, as the last of the duplicate records for the supplied key.

In all cases, the cursor is repositioned by a DBcursor->c_put operation to point to the newly inserted key/data pair in the database.

PrevRefNext

Copyright Sleepycat Software