hamsterdb Embedded Database 1.1.13
|
#include <hamsterdb.hpp>
Public Member Functions | |
db () | |
~db () | |
db & | operator= (const db &other) |
void | create (const char *filename, ham_u32_t flags=0, ham_u32_t mode=0644, const ham_parameter_t *param=0) |
void | open (const char *filename, ham_u32_t flags=0, const 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) |
ham_u64_t | get_key_count (ham_txn_t *txn=0, ham_u32_t flags=0) |
void | get_parameters (ham_parameter_t *param) |
void | close (ham_u32_t flags=0) |
ham_db_t * | get_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_t * | m_db |
Friends | |
class | env |
A Database class.
This class wraps the ham_db_t Database handles.
Definition at line 274 of file hamsterdb.hpp.
ham::db::db | ( | ) | [inline] |
Constructor
Definition at line 294 of file hamsterdb.hpp.
ham::db::~db | ( | ) | [inline] |
Destructor - automatically closes the Database, if necessary.
Definition at line 298 of file hamsterdb.hpp.
References close().
ham::db::db | ( | ham_db_t * | db | ) | [inline, protected] |
Definition at line 474 of file hamsterdb.hpp.
txn ham::db::begin | ( | ) | [inline] |
Begin a new Transaction
Definition at line 354 of file hamsterdb.hpp.
References error(), get_handle(), and ham_txn_begin().
void ham::db::close | ( | ham_u32_t | flags = 0 | ) | [inline] |
Closes the Database.
Definition at line 453 of file hamsterdb.hpp.
References error(), ham_close(), ham_delete(), and m_db.
Referenced by operator=(), run_demo(), and ~db().
void ham::db::create | ( | const char * | filename, |
ham_u32_t | flags = 0 , |
||
ham_u32_t | mode = 0644 , |
||
const ham_parameter_t * | param = 0 |
||
) | [inline] |
Creates a Database.
Definition at line 319 of file hamsterdb.hpp.
References error(), ham_create_ex(), ham_new(), and m_db.
Referenced by run_demo().
Enable zlib compression.
Definition at line 377 of file hamsterdb.hpp.
References error(), ham_enable_compression(), and m_db.
Erases a key/record pair.
Definition at line 421 of file hamsterdb.hpp.
References error(), ham::key::get_handle(), ham::txn::get_handle(), ham_erase(), and m_db.
Finds a record by looking up the key.
Definition at line 384 of file hamsterdb.hpp.
References error(), ham::record::get_handle(), ham::key::get_handle(), ham::txn::get_handle(), ham_find(), and m_db.
Referenced by find(), and run_demo().
Finds a record by looking up the key.
Definition at line 396 of file hamsterdb.hpp.
References find().
void ham::db::flush | ( | ham_u32_t | flags = 0 | ) | [inline] |
Flushes the Database to disk.
Definition at line 430 of file hamsterdb.hpp.
References error(), ham_flush(), and m_db.
ham_status_t ham::db::get_error | ( | ) | [inline] |
Returns the last Database error.
Definition at line 347 of file hamsterdb.hpp.
References ham_get_error(), HAM_NOT_INITIALIZED, and m_db.
ham_db_t* ham::db::get_handle | ( | ) | [inline] |
Returns a pointer to the internal ham_db_t structure.
Definition at line 466 of file hamsterdb.hpp.
References m_db.
Referenced by begin(), and ham::cursor::create().
Returns number of items in the Database.
Definition at line 437 of file hamsterdb.hpp.
References error(), ham_get_key_count(), and m_db.
static void ham::db::get_license | ( | const char ** | licensee, |
const char ** | product | ||
) | [inline, static] |
Retrieves hamsterdb library license information.
Definition at line 289 of file hamsterdb.hpp.
References ham_get_license().
void ham::db::get_parameters | ( | ham_parameter_t * | param | ) | [inline] |
Retrieves Database parameters.
Definition at line 446 of file hamsterdb.hpp.
References error(), ham_get_parameters(), and m_db.
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 283 of file hamsterdb.hpp.
References ham_get_version().
Inserts a key/record pair.
Definition at line 401 of file hamsterdb.hpp.
References error(), ham::record::get_handle(), ham::key::get_handle(), ham::txn::get_handle(), ham_insert(), and m_db.
Referenced by insert(), and run_demo().
void ham::db::open | ( | const char * | filename, |
ham_u32_t | flags = 0 , |
||
const ham_parameter_t * | param = 0 |
||
) | [inline] |
Opens an existing Database.
Definition at line 333 of file hamsterdb.hpp.
References error(), ham_new(), ham_open_ex(), and m_db.
Referenced by run_demo().
Assignment operator.
Important! This operator transfers the ownership of the Database handle.
Definition at line 308 of file hamsterdb.hpp.
void ham::db::set_compare_func | ( | ham_compare_func_t | foo | ) | [inline] |
Sets the comparison function.
Definition at line 370 of file hamsterdb.hpp.
References error(), ham_set_compare_func(), and m_db.
static void ham::db::set_errhandler | ( | ham_errhandler_fun | f | ) | [inline, static] |
Set error handler function.
Definition at line 278 of file hamsterdb.hpp.
References ham_set_errhandler().
void ham::db::set_prefix_compare_func | ( | ham_prefix_compare_func_t | foo | ) | [inline] |
Sets the prefix comparison function.
Definition at line 363 of file hamsterdb.hpp.
References error(), ham_set_prefix_compare_func(), and m_db.
friend class env [friend] |
Definition at line 471 of file hamsterdb.hpp.
ham_db_t* ham::db::m_db [private] |
Definition at line 478 of file hamsterdb.hpp.
Referenced by close(), create(), enable_compression(), erase(), find(), flush(), get_error(), get_handle(), get_key_count(), get_parameters(), insert(), open(), operator=(), set_compare_func(), and set_prefix_compare_func().