Berkeley DB Reference Guide:
Access Methods
PrevRefNext

Cursor operations

A database cursor refers 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 method opens a cursor into a database. Upon return the cursor is uninitialized, cursor positioning occurs as part of the first cursor operation.

Once a database cursor has been opened, records may be retrieved (DBcursor->get), stored (DBcursor->put), and deleted (DBcursor->del).

Additional operations supported by the cursor handle include duplication (DBcursor->dup), equality join (DB->join), and a count of duplicate data items (DBcursor->count). Cursors are eventually closed using DBcursor->close.

Database Cursors and Related MethodsDescription
DB->cursorCreate a cursor
DBcursor->closeClose a cursor
DBcursor->countReturn count of duplicates
DBcursor->delDelete by cursor
DBcursor->dupDuplicate a cursor
DBcursor->get, DBcursor->pgetRetrieve by cursor
DBcursor->putStore by cursor
DBcursor->set_prioritySet the cursor's cache priority

PrevRefNext

Copyright (c) 1996,2008 Oracle. All rights reserved.