All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HSEPData::DB Class Reference

Data subsystem initialization. More...

#include <DB.h>

+ Inheritance diagram for HSEPData::DB:
+ Collaboration diagram for HSEPData::DB:

Public Member Functions

 DB (string &pConfigPathRef, string &pQueryPathRef, string &pDriverPathRef)
 Initializes all the internal DB manipulation structures and subsystems.
 
 ~DB ()
 Close every connection and releases every operating system object used by DB.
 
DBEnvironmentgetEnvironmentPtr (string &pEnvironmentTypeRef)
 Provide a running environment to perform Database operations.
 
void releaseEnvironment (string &pEnvironmentTypeRef, DBEnvironment *pEnvironmentPtr)
 Return an environment to the internal DB management system for further use.
 
- Public Member Functions inherited from HSEP::HSEPObject
string & lastErrorRef ()
 Returns a reference to the last stored error message.
 
ErrorCode lastCode ()
 Returns the last stored code.
 
bool valid ()
 Permits to know if the object has a valid internal state.
 
string & typeRef ()
 Permits to know the type of this particular object.
 

Static Public Attributes

static DBaInstance = nullptr
 absolute DB manager
 

Protected Member Functions

void loadDrivers (string &pDriverPathRef)
 Given the specified pDriverPathRef path, will look for any HausmiSEP database driver, will load it, initialize and to let it be available for immediate usage.
 
ErrorCode loadInstances (string &pConfigPathRef)
 Given the specified pConfigPathRef path, will read all the database configuration files and will create the corresponding database connection-pool areas for immediate usage.
 
void unloadDrivers ()
 Unloads the previously loaded Drivers.
 
void unloadInstances ()
 Closes and releases all the database pools.
 
- Protected Member Functions inherited from HSEP::HSEPObject
 HSEPObject (const char *pType)
 Constructor, providing the base for the state controlling instance.
 
virtual ~HSEPObject ()
 
void setLastError (string &pErrorMsgRef)
 Assigns an error message text to the last executed operation.
 
void setLastError (const string &pErrorMsgRef)
 Assigns an error message text to the last executed operation.
 
void setLastError (const char *pErrorMsg)
 Assigns an error message text to the last executed operation.
 
void setValid ()
 Defines that the object has a valid state.
 
void setInvalid ()
 Defines that the object has an invalid state.
 
void setLastCode (const ErrorCode pErrorCode)
 Defines the internal result code for the object.
 

Detailed Description

Data subsystem initialization.

To use the HausmiSEP database engine controller you only need to declare one DB instance in some part of your project, mainly in the primary "main" file, that will be active for the rest of the program/service life.

Definition at line 46 of file DB.h.

Constructor & Destructor Documentation

HSEPData::DB::DB ( string &  pConfigPathRef,
string &  pQueryPathRef,
string &  pDriverPathRef 
)

Initializes all the internal DB manipulation structures and subsystems.

The DB environment has the capability to perform operations on different database types at the same time, managing an independent connection queue for each one of them.

Each database engine works as a plug-in that is built and included in a running system without the need for recompiling the subsystem.

Parameters
pConfigPathRefpath where the configuration data is located.
pQueryPathRefpath where SQL query files are located.
pDriverPathRefpath where DB plug-ins (drivers) are located.

Definition at line 45 of file DB.cpp.

References aInstance, HSEPData::DBStatementCatalog::init(), loadDrivers(), loadInstances(), HSEP::EC::NotCatalogedError, HSEP::EC::OK, and HSEP::HSEPObject::setValid().

+ Here is the call graph for this function:

HSEPData::DB::~DB ( )

Close every connection and releases every operating system object used by DB.

Definition at line 67 of file DB.cpp.

References HSEPData::DBStatementCatalog::destroy(), and unloadInstances().

+ Here is the call graph for this function:

Member Function Documentation

DBEnvironment * HSEPData::DB::getEnvironmentPtr ( string &  pEnvironmentTypeRef)

Provide a running environment to perform Database operations.

Parameters
pEnvironmentTypeRefthe Database type to use.
Returns
the environment that can perform DB operations.
nullptr when no environment was found.

Definition at line 248 of file DB.cpp.

References HSEPData::DBEnvironmentQueue::getEnvironmentPtr().

Referenced by HSEPData::QueryRunner::QueryRunner().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HSEPData::DB::loadDrivers ( string &  pDriverPathRef)
protected

Given the specified pDriverPathRef path, will look for any HausmiSEP database driver, will load it, initialize and to let it be available for immediate usage.

Parameters
pDriverPathRef

Definition at line 78 of file DB.cpp.

References HSEP::Dictionary< T >::clear(), HSEP::Array< T >::forEach(), HSEP::EC::OK, and HSEP::Dictionary< T >::put().

Referenced by DB().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ErrorCode HSEPData::DB::loadInstances ( string &  pConfigPathRef)
protected

Given the specified pConfigPathRef path, will read all the database configuration files and will create the corresponding database connection-pool areas for immediate usage.

Parameters
pConfigPathRef
Returns

The SyncTo parameter instruct the DB engine to define a repository for all the executed DB instructions that will be sent to that repository name (usually the IP address for another server).

There, an independent software could take that data to perform actions, such as synchronize the information to a equivalent data model or to perform some sort of data trace about what is happening inside the program that owns this engine.

Definition at line 127 of file DB.cpp.

References HSEPData::DBEnvironment::addID(), HSEPData::DBEnvironment::addSyncPath(), HSEPData::DBEnvironment::addSyncTo(), HSEP::EC::CantReadDBConfFile, HSEP::Array< T >::forEach(), HSEPData::DBDrvLib::getEnvironmentPtr(), HSEP::Dictionary< T >::has(), HSEP::HSEPObject::lastErrorRef(), HSEP::EC::NotCatalogedError, HSEP::EC::OK, HSEP::Dictionary< T >::ref(), and HSEP::HSEPObject::setLastError().

Referenced by DB().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HSEPData::DB::releaseEnvironment ( string &  pEnvironmentTypeRef,
DBEnvironment pEnvironmentPtr 
)

Return an environment to the internal DB management system for further use.

Parameters
pEnvironmentTypeRefthe type of environment is being returned.
pEnvironmentPtrthe environment is being returned.

Definition at line 258 of file DB.cpp.

References HSEPData::DBEnvironmentQueue::releaseEnvironment().

Referenced by HSEPData::QueryRunner::~QueryRunner().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HSEPData::DB::unloadDrivers ( )
protected

Unloads the previously loaded Drivers.

This operation is performed automatically by the database engine controller.

Definition at line 233 of file DB.cpp.

void HSEPData::DB::unloadInstances ( )
protected

Closes and releases all the database pools.

This operation is performed automatically by the database engine controller.

Definition at line 237 of file DB.cpp.

Referenced by ~DB().

+ Here is the caller graph for this function:

Member Data Documentation

DB * HSEPData::DB::aInstance = nullptr
static

absolute DB manager

Definition at line 109 of file DB.h.

Referenced by DB(), HSEPData::QueryRunner::QueryRunner(), and HSEPData::QueryRunner::~QueryRunner().


The documentation for this class was generated from the following files: