Berkeley DB Reference Guide: Database cursors
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++

### Berkeley DB Reference Guide: Access Methods |

# Database cursors

A database cursor is a reference to a single key/data pair in the database. It supports traversal of the database and is the only way to access individual duplicate data items. Cursors are used for operating on collections of records, for iterating over a database, and for saving handles to individual records, so that they can be modified after they have been read.

The DB->cursor function is the standard interface for opening a cursor into a database. Upon return the cursor is uninitialized, positioning occurs as part of the first cursor operation.

Once a database cursor has been opened, there are a set of access method operations that can be performed. Each of these operations is performed using a method referenced from the returned cursor handle.

DBcursor->c_close
  Close the cursor
DBcursor->c_del
  Delete a record
DBcursor->c_dup
  Duplicate a cursor
DBcursor->c_get
  Retrieve a record
DBcursor->c_put
  Store a record

Copyright Sleepycat Software