upscaledb  2.1.13
Public Member Functions | Protected Member Functions | Private Attributes
upscaledb::cursor Class Reference

#include <upscaledb.hpp>

Public Member Functions

 cursor (db *db=0, txn *t=0, uint32_t flags=0)
 
 cursor (txn *t, db *db=0, uint32_t flags=0)
 
 ~cursor ()
 
void create (db *db, txn *t=0, uint32_t flags=0)
 
cursor clone ()
 
void move (key *k, record *r, uint32_t flags=0)
 
void move_first (key *k=0, record *r=0)
 
void move_last (key *k=0, record *r=0)
 
void move_next (key *k=0, record *r=0)
 
void move_previous (key *k=0, record *r=0)
 
void overwrite (record *r, uint32_t flags=0)
 
void find (key *k, record *r=0, uint32_t flags=0)
 
void insert (key *k, record *r, uint32_t flags=0)
 
void erase (uint32_t flags=0)
 
uint32_t get_duplicate_count (uint32_t flags=0)
 
uint64_t get_record_size ()
 
void close ()
 

Protected Member Functions

 cursor (ups_cursor_t *c)
 

Private Attributes

ups_cursor_tm_cursor
 

Detailed Description

A Database Cursor.

This class wraps the ups_cursor_t Cursor handles.

Definition at line 443 of file upscaledb.hpp.

Constructor & Destructor Documentation

upscaledb::cursor::cursor ( db db = 0,
txn t = 0,
uint32_t  flags = 0 
)
inline

Constructor

Definition at line 446 of file upscaledb.hpp.

References create().

Referenced by clone().

upscaledb::cursor::cursor ( txn t,
db db = 0,
uint32_t  flags = 0 
)
inline

Constructor

Definition at line 452 of file upscaledb.hpp.

References create().

upscaledb::cursor::~cursor ( )
inline

Destructor - automatically closes the Cursor, if necessary.

!! Any exception is silently discarded. Use of the destructor to close cursors is therefore not recommended, because there are valid reasons why an Exception can be thrown.

An assert() was added to catch this condition in debug builds.

Definition at line 467 of file upscaledb.hpp.

References close(), and upscaledb::error::get_errno().

upscaledb::cursor::cursor ( ups_cursor_t c)
inlineprotected

Definition at line 586 of file upscaledb.hpp.

References m_cursor.

Member Function Documentation

cursor upscaledb::cursor::clone ( )
inline

Clones the Cursor.

Definition at line 489 of file upscaledb.hpp.

References cursor(), error(), m_cursor, and ups_cursor_clone().

void upscaledb::cursor::close ( )
inline

Closes the Cursor.

Definition at line 575 of file upscaledb.hpp.

References error(), m_cursor, and ups_cursor_close().

Referenced by create(), and ~cursor().

void upscaledb::cursor::create ( db db,
txn t = 0,
uint32_t  flags = 0 
)
inline

Creates a new Cursor.

Definition at line 477 of file upscaledb.hpp.

References close(), error(), upscaledb::db::get_handle(), m_cursor, and ups_cursor_create().

Referenced by cursor().

void upscaledb::cursor::erase ( uint32_t  flags = 0)
inline

Erases the current key/record pair.

Definition at line 550 of file upscaledb.hpp.

References error(), m_cursor, and ups_cursor_erase().

void upscaledb::cursor::find ( key k,
record r = 0,
uint32_t  flags = 0 
)
inline

Finds a key.

Definition at line 534 of file upscaledb.hpp.

References error(), upscaledb::key::get_handle(), m_cursor, and ups_cursor_find().

Referenced by run_demo().

uint32_t upscaledb::cursor::get_duplicate_count ( uint32_t  flags = 0)
inline

Returns the number of duplicate keys.

Definition at line 557 of file upscaledb.hpp.

References error(), m_cursor, and ups_cursor_get_duplicate_count().

uint64_t upscaledb::cursor::get_record_size ( )
inline

Returns the size of the current record.

Definition at line 566 of file upscaledb.hpp.

References error(), m_cursor, and ups_cursor_get_record_size().

void upscaledb::cursor::insert ( key k,
record r,
uint32_t  flags = 0 
)
inline

Inserts a key/record pair.

Definition at line 542 of file upscaledb.hpp.

References error(), upscaledb::key::get_handle(), upscaledb::record::get_handle(), m_cursor, and ups_cursor_insert().

void upscaledb::cursor::move ( key k,
record r,
uint32_t  flags = 0 
)
inline

Moves the Cursor, and retrieves the key/record of the new position.

Definition at line 498 of file upscaledb.hpp.

References error(), upscaledb::key::get_handle(), upscaledb::record::get_handle(), m_cursor, and ups_cursor_move().

Referenced by move_first(), move_last(), move_next(), move_previous(), and run_demo().

void upscaledb::cursor::move_first ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the first Database element.

Definition at line 506 of file upscaledb.hpp.

References move(), and UPS_CURSOR_FIRST.

void upscaledb::cursor::move_last ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the last Database element.

Definition at line 511 of file upscaledb.hpp.

References move(), and UPS_CURSOR_LAST.

void upscaledb::cursor::move_next ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the next Database element.

Definition at line 516 of file upscaledb.hpp.

References move(), and UPS_CURSOR_NEXT.

Referenced by run_demo().

void upscaledb::cursor::move_previous ( key k = 0,
record r = 0 
)
inline

Moves the Cursor to the previous Database element.

Definition at line 521 of file upscaledb.hpp.

References move(), and UPS_CURSOR_PREVIOUS.

void upscaledb::cursor::overwrite ( record r,
uint32_t  flags = 0 
)
inline

Overwrites the current record.

Definition at line 526 of file upscaledb.hpp.

References error(), upscaledb::record::get_handle(), m_cursor, and ups_cursor_overwrite().

Field Documentation

ups_cursor_t* upscaledb::cursor::m_cursor
private

The documentation for this class was generated from the following file: