hamsterdb Embedded Database 1.1.14
|
This manual documents the hamsterdb C API. hamsterdb is a key/value database that is linked directly into your application, avoiding all the overhead that is related to external databases and RDBMS systems.
This header file declares all functions and macros that are needed to use hamsterdb. The comments are formatted in Doxygen style and can be extracted to automagically generate documentation. The documentation is also available online here: http://hamsterdb.com/public/scripts/html_www.
In addition, there's a tutorial book hosted on github: http://github.com/cruppstahl/hamsterdb/wiki/Tutorial.
If you want to create or open Databases or Environments (a collection of multiple Databases), the following functions will be interesting for you:
ham_env_new | Allocates a new Environment handle |
ham_env_create_ex | Creates an Environment |
ham_env_open_ex | Opens an Environment |
ham_env_close | Closes an Environment |
ham_env_delete | Deletes the Environment handle |
ham_new | Allocates a new handle for a Database |
ham_env_create_db | Creates a Database in an Environment |
ham_env_open_db | Opens a Database from an Environment |
ham_close | Closes a Database |
ham_delete | Deletes the Database handle |
To insert, lookup or delete key/value pairs, the following functions are used:
ham_insert | Inserts a key/value pair into a Database |
ham_find | Lookup of a key/value pair in a Database |
ham_erase | Erases a key/value pair from a Database |
Alternatively, you can use Cursors to iterate over a Database:
ham_cursor_create | Creates a new Cursor |
ham_cursor_find | Positions the Cursor on a key |
ham_cursor_insert | Inserts a new key/value pair with a Cursor |
ham_cursor_erase | Deletes the key/value pair that the Cursor points to |
ham_cursor_overwrite | Overwrites the value of the current key |
ham_cursor_move | Moves the Cursor to the first, next, previous or last key in the Database |
ham_cursor_close | Closes the Cursor |
If you want to use Transactions, then the following functions are required:
ham_txn_begin | Begins a new Transaction |
ham_txn_commit | Commits the current Transaction |
ham_txn_abort | Aborts the current Transaction |
hamsterdb supports remote Databases via http. The server can be embedded into your application or run standalone (see tools/hamzilla for a Unix daemon or Win32 service which hosts Databases). If you want to embed the server then the following functions have to be used:
ham_srv_init | Initializes the server |
ham_srv_add_env | Adds an Environment to the server. The Environment with all its Databases will then be available remotely. |
ham_srv_close | Closes the server and frees all allocated resources |
If you need help then you're always welcome to use the forum, drop a message (chris at crupp dot de) or with the contact form.
Have fun!