1 #ifndef CARMA_DBMS_MONITORDATAQUERYMANAGER_H
2 #define CARMA_DBMS_MONITORDATAQUERYMANAGER_H
26 class OneComponentFilter;
27 class MonitorPointFilter;
30 class TimeRangeFilter;
164 const std::set<const carma::dbms::MonitorPointFilter * >& mpfilters,
192 std::map<carma::dbms::MonitorAggregateType, std::vector<std::string> >
261 const std::set<const carma::dbms::MonitorPointFilter *> mpFilters_;
264 std::map<carma::dbms::MonitorAggregateType,std::string> tmpTableName_;
270 std::map<carma::dbms::MonitorAggregateType, carma::dbms::Table>
274 std::vector<const carma::dbms::MonitorPointSelector * > >
275 aggType2MPSelectors_;
278 std::vector<const carma::dbms::MonitorPointFilter * > >
281 std::map<unsigned, const carma::dbms::MonitorPointFilter * > tagID2MPFilter_;
286 std::map<carma::dbms::MonitorAggregateType, std::string>
294 const static std::string TAGID_TO_DATATYPE;
307 bool haveRunSetUpQueries_;
321 bool haveRunWideSetUpQueries_;
323 std::vector<std::string> tablesToDropUponDestruction_;
338 std::string wideErrMsg_;
427 void createJoinSetUpQueries_
429 < std::vector<const carma::dbms::MonitorPointSelector * > >& mpssVec);
433 void constructFilterClauses_();
437 #endif // CARMA_DBMS_MONITORDATAQUERYMANAGER_H
static int tCount_
temporary table counter to better assure that created temp tables will have unique names ...
Class to mimic a db table The Table class is meant to mimic a database table.
std::map< int, std::string > narrowRSQueries_
queries to execute to produce (generally) several "narrow" (as in tables, no joins are done) result s...
void execWideSetUpQueries_() const
execute the CREATE TABLE queries necessary to produce the tables which will be joined in the wide que...
std::string mdqmGetColumnName(DBColumn column) const
Return the column name string for the given column type.
std::set< MonitorPointSelector *, MPSelectorCompare > MPSelectorSet
A set of MonitorPointSelector points ordered by tagID.
void determineTablesToQuery_()
handle one component filters when determining which aggregate table types need to be queried ...
MonitorAggregateType
aggregate data type of the monitor[point,data file, table]
carma::dbms::Table execWideQuery()
execute "wide" query.
MonitorDataQueryManager(const MPSelectorSet &selectors, const carma::dbms::TimeRangeFilter *const trFilter, const carma::dbms::DBConnection *const dbc)
constructor
MonitorPointSelector class.
std::vector< std::string > getSetUpQueries() const
get the queries which should be run to set up the tables that will be those on which the narrow SELEC...
std::vector< std::string > getWideSetUpQueries() const
get the queries which should be run to set up the tables that will be those on which the final wide r...
unsigned int frameType
Half second frames since Jan 1, 2000.
std::map< carma::dbms::MonitorAggregateType, std::string > aggType2FilterClause_
holds the filter clauses
carma::dbms::Table tagIDToDataTypeID_
this variable is only used if the ResultsCache singleton doesn't exist and cannot be created ...
void doSanityChecks_()
do some sanity checking on values passed to the constructor
void cacheTagIDToDataType_()
cache the tag id to data type mapping
void createQueries_()
create the queries to submit to the database
relationships between the monitor and dbms systems
std::vector< std::string > wideSetUpQueries_
the queries in the order they should be submitted to the database which create and populate temporary...
void createWideRSQuery_()
create the wide result set query, ie this is the query which will create a single, wide table containing n columns where n is the sum of all the columns specified in the monitor point selectors which were passed to the constructor
Class to compose and execute a query of the monitor database.
std::map< int, std::string > getNarrowRSQueries() const
get the SELECT queries which will produce (generally) multiple narrow (as in narrow table...
std::string wideRSQuery_
query to execute to produce a singe "wide" (generally using several joins) table
std::set< MonitorAggregateType > aggTypes_
the aggregate data types relevant to this query
std::map< carma::dbms::MonitorAggregateType, carma::dbms::Table > tablesToQuery_
holds the monitor data tables relevant to this query
void determineAggregateTableTypes_()
determine which aggregate table types will need to be used in the query
MonitorAverageType
average type of the monitor[point,data file,table]
access of column names in the database
represents an SQL query time range filter (part of a WHERE clause This class represents a (closed) ti...
void execSetUpQueries_() const
execute the set up queries
void createNarrowRSQueries_()
create the narrow result set queries, ie these are queries which will produce info on a single tagID ...
std::map< carma::dbms::MonitorAggregateType, std::vector< std::string > > getTablesToQuery() const
get the tables which this class will need to query to produce the result set
static carma::util::frameType getBeginningOfProduction()
get the frameCount that marks the beginning of production
std::set< carma::dbms::MonitorAggregateType > getAggregateDataTypes() const
get the aggregate data types used by this query
~MonitorDataQueryManager()
destructor deletes any "temporary" tables created for wide query
an abstract class from which database queries may be launched.
std::map< int, carma::dbms::Table > execNarrowQueries()
execute "narrow" queries.
std::vector< std::string > setUpQueries_
the queries in the order they should be submitted to the database which create and populate the table...
std::string getWideRSQuery() const
get the final wide result set query
void createSetUpQueries_()
create the set up queries, these are the queries which create the temporary tables which are ultimate...