Hydra 0.20
hydra::DB Class Reference

#include <DB.h>

List of all members.

Classes

class  Connection
class  ResetOnExit
class  Statement

Public Member Functions

 DB (const QString &filename, const QString &tablescope)
 DB (DB &linked_db, const QString &tablescope)
virtual ~DB ()
 destructor
bool contains (const std::string &key)
 is this key even in the db?
bool contains (const QString &key)
 is this key even in the db?
bool contains (const char *key)
 is this key even in the db?
bool erase (const std::string &key)
 removes the key from the db, returns true if anything was done
bool erase (const QString &key)
 removes the key from the db, returns true if anything was done
bool erase (const char *key)
 removes the key from the db, returns true if anything was done
bool insert (const std::string &key, const std::string &value)
 saves to the db, returns true on success, will replace if exists
bool insert (const QString &key, const std::string &value)
 saves to the db, returns true on success, will replace if exists
bool insert (const char *key, const std::string &value)
 saves to the db, returns true on success, will replace if exists
bool get (const std::string &key, std::string &value)
 returns false on not-found or failed to load
bool get (const QString &key, std::string &value)
 returns false on not-found or failed to load
bool get (const char *key, std::string &value)
 returns false on not-found or failed to load
bool insert (const std::string &key, const hydra::Record &value)
 saves to the db, returns true on success, will replace if exists
bool insert (const QString &key, const hydra::Record &value)
 saves to the db, returns true on success, will replace if exists
bool insert (const char *key, const hydra::Record &value)
 saves to the db, returns true on success, will replace if exists
bool get (const std::string &key, hydra::Record &value)
 returns false on not-found or failed to load
bool get (const QString &key, hydra::Record &value)
 returns false on not-found or failed to load
bool get (const char *key, hydra::Record &value)
 returns false on not-found or failed to load

Friends

class hydra::Cursor

Detailed Description

This represents a sqlite database table.

This in the future, this can be abtracted away as an interface to allow many possible backends (the old BerkleyDB one, postgresql, etc)

Internally, this backend uses std::string and 8-bit UTF strings for size-conservation.

Author:
Aleksander Demko

Constructor & Destructor Documentation

hydra::DB::DB ( const QString &  filename,
const QString &  tablescope 
)

Creates a DB (disk backed map). It will use the given sqllite db file and prepend the given prefix/namespace to the tables. Using different tablescope's allows you to have multiple DBs in the same sqlite file.

Parameters:
filenamethe sqlite filename on disk
tablescopethe prefix/table name to use. Cannot be empty.
Author:
Aleksander Demko
hydra::DB::DB ( DB linked_db,
const QString &  tablescope 
)

Creates a DB (disk backed map). It will use the given sqllite db file and prepend the given prefix/namespace to the tables.

This constructor allows you to reuse anoter DB instance's sqlite connection.

Parameters:
linked_dbthe DB from whome this DB will share a single sqlite connection.
tablescopethe prefix/table name to use. Cannot be empty.
Author:
Aleksander Demko

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables