DBcursor->get API Ref

#include <db.h>

int DBcursor->get(DBC *DBcursor, DBT *key, DBT *data, u_int32_t flags);

int DBcursor->pget(DBC *DBcursor, DBT *key, DBT *pkey, DBT *data, u_int32_t flags);


Description: DBcursor->get

The DBcursor->get method retrieves key/data pairs from the database. The address and length of the key are returned in the object to which key refers (except for the case of the DB_SET flag, in which the key object is unchanged), and the address and length of the data are returned in the object to which data refers.

When called on a cursor opened on a database that has been made into a secondary index using the DB->associate method, the DBcursor->get and DBcursor->pget methods return the key from the secondary index and the data item from the primary database. In addition, the DBcursor->pget method returns the key from the primary database. In databases that are not secondary indices, the DBcursor->pget method will always fail.

Modifications to the database during a sequential scan will be reflected in the scan; that is, records inserted behind a cursor will not be returned while records inserted in front of a cursor will be returned.

In Queue and Recno databases, missing entries (that is, entries that were never explicitly created or that were created and then deleted) will be skipped during a sequential scan.

Unless otherwise specified, the DBcursor->get method returns a non-zero error value on failure and 0 on success.

If DBcursor->get fails for any reason, the state of the cursor will be unchanged.

Parameters
data flags key pkey

Errors

The DBcursor->get method may fail and return one of the following non-zero errors:


DB_BUFFER_SMALL

DB_LOCK_DEADLOCK DB_LOCK_NOTGRANTED

DB_REP_HANDLE_DEAD

DB_REP_LEASE_EXPIRED

DB_REP_LOCKOUT

DB_SECONDARY_BAD

EINVAL


Class DBC
See Also Database Cursors and Related Methods

APIRef

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