.I&Berkeley DB: DB->cursor[P

DB->cursor





#include <db.h>

intDB->cursor(DB *db,3 DB_TXN *txnid, DBC **cursorp, u_int32_t flags);





Description



The DB->cursor functionFcreates a cursor and copies a pointer to it into the memory referencedby cursorp.

MA cursor is a structure used to provide sequential access through a database.FThis interface and its associated functions replaces the functionalityHprovided by the seq function in previous releases of Berkeley DB.

;If the file is being accessed under transaction protection,<the txnid parameter is a transaction ID returned fromItxn_begin, otherwise, NULL.GIf transaction protection is enabled, cursors must be opened and closedCwithin the context of a transaction, and the txnid parameterBspecifies the transaction context in which the cursor may be used.

,The flags parameter must be set to 0.

RIn addition, the following value may be set by logically OR'ing it into theflags parameter:

S

DB_RMW
Specify that the cursor will be used to update the database. Thisqflag should only be set when the DB_INIT_CDB flagIwas specified to db_appinit.


The DB->cursorHfunction returns the value of errno on failure, and 0 on success.



Errors

SIf a fatal error occurs in Berkeley DB, the DB->cursor function may fail and returnFDB_RUNRECOVERY, at which point all subsequent database calls will alsoreturn DB_RUNRECOVERY.

The DB->cursor)function may fail and return errnoKfor any of the errors specified for the following Berkeley DB and C library functions:__ham_c_init(3),free(3),4lock_id, malloc(3), memcpy(3),and memset(3).

In addition, the DB->cursor)function may fail and return errnofor the following conditions:

B

EINVAL
An invalid flag value or parameter was specified.







See Also

8db_appexit,8db_appinit,8db_version,2DB->close, DB->cursor,.DB->del,,DB->fd,.DB->get,0DB->join,/db_open,.DB->put,0DB->stat,0DB->sync,;DBcursor->c_close,7DBcursor->c_del,6DBcursor->c_getand7DBcursor->c_put.
ÿÿ