upscaledb  2.2.1
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_t_db
 

Friends

class env
 

Detailed Description

A Database class.

This class wraps the ups_db_t Database handles.

Definition at line 272 of file upscaledb.hpp.

Constructor & Destructor Documentation

upscaledb::db::db ( )
inline

Constructor

Definition at line 286 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 301 of file upscaledb.hpp.

References upscaledb::error::get_errno().

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

Definition at line 422 of file upscaledb.hpp.

Member Function Documentation

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

Closes the Database. Ignores the flag |UPS_AUTO_CLEANUP|. All objects will be destroyed automatically when they are destructed.

Definition at line 403 of file upscaledb.hpp.

References upscaledb::error::error(), UPS_AUTO_CLEANUP, and ups_db_close().

Referenced by run_demo().

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 384 of file upscaledb.hpp.

References upscaledb::error::error(), and ups_db_count().

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

Erases a key/record pair.

Definition at line 371 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 376 of file upscaledb.hpp.

References upscaledb::error::error(), upscaledb::key::get_handle(), upscaledb::txn::get_handle(), 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 334 of file upscaledb.hpp.

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

Referenced by 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 344 of file upscaledb.hpp.

References upscaledb::error::error(), upscaledb::key::get_handle(), upscaledb::record::get_handle(), upscaledb::txn::get_handle(), 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 353 of file upscaledb.hpp.

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

Returns a pointer to the internal ups_db_t structure.

Definition at line 414 of file upscaledb.hpp.

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

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

Retrieves Database parameters.

Definition at line 393 of file upscaledb.hpp.

References upscaledb::error::error(), 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 280 of file upscaledb.hpp.

References ups_get_version().

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

Inserts a key/record pair.

Definition at line 366 of file upscaledb.hpp.

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

Assignment operator.

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

Definition at line 316 of file upscaledb.hpp.

References _db.

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

Sets the comparison function.

Definition at line 327 of file upscaledb.hpp.

References upscaledb::error::error(), 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 275 of file upscaledb.hpp.

References ups_set_error_handler().

Friends And Related Function Documentation

friend class env
friend

Definition at line 419 of file upscaledb.hpp.

Field Documentation

ups_db_t* upscaledb::db::_db
private

Definition at line 427 of file upscaledb.hpp.

Referenced by operator=().


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