hamsterdb Embedded Database 1.1.15
hamsterdb Embedded Database Documentation

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_newAllocates a new Environment handle
ham_env_create_exCreates an Environment
ham_env_open_exOpens an Environment
ham_env_closeCloses an Environment
ham_env_deleteDeletes the Environment handle
ham_newAllocates a new handle for a Database
ham_env_create_dbCreates a Database in an Environment
ham_env_open_dbOpens a Database from an Environment
ham_closeCloses a Database
ham_deleteDeletes the Database handle

To insert, lookup or delete key/value pairs, the following functions are used:

ham_insertInserts a key/value pair into a Database
ham_findLookup of a key/value pair in a Database
ham_eraseErases a key/value pair from a Database

Alternatively, you can use Cursors to iterate over a Database:

ham_cursor_createCreates a new Cursor
ham_cursor_findPositions the Cursor on a key
ham_cursor_insertInserts a new key/value pair with a Cursor
ham_cursor_eraseDeletes the key/value pair that the Cursor points to
ham_cursor_overwriteOverwrites the value of the current key
ham_cursor_moveMoves the Cursor to the first, next, previous or last key in the Database
ham_cursor_closeCloses the Cursor

If you want to use Transactions, then the following functions are required:

ham_txn_beginBegins a new Transaction
ham_txn_commitCommits the current Transaction
ham_txn_abortAborts 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_initInitializes the server
ham_srv_add_envAdds an Environment to the server. The Environment with all its Databases will then be available remotely.
ham_srv_closeCloses 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!