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

The general statement executor or (runner). More...

#include <QueryRunner.h>

+ Inheritance diagram for HSEPData::QueryRunner:
+ Collaboration diagram for HSEPData::QueryRunner:

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.
 
- 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.
 

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.
 
- 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

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.

Constructor & Destructor Documentation

HSEPData::QueryRunner::QueryRunner ( string  pDBType)
HSEPData::QueryRunner::~QueryRunner ( )

Definition at line 145 of file QueryRunner.cpp.

References HSEPData::DB::aInstance, HSEPData::DB::releaseEnvironment(), and HSEP::HSEPObject::valid().

+ Here is the call graph for this function:

Member Function Documentation

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.

Parameters
pStatementName
pParametersRef
pCycleRunnerRef
Returns

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().

+ Here is the call graph for this function:

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.

Parameters
pStatementName
pParametersRef
Returns

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().

+ Here is the call graph for this function:

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.

Parameters
pStatementName
pParametersRef
pFunction
Returns

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().

+ Here is the call graph for this function:

ErrorCode HSEPData::QueryRunner::execute ( string  pStatementName,
CycleBase pCycleRunnerRef 
)

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.

Parameters
pStatementName
pCycleRunnerRef
Returns

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().

+ Here is the call graph for this function:

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.

Parameters
pStatementName
pFunction
Returns

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().

+ Here is the call graph for this function:

ErrorCode HSEPData::QueryRunner::prepareStatement ( DBStatement *&  pStatement,
string &  pStatementName 
)
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.

Parameters
pStatementWhere the statement will be stored.
pStatementNameThe name of the statement to create.
Returns

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HSEPData::QueryRunner::storeData ( string &  pDestination,
string &  pStatementName 
)
protected

When the pStatementName begin with "SYNC-" stores a copy of the provided instruction for further usage.

Parameters
pDestinationThe name of the directory where the copy will be stored.
pStatementNameThe name of the statement to store.

Definition at line 62 of file QueryRunner.cpp.

Referenced by execute().

+ Here is the caller graph for this function:

void HSEPData::QueryRunner::storeData ( string &  pDestination,
string &  pStatementName,
DBParameters pParametersRef 
)
protected

When the pStatementName begin with "SYNC-" stores a copy of the provided instruction for further usage.

The stored file contains the provided parameters.

Parameters
pDestinationThe name of the directory where the copy will be stored.
pStatementNameThe name of the statement to store.
pParametersRefThe parameters to store on the provided statement.

Definition at line 90 of file QueryRunner.cpp.


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