![]() |
Data subsystem initialization. More...
#include <DB.h>
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. | |
DBEnvironment * | getEnvironmentPtr (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. | |
![]() | |
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 DB * | aInstance = 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. | |
![]() | |
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. | |
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.
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.
pConfigPathRef | path where the configuration data is located. |
pQueryPathRef | path where SQL query files are located. |
pDriverPathRef | path 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().
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().
DBEnvironment * HSEPData::DB::getEnvironmentPtr | ( | string & | pEnvironmentTypeRef | ) |
Provide a running environment to perform Database operations.
pEnvironmentTypeRef | the Database type to use. |
Definition at line 248 of file DB.cpp.
References HSEPData::DBEnvironmentQueue::getEnvironmentPtr().
Referenced by HSEPData::QueryRunner::QueryRunner().
|
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.
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().
|
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.
pConfigPathRef |
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().
void HSEPData::DB::releaseEnvironment | ( | string & | pEnvironmentTypeRef, |
DBEnvironment * | pEnvironmentPtr | ||
) |
Return an environment to the internal DB management system for further use.
pEnvironmentTypeRef | the type of environment is being returned. |
pEnvironmentPtr | the environment is being returned. |
Definition at line 258 of file DB.cpp.
References HSEPData::DBEnvironmentQueue::releaseEnvironment().
Referenced by HSEPData::QueryRunner::~QueryRunner().
|
protected |
|
protected |
|
static |
absolute DB manager
Definition at line 109 of file DB.h.
Referenced by DB(), HSEPData::QueryRunner::QueryRunner(), and HSEPData::QueryRunner::~QueryRunner().