OW_NAMESPACE::dbDatabase Class Reference

#include <OW_dbDatabase.hpp>

List of all members.

Public Types

enum  EDuplicateKeysFlag { E_NO_DUPLICATES, E_DUPLICATES }

Public Member Functions

 dbDatabase ()
 ~dbDatabase ()
 Destructor.
void open (const char *name,::DB_ENV *env,::DB_TXN *txn, EDuplicateKeysFlag allowDuplicates=E_NO_DUPLICATES)
 Open the given db file.
void close ()
 Close the underlying database if it is open.
bool get (const String &key, std::vector< unsigned char > &data,::DB_TXN *txn)
 Get the data associated with key.
void put (const String &key, const std::vector< unsigned char > &data,::DB_TXN *txn)
 Put data into the database
Exceptions:
dbDatabaseException on error.


Private Attributes

::DB * m_db


Detailed Description

Definition at line 45 of file OW_dbDatabase.hpp.


Member Enumeration Documentation

enum OW_NAMESPACE::dbDatabase::EDuplicateKeysFlag
 

Enumerator:
E_NO_DUPLICATES 
E_DUPLICATES 

Definition at line 59 of file OW_dbDatabase.hpp.


Constructor & Destructor Documentation

OW_NAMESPACE::dbDatabase::dbDatabase  ) 
 

Definition at line 47 of file OW_dbDatabase.cpp.

OW_NAMESPACE::dbDatabase::~dbDatabase  ) 
 

Destructor.

This will close the database if it is open. It is recommended that close be called separately so that exceptions may be caught and reported. The destructor will not throw exceptions.

Definition at line 53 of file OW_dbDatabase.cpp.

References close().


Member Function Documentation

void OW_NAMESPACE::dbDatabase::close  ) 
 

Close the underlying database if it is open.

Definition at line 87 of file OW_dbDatabase.cpp.

References OW_NAMESPACE::dbUtils::checkReturn(), and m_db.

Referenced by OW_NAMESPACE::MetaRepository2::close(), OW_NAMESPACE::InstanceRepository2::close(), OW_NAMESPACE::AssocDb2::close(), and ~dbDatabase().

bool OW_NAMESPACE::dbDatabase::get const String key,
std::vector< unsigned char > &  data,
::DB_TXN *  txn
 

Get the data associated with key.

Returns:
true if the get was successful, false if the key doesn't exist.
Exceptions:
dbDatabaseException on error.

Definition at line 98 of file OW_dbDatabase.cpp.

References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::dbUtils::checkReturn(), OW_NAMESPACE::String::length(), and m_db.

void OW_NAMESPACE::dbDatabase::open const char *  name,
::DB_ENV *  env,
::DB_TXN *  txn,
EDuplicateKeysFlag  allowDuplicates = E_NO_DUPLICATES
 

Open the given db file.

Parameters:
name The name of the database.
Exceptions:
dbDatabase If the file cannot be created or opened.

Definition at line 65 of file OW_dbDatabase.cpp.

References OW_NAMESPACE::dbUtils::checkReturn(), E_DUPLICATES, and m_db.

Referenced by OW_NAMESPACE::MetaRepository2::open(), OW_NAMESPACE::InstanceRepository2::open(), and OW_NAMESPACE::AssocDb2::open().

void OW_NAMESPACE::dbDatabase::put const String key,
const std::vector< unsigned char > &  data,
::DB_TXN *  txn
 

Put data into the database

Exceptions:
dbDatabaseException on error.

Definition at line 116 of file OW_dbDatabase.cpp.

References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::dbUtils::checkReturn(), OW_NAMESPACE::String::length(), and m_db.


Member Data Documentation

::DB* OW_NAMESPACE::dbDatabase::m_db [private]
 

Definition at line 92 of file OW_dbDatabase.hpp.

Referenced by close(), get(), open(), and put().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:16:45 2006 for openwbem by  doxygen 1.4.6