contact | forum | legal | impressum | privacy

hamsterdb API Documentation

 

ham::db Class Reference

#include <hamsterdb.hpp>


Public Member Functions

 db ()
 ~db ()
dboperator= (const db &other)
void create (const char *filename, ham_u32_t flags=0, ham_u32_t mode=0644, ham_parameter_t *param=0)
void open (const char *filename, ham_u32_t flags=0, ham_parameter_t *param=0)
ham_status_t get_error ()
txn begin ()
void set_prefix_compare_func (ham_prefix_compare_func_t foo)
void set_compare_func (ham_compare_func_t foo)
void enable_compression (ham_u32_t level, ham_u32_t flags=0)
record find (txn *t, key *k, ham_u32_t flags=0)
record find (key *k, ham_u32_t flags=0)
void insert (txn *t, key *k, record *r, ham_u32_t flags=0)
void insert (key *k, record *r, ham_u32_t flags=0)
void erase (key *k, ham_u32_t flags=0)
void erase (txn *t, key *k, ham_u32_t flags=0)
void flush (ham_u32_t flags=0)
void close (ham_u32_t flags=0)
ham_db_tget_handle ()

Static Public Member Functions

static void set_errhandler (ham_errhandler_fun f)
static void get_version (ham_u32_t *major, ham_u32_t *minor, ham_u32_t *revision)
static void get_license (const char **licensee, const char **product)

Protected Member Functions

 db (ham_db_t *db)

Private Attributes

ham_db_tm_db

Friends

class env

Detailed Description

A Database class.

This class wraps the ham_db_t Database handles.

Definition at line 246 of file hamsterdb.hpp.


Constructor & Destructor Documentation

ham::db::db (  )  [inline]

Constructor

Definition at line 266 of file hamsterdb.hpp.

ham::db::~db (  )  [inline]

Destructor - automatically closes the Database, if necessary.

Definition at line 270 of file hamsterdb.hpp.

References close().

ham::db::db ( ham_db_t db  )  [inline, protected]

Definition at line 426 of file hamsterdb.hpp.


Member Function Documentation

static void ham::db::set_errhandler ( ham_errhandler_fun  f  )  [inline, static]

Set error handler function.

Definition at line 250 of file hamsterdb.hpp.

References ham_set_errhandler().

static void ham::db::get_version ( ham_u32_t major,
ham_u32_t minor,
ham_u32_t revision 
) [inline, static]

Retrieves the hamsterdb library version.

Definition at line 255 of file hamsterdb.hpp.

References ham_get_version().

static void ham::db::get_license ( const char **  licensee,
const char **  product 
) [inline, static]

Retrieves hamsterdb library license information.

Definition at line 261 of file hamsterdb.hpp.

References ham_get_license().

db& ham::db::operator= ( const db other  )  [inline]

Assignment operator.

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

Definition at line 280 of file hamsterdb.hpp.

References close(), and m_db.

void ham::db::create ( const char *  filename,
ham_u32_t  flags = 0,
ham_u32_t  mode = 0644,
ham_parameter_t param = 0 
) [inline]

Creates a Database.

Definition at line 291 of file hamsterdb.hpp.

References ham_create_ex(), ham_new(), and m_db.

void ham::db::open ( const char *  filename,
ham_u32_t  flags = 0,
ham_parameter_t param = 0 
) [inline]

Opens an existing Database.

Definition at line 304 of file hamsterdb.hpp.

References ham_new(), ham_open_ex(), and m_db.

ham_status_t ham::db::get_error (  )  [inline]

Returns the last Database error.

Definition at line 317 of file hamsterdb.hpp.

References ham_get_error(), and m_db.

txn ham::db::begin (  )  [inline]

Begin a new Transaction

Definition at line 322 of file hamsterdb.hpp.

References get_handle(), and ham_txn_begin().

void ham::db::set_prefix_compare_func ( ham_prefix_compare_func_t  foo  )  [inline]

Sets the prefix comparison function.

Definition at line 331 of file hamsterdb.hpp.

References ham_set_prefix_compare_func(), and m_db.

void ham::db::set_compare_func ( ham_compare_func_t  foo  )  [inline]

Sets the comparison function.

Definition at line 338 of file hamsterdb.hpp.

References ham_set_compare_func(), and m_db.

void ham::db::enable_compression ( ham_u32_t  level,
ham_u32_t  flags = 0 
) [inline]

Enable zlib compression.

Definition at line 345 of file hamsterdb.hpp.

References ham_enable_compression(), and m_db.

record ham::db::find ( txn t,
key k,
ham_u32_t  flags = 0 
) [inline]

Finds a record by looking up the key.

Definition at line 352 of file hamsterdb.hpp.

References ham::record::get_handle(), ham::key::get_handle(), ham::txn::get_handle(), ham_find(), and m_db.

Referenced by find().

record ham::db::find ( key k,
ham_u32_t  flags = 0 
) [inline]

Finds a record by looking up the key.

Definition at line 364 of file hamsterdb.hpp.

References find().

void ham::db::insert ( txn t,
key k,
record r,
ham_u32_t  flags = 0 
) [inline]

Inserts a key/record pair.

Definition at line 369 of file hamsterdb.hpp.

References ham::record::get_handle(), ham::key::get_handle(), ham::txn::get_handle(), ham_insert(), and m_db.

Referenced by insert().

void ham::db::insert ( key k,
record r,
ham_u32_t  flags = 0 
) [inline]

Inserts a key/record pair.

Definition at line 379 of file hamsterdb.hpp.

References insert().

void ham::db::erase ( key k,
ham_u32_t  flags = 0 
) [inline]

Erases a key/record pair.

Definition at line 384 of file hamsterdb.hpp.

void ham::db::erase ( txn t,
key k,
ham_u32_t  flags = 0 
) [inline]

Erases a key/record pair.

Definition at line 389 of file hamsterdb.hpp.

References ham::key::get_handle(), ham::txn::get_handle(), ham_erase(), and m_db.

void ham::db::flush ( ham_u32_t  flags = 0  )  [inline]

Flushes the Database to disk.

Definition at line 398 of file hamsterdb.hpp.

References ham_flush(), and m_db.

void ham::db::close ( ham_u32_t  flags = 0  )  [inline]

Closes the Database.

Definition at line 405 of file hamsterdb.hpp.

References ham_close(), ham_delete(), and m_db.

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

ham_db_t* ham::db::get_handle (  )  [inline]

Returns a pointer to the internal ham_db_t structure.

Definition at line 418 of file hamsterdb.hpp.

References m_db.

Referenced by begin(), and ham::cursor::create().


Friends And Related Function Documentation

friend class env [friend]

Definition at line 423 of file hamsterdb.hpp.


Field Documentation


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

The hamsterdb API

 

Help us!

Found an information that is missing on this page? Please send a mail.