![]() |
The general statement executor or (runner). More...
#include <QueryRunner.h>
Public Member Functions | |
QueryRunner (string pDBType) | |
~QueryRunner () | |
ErrorCode | execute (string pStatementName, DBParameters &pParametersRef, CycleBase &pCycleRunnerRef) |
Given the pStatementName, locates the corresponding SQL query instance, populate its parameters using the pParametersRef collection and executes it. | |
ErrorCode | execute (string pStatementName, DBParameters &pParametersRef) |
Given the pStatementName, locates the corresponding SQL query instance, populate its parameters using the pParametersRef collection and executes it. | |
ErrorCode | execute (string pStatementName, DBParameters &pParametersRef, ExecuteFunctionType pFunction) |
Given the pStatementName, locates the corresponding SQL query instance, populate its parameters using the pParametersRef collection and executes it. | |
ErrorCode | execute (string pStatementName, CycleBase &pCycleRunnerRef) |
Given the pStatementName, locates the corresponding SQL query instance that doesn't have any parameter and executes it. | |
ErrorCode | execute (string pStatementName, ExecuteFunctionType pFunction) |
Given the pStatementName, locates the corresponding SQL query instance that doesn't have any parameter and executes it. | |
![]() | |
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. | |
Protected Member Functions | |
ErrorCode | prepareStatement (DBStatement *&pStatement, string &pStatementName) |
Creates a statement to be used one or more times with the specified QueryRunner. | |
void | storeData (string &pDestination, string &pStatementName) |
When the pStatementName begin with "SYNC-" stores a copy of the provided instruction for further usage. | |
void | storeData (string &pDestination, string &pStatementName, DBParameters &pParametersRef) |
When the pStatementName begin with "SYNC-" stores a copy of the provided instruction for further usage. | |
![]() | |
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. | |
The general statement executor or (runner).
It has access to all the static HSEPData catalogs and sessions, so permits to perform any type of database operations in the most clear and direct way without the need of usage of many of the Data subsystem primitives.
Definition at line 43 of file QueryRunner.h.
HSEPData::QueryRunner::QueryRunner | ( | string | pDBType | ) |
Definition at line 122 of file QueryRunner.cpp.
References HSEPData::DB::aInstance, HSEPData::DB::getEnvironmentPtr(), HSEP::HSEPObject::lastErrorRef(), HSEP::HSEPObject::setInvalid(), HSEP::HSEPObject::setLastError(), HSEP::HSEPObject::setValid(), and HSEPData::DBException::what().
HSEPData::QueryRunner::~QueryRunner | ( | ) |
Definition at line 145 of file QueryRunner.cpp.
References HSEPData::DB::aInstance, HSEPData::DB::releaseEnvironment(), and HSEP::HSEPObject::valid().
ErrorCode HSEPData::QueryRunner::execute | ( | string | pStatementName, |
DBParameters & | pParametersRef, | ||
CycleBase & | pCycleRunnerRef | ||
) |
Given the pStatementName, locates the corresponding SQL query instance, populate its parameters using the pParametersRef collection and executes it.
Later, apply the pCycleRunnerRef cycle on each one of the returned elements.
pStatementName | |
pParametersRef | |
pCycleRunnerRef |
Definition at line 151 of file QueryRunner.cpp.
References HSEPData::DBStatement::cycleQuery(), HSEP::HSEPObject::lastErrorRef(), HSEP::EC::NoDataFound, HSEP::EC::NotCatalogedError, HSEP::EC::OK, prepareStatement(), HSEP::HSEPObject::setLastError(), storeData(), HSEPData::DBEnvironment::synchronizes(), HSEPData::DBEnvironment::syncToRef(), HSEP::HSEPObject::valid(), and HSEPData::DBException::what().
ErrorCode HSEPData::QueryRunner::execute | ( | string | pStatementName, |
DBParameters & | pParametersRef | ||
) |
Given the pStatementName, locates the corresponding SQL query instance, populate its parameters using the pParametersRef collection and executes it.
pStatementName | |
pParametersRef |
Definition at line 201 of file QueryRunner.cpp.
References HSEPData::DBStatement::cycleQuery(), HSEP::HSEPObject::lastErrorRef(), HSEP::EC::NoDataFound, HSEP::EC::NotCatalogedError, HSEP::EC::OK, prepareStatement(), HSEP::HSEPObject::setLastError(), storeData(), HSEPData::DBEnvironment::synchronizes(), HSEPData::DBEnvironment::syncToRef(), HSEP::HSEPObject::valid(), and HSEPData::DBException::what().
ErrorCode HSEPData::QueryRunner::execute | ( | string | pStatementName, |
DBParameters & | pParametersRef, | ||
ExecuteFunctionType | pFunction | ||
) |
Given the pStatementName, locates the corresponding SQL query instance, populate its parameters using the pParametersRef collection and executes it.
Later, apply the pFunction to each one of the returned elements.
pStatementName | |
pParametersRef | |
pFunction |
Definition at line 290 of file QueryRunner.cpp.
References HSEPData::DBStatement::cycleQuery(), HSEP::HSEPObject::lastErrorRef(), HSEP::EC::NoDataFound, HSEP::EC::NotCatalogedError, HSEP::EC::OK, prepareStatement(), HSEP::HSEPObject::setLastError(), storeData(), HSEPData::DBEnvironment::synchronizes(), HSEPData::DBEnvironment::syncToRef(), HSEP::HSEPObject::valid(), and HSEPData::DBException::what().
Given the pStatementName, locates the corresponding SQL query instance that doesn't have any parameter and executes it.
Later, apply the pCycleRunnerRef cycle to each one of the returned elements.
pStatementName | |
pCycleRunnerRef |
Definition at line 251 of file QueryRunner.cpp.
References HSEPData::DBStatement::cycleQuery(), HSEP::HSEPObject::lastErrorRef(), HSEP::EC::NotCatalogedError, HSEP::EC::OK, prepareStatement(), HSEP::HSEPObject::setLastError(), storeData(), HSEPData::DBEnvironment::synchronizes(), HSEPData::DBEnvironment::syncToRef(), HSEP::HSEPObject::valid(), and HSEPData::DBException::what().
ErrorCode HSEPData::QueryRunner::execute | ( | string | pStatementName, |
ExecuteFunctionType | pFunction | ||
) |
Given the pStatementName, locates the corresponding SQL query instance that doesn't have any parameter and executes it.
Later, apply the pFunction to each one of the retuurned elements.
pStatementName | |
pFunction |
Definition at line 337 of file QueryRunner.cpp.
References HSEPData::DBStatement::cycleQuery(), HSEP::HSEPObject::lastErrorRef(), HSEP::EC::NotCatalogedError, HSEP::EC::OK, prepareStatement(), HSEP::HSEPObject::setLastError(), storeData(), HSEPData::DBEnvironment::synchronizes(), HSEPData::DBEnvironment::syncToRef(), HSEP::HSEPObject::valid(), and HSEPData::DBException::what().
|
protected |
Creates a statement to be used one or more times with the specified QueryRunner.
The pStatement parameter must be "nullptr"; if not, will return with error.
pStatement | Where the statement will be stored. |
pStatementName | The name of the statement to create. |
Definition at line 32 of file QueryRunner.cpp.
References HSEP::EC::NoStatementCreated, HSEP::EC::NotCatalogedError, HSEP::EC::OK, and HSEPData::DBException::what().
Referenced by execute().
|
protected |
When the pStatementName begin with "SYNC-" stores a copy of the provided instruction for further usage.
pDestination | The name of the directory where the copy will be stored. |
pStatementName | The name of the statement to store. |
Definition at line 62 of file QueryRunner.cpp.
Referenced by execute().
|
protected |
When the pStatementName begin with "SYNC-" stores a copy of the provided instruction for further usage.
The stored file contains the provided parameters.
pDestination | The name of the directory where the copy will be stored. |
pStatementName | The name of the statement to store. |
pParametersRef | The parameters to store on the provided statement. |
Definition at line 90 of file QueryRunner.cpp.