upscaledb  2.1.13
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends
upscaledb::db Class Reference

#include <upscaledb.hpp>

Public Member Functions

 db ()
 
 ~db ()
 
dboperator= (const db &other)
 
void set_compare_func (ups_compare_func_t foo)
 
record find (txn *t, key *k, uint32_t flags=0)
 
recordfind (txn *t, key *k, record *r, uint32_t flags=0)
 
record find (key *k, uint32_t flags=0)
 
void insert (txn *t, key *k, record *r, uint32_t flags=0)
 
void insert (key *k, record *r, uint32_t flags=0)
 
void erase (key *k, uint32_t flags=0)
 
void erase (txn *t, key *k, uint32_t flags=0)
 
uint64_t count (ups_txn_t *txn=0, uint32_t flags=0)
 
void get_parameters (ups_parameter_t *param)
 
void close (uint32_t flags=0)
 
ups_db_tget_handle ()
 

Static Public Member Functions

static void set_errhandler (ups_error_handler_fun f)
 
static void get_version (uint32_t *major, uint32_t *minor, uint32_t *revision)
 

Protected Member Functions

 db (ups_db_t *db)
 

Private Attributes

ups_db_tm_db
 

Friends

class env
 

Detailed Description

A Database class.

This class wraps the ups_db_t Database handles.

Definition at line 273 of file upscaledb.hpp.

Constructor & Destructor Documentation

upscaledb::db::db ( )
inline

Constructor

Definition at line 287 of file upscaledb.hpp.

upscaledb::db::~db ( )
inline

Destructor - automatically closes the Database, if necessary.

!! Any exception is silently discarded. Use of the destructor to clean up open databases is therefore not recommended, because there are valid reasons why an Exception can be thrown (i.e. not all Cursors of this database were closed).

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

Definition at line 302 of file upscaledb.hpp.

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

upscaledb::db::db ( ups_db_t db)
inlineprotected

Definition at line 429 of file upscaledb.hpp.

Member Function Documentation

void upscaledb::db::close ( uint32_t  flags = 0)
inline

Closes the Database.

Definition at line 408 of file upscaledb.hpp.

References error(), m_db, UPS_AUTO_CLEANUP, and ups_db_close().

Referenced by operator=(), run_demo(), and ~db().

uint64_t upscaledb::db::count ( ups_txn_t txn = 0,
uint32_t  flags = 0 
)
inline

Returns number of items in the Database.

Definition at line 392 of file upscaledb.hpp.

References error(), m_db, and ups_db_count().

void upscaledb::db::erase ( key k,
uint32_t  flags = 0 
)
inline

Erases a key/record pair.

Definition at line 378 of file upscaledb.hpp.

Referenced by run_demo().

void upscaledb::db::erase ( txn t,
key k,
uint32_t  flags = 0 
)
inline

Erases a key/record pair.

Definition at line 383 of file upscaledb.hpp.

References error(), upscaledb::key::get_handle(), upscaledb::txn::get_handle(), m_db, and ups_db_erase().

record upscaledb::db::find ( txn t,
key k,
uint32_t  flags = 0 
)
inline

Finds a record by looking up the key.

Definition at line 335 of file upscaledb.hpp.

References error(), upscaledb::key::get_handle(), upscaledb::record::get_handle(), upscaledb::txn::get_handle(), m_db, and ups_db_find().

Referenced by find(), and run_demo().

record& upscaledb::db::find ( txn t,
key k,
record r,
uint32_t  flags = 0 
)
inline

Finds a record by looking up the key.

Definition at line 347 of file upscaledb.hpp.

References error(), upscaledb::key::get_handle(), upscaledb::record::get_handle(), upscaledb::txn::get_handle(), m_db, and ups_db_find().

record upscaledb::db::find ( key k,
uint32_t  flags = 0 
)
inline

Finds a record by looking up the key.

Definition at line 358 of file upscaledb.hpp.

References find().

ups_db_t* upscaledb::db::get_handle ( )
inline

Returns a pointer to the internal ups_db_t structure.

Definition at line 421 of file upscaledb.hpp.

References m_db.

Referenced by upscaledb::cursor::create().

void upscaledb::db::get_parameters ( ups_parameter_t param)
inline

Retrieves Database parameters.

Definition at line 401 of file upscaledb.hpp.

References error(), m_db, and ups_db_get_parameters().

static void upscaledb::db::get_version ( uint32_t major,
uint32_t minor,
uint32_t revision 
)
inlinestatic

Retrieves the upscaledb library version.

Definition at line 281 of file upscaledb.hpp.

References ups_get_version().

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

Inserts a key/record pair.

Definition at line 363 of file upscaledb.hpp.

References error(), upscaledb::key::get_handle(), upscaledb::record::get_handle(), upscaledb::txn::get_handle(), m_db, and ups_db_insert().

Referenced by insert(), and run_demo().

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

Inserts a key/record pair.

Definition at line 373 of file upscaledb.hpp.

References insert().

db& upscaledb::db::operator= ( const db other)
inline

Assignment operator.

Important! This operator transfers the ownership of the Database handle.

Definition at line 317 of file upscaledb.hpp.

References close(), and m_db.

void upscaledb::db::set_compare_func ( ups_compare_func_t  foo)
inline

Sets the comparison function.

Definition at line 328 of file upscaledb.hpp.

References error(), m_db, and ups_db_set_compare_func().

static void upscaledb::db::set_errhandler ( ups_error_handler_fun  f)
inlinestatic

Set error handler function.

Definition at line 276 of file upscaledb.hpp.

References ups_set_error_handler().

Friends And Related Function Documentation

friend class env
friend

Definition at line 426 of file upscaledb.hpp.

Field Documentation

ups_db_t* upscaledb::db::m_db
private

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