Luiza
v03-01
|
Processor for reading tables from SQL database with SOCI library. More...
#include <SociSelect.h>
Public Member Functions | |
virtual SociSelect * | newProcessor () |
Return a new instance of the processor. More... | |
virtual void | init () |
virtual void | startAnalysis (GloriaDataContainer *data) |
Called before first data loop. More... | |
virtual void | processData (GloriaDataContainer *data) |
virtual void | check (GloriaDataContainer *data) |
Called for every loop - right after processData() call. More... | |
virtual void | concludeAnalysis (GloriaDataContainer *data) |
Called after all data processing loops to finalize the analysis. | |
virtual void | end () |
![]() | |
bool | OpenDataSource () |
![]() | |
Processor (const std::string &typeName) | |
Default constructor. More... | |
virtual | ~Processor () |
Destructor. | |
virtual const std::string & | type () const |
Return type name for the processor (as set in constructor). | |
virtual const std::string & | name () const |
Return name of this processor. | |
virtual const std::string & | logLevelName () const |
Return name of the local verbosity level of this processor - "" if not set. | |
virtual StringParameters * | parameters () |
Return parameters defined for this Processor. | |
virtual void | printDescription () |
Print information about this processor in ASCII steering file format. | |
virtual void | printDescriptionXML (std::ostream &stream=std::cout) |
Print information about this processor in XML steering file format. | |
template<class T > | |
void | printParameters () |
Print the parameters and their values depending on the given verbosity level. | |
void | printParameters () |
Print the parameters and their values with verbosity level MESSAGE. | |
const std::string & | description () |
Description of processor. | |
bool | isFirstEvent () |
True if first event in processEvent(evt) - use this e.g. to initialize histograms etc. | |
GloriaCollectionType | getGloriaInType (const std::string &colName) |
Return the input type for the collection colName. More... | |
GloriaCollectionType | getGloriaOutType (const std::string &colName) |
Return the output type for the collection colName. More... | |
bool | isInputCollectionName (const std::string ¶meterName) |
Check if parameter defines collection. More... | |
bool | isOutputCollectionName (const std::string ¶meterName) |
True if the given parameter defines an LCIO output collection */. | |
Protected Attributes | |
std::vector< std::string > | _connectString |
Connection parameters, as required for SOCI session opening. | |
std::string | _connection |
Connection parameters merged to single string. | |
std::vector< std::string > | _selectString |
Select statement to be executed as SQL query. | |
std::string | _select |
Select statement merged to single string. | |
int | _rowsPerLoop |
Number of tables to be read per processing loop (0 for all) | |
std::string | _indexCollection |
Name of the table collection containing index table. | |
std::string | _indexColumn |
Name of the index table column containing select parameter. | |
int | _indexesPerLoop |
Number of indexes to be used per processing loop (0 for all) | |
std::string | _tableCollectionName |
Name of the table collection to which SQL tables should be stored. | |
bool | _permanentCollection |
Flag for collections, which should not be deleted after loop is finished. | |
int | _nLoops |
Loop counter. | |
int | _nTables |
Table counter. | |
int | _nSQL |
SQL query counter. | |
GloriaFitsTable * | _outputTemplate |
Table template created from SQL output. | |
std::vector< soci::data_type > | _sqlTypes |
Data types of SQL output columns. | |
std::vector< std::string > | _sqlNames |
Names of SQL output columns. | |
soci::session * | _sociSession |
SOCI session pointer. | |
soci::statement * | _sociStatement |
SOCI query statement pointer. | |
soci::row * | _sociRow |
SOCI query output row. | |
bool | _useIndex |
Flag for using indexes in query. | |
int | _indexRow |
Index counter. | |
int | _sqlRow |
Row counter. | |
![]() | |
std::string | _description |
Describes what the processor does. Set in constructor. | |
Additional Inherited Members | |
![]() | |
void | setReturnValue (bool val) |
Set the return value for this processor - typically at end of processEvent(). More... | |
void | setReturnValue (const std::string &name, bool val) |
Set a named return value for this processor - typically at end of processEvent() More... | |
template<class T > | |
void | registerProcessorParameter (const std::string &name, const std::string &description, T ¶meter, const T &defaultVal, int setSize=0) |
Register a steering variable for this processor - call in constructor of processor. More... | |
void | registerInputCollection (const GloriaCollectionType &type, const std::string &name, const std::string &description, std::string ¶meter, const std::string &defaultVal, int setSize=0) |
Register parameter describing input collection. More... | |
void | registerOutputCollection (const GloriaCollectionType &type, const std::string &name, const std::string &description, std::string ¶meter, const std::string &defaultVal, int setSize=0) |
Register parameter describing output collection. More... | |
void | registerInputCollections (const GloriaCollectionType &type, const std::string &name, const std::string &description, StringVec ¶meter, const StringVec &defaultVal, int setSize=0) |
Register parameter describing input collections. More... | |
template<class T > | |
void | registerOptionalParameter (const std::string &name, const std::string &description, T ¶meter, const T &defaultVal, int setSize=0) |
Same as registerProcessorParameter except that the parameter is optional. More... | |
bool | parameterSet (const std::string &name) |
Tests whether the parameter has been set in the steering file. | |
template<class T > | |
void | message (const std::string &message) const |
Print message according to verbosity level. More... | |
template<class T > | |
void | message (const std::basic_ostream< char, std::char_traits< char > > &m) const |
Similar to message(const std::string& message) More... | |
std::stringstream & | log () const |
Returns an empty stringstream that is used by the message method. | |
virtual void | setProcessorParameters (StringParameters *parameters) |
Allow friend class CCProcessor to change/reset processor parameters. | |
virtual void | updateParameters () |
Allow friend class CCProcessor to update processor parameters. | |
virtual void | updateTelescopeParameters (std::string name) |
Allow to update processor parameters for given telescope name. More... | |
virtual void | updateTelescopeParameters (GloriaFitsHeader *header) |
Update processor parameters based on FITS header. More... | |
Processor for reading tables from SQL database with SOCI library.
This processor reads data from SQL database and puts them into internal FITS table structure, so it can be used in subsequent processing steps. SOCI library is used to implement interface to different databases. This processor is designed to execute SELECT queries only. For detailed description of command syntax please refer to SOCI documentation.
ConnectString | Single line containing all connection parameters, as required for SOCI session opening (eg. "postgresql://host=test.db port=1111 user=db_guest dbname=test_db") |
SelectString | Single line containing select statement, to be used as SOCI query. Parameter names (to be taken from index table) are to be preceded by a colon (eg. "select * from table where index=:ID"). |
RowsPerLoop | Number of rows to be read from the SQL query result in each processor call. Default is all (parameter value set to zero). This parameter is only considered when index table is not used. |
IndexCollection | Name of the collection containing index table, i.e. table where SQL select statement parameter is stored. |
IndexColumn | Name of the column in the index table, from which the SQL select statement parameter is to be read. |
IndexesPerLoop | Number of indexes, which should be used for each loop. Default is one, i.e. select statement is executed only once for each processor call. To process data for all indexes, index table has to be defined as permanent or the parameter has to be set to zero (process all indexes at one call). |
TableCollectionName | Name of the created GloriaTableCollection (default is "DbTable"); |
PermanentCollection | Flag indicating that created collection should be kept in memory for the whole processing time. |
|
virtual |
Called for every loop - right after processData() call.
Can be used to check processing and/or produce check plots.
Reimplemented from luiza::Processor.
References _tableCollectionName, and gloria::GloriaDataContainer::GetTableCollection().
|
virtual |
Called after data processing for clean up.
Reimplemented from luiza::Processor.
|
virtual |
Called at the begin of the job before anything is read. Use to initialize the processor, e.g. book histograms.
Reimplemented from luiza::Processor.
References _connection, _connectString, _indexCollection, _indexColumn, _indexRow, _nLoops, _nSQL, _nTables, _outputTemplate, _select, _selectString, _sociRow, _sociSession, _sociStatement, _sqlNames, _sqlRow, _sqlTypes, _useIndex, luiza::Processor::name(), and luiza::Processor::parameters().
|
virtual |
Return a new instance of the processor.
Has to be implemented by subclasses.
Implements luiza::Processor.
|
virtual |
Called for every data loop
Reimplemented from luiza::Processor.
References _indexCollection, _indexColumn, _indexesPerLoop, _indexRow, _nLoops, _nSQL, _nTables, _outputTemplate, _permanentCollection, _rowsPerLoop, _select, _sociRow, _sociSession, _sociStatement, _sqlNames, _sqlRow, _sqlTypes, _tableCollectionName, _useIndex, gloria::GloriaFitsTable::AddColumn(), gloria::GloriaFitsTable::AddRow(), gloria::GloriaFitsTable::GetColumn(), gloria::GloriaFitsTable::GetRowNumber(), gloria::GloriaDataContainer::GetTableCollection(), gloria::GloriaFitsTable::SetLast(), luiza::Processor::setReturnValue(), and gloria::GloriaDataContainer::TableCollectionExists().
|
virtual |
Called before first data loop.
Can be used to create permanent data structures, if needed.
Reimplemented from luiza::Processor.
References _connection, _sociRow, and _sociSession.