DBcursor->put |
#include <db.h>int DBcursor->put(DBC *DBcursor, DBT *key, DBT *data, u_int32_t flags);
The DBcursor->put method stores key/data pairs into the database.
Unless otherwise specified, the DBcursor->put method returns a non-zero error value on failure and 0 on success.
If DBcursor->put fails for any reason, the state of the cursor will be unchanged. If DBcursor->put succeeds and an item is inserted into the database, the cursor is always positioned to refer to the newly inserted item.
ParametersIn the case of the Recno access method, it is an error to specify DB_AFTER if the underlying Recno database was not created with the DB_RENUMBER flag. If the DB_RENUMBER flag was specified, a new key is created, all records after the inserted item are automatically renumbered, and the key of the new record is returned in the structure to which the key parameter refers. The initial value of the key parameter is ignored. See DB->open for more information.
The DB_AFTER flag may not be specified to the Queue access method.
The DBcursor->put method will return DB_NOTFOUND if the current cursor record has already been deleted and the underlying access method is Hash.
In the case of the Recno access method, it is an error to specify DB_BEFORE if the underlying Recno database was not created with the DB_RENUMBER flag. If the DB_RENUMBER flag was specified, a new key is created, the current record and all records after it are automatically renumbered, and the key of the new record is returned in the structure to which the key parameter refers. The initial value of the key parameter is ignored. See DB->open for more information.
The DB_BEFORE flag may not be specified to the Queue access method.
The DBcursor->put method will return DB_NOTFOUND if the current cursor record has already been deleted and the underlying access method is Hash.
The DBcursor->put method will return DB_NOTFOUND if the current cursor record has already been deleted.
If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database and no duplicate sort function has been specified, the inserted data item is added as the first of the data items for that key.
If the underlying database supports duplicate data items, and if the key already exists in the database and a duplicate sort function has been specified, the inserted data item is added in its sorted location. If the key already exists in the database, and no duplicate sort function has been specified, the inserted data item is added as the last of the data items for that key.
The DB_NODUPDATA flag may not be specified to the Queue or Recno access methods.
The DBcursor->put method may fail and return one of the following non-zero errors:
Copyright (c) 1996,2008 Oracle. All rights reserved.