Commit 31009e8c authored by Michael Ott's avatar Michael Ott

Remove -d parameter for queries

parent 4d191371
...@@ -54,7 +54,6 @@ void usage(void) ...@@ -54,7 +54,6 @@ void usage(void)
std::cout << std::endl; std::cout << std::endl;
std::cout << "Options:" << std::endl; std::cout << "Options:" << std::endl;
std::cout << " -h<host> Cassandra host [default: " << DEFAULT_CASSANDRAHOST << ":" << DEFAULT_CASSANDRAPORT << "]" << endl; std::cout << " -h<host> Cassandra host [default: " << DEFAULT_CASSANDRAHOST << ":" << DEFAULT_CASSANDRAPORT << "]" << endl;
std::cout << " -d Don't look up sensor name" << std::endl;
std::cout << " -r Report timestamps in numerical format" << std::endl; std::cout << " -r Report timestamps in numerical format" << std::endl;
std::cout << " -l Report times in local time (not UTC)" << std::endl; std::cout << " -l Report times in local time (not UTC)" << std::endl;
} }
...@@ -111,18 +110,14 @@ int main(int argc, char * const argv[]) ...@@ -111,18 +110,14 @@ int main(int argc, char * const argv[])
myQuery = new DCDBQuery(); myQuery = new DCDBQuery();
/* Get the options */ /* Get the options */
bool direct = false;
int ret; int ret;
const char *host = getenv("DCDB_HOSTNAME"); const char *host = getenv("DCDB_HOSTNAME");
if (!host) { if (!host) {
host = "localhost"; host = "localhost";
} }
while ((ret=getopt(argcReal, argvReal, "+h:drlf"))!=-1) { while ((ret=getopt(argcReal, argvReal, "+h:rlf"))!=-1) {
switch(ret) { switch(ret) {
case 'd':
direct = true;
break;
case 'h': case 'h':
host = optarg; host = optarg;
break; break;
...@@ -162,7 +157,7 @@ int main(int argc, char * const argv[]) ...@@ -162,7 +157,7 @@ int main(int argc, char * const argv[])
sensors.push_back(argvReal[arg]); sensors.push_back(argvReal[arg]);
} }
myQuery->doQuery(host, sensors, start, end, direct); myQuery->doQuery(host, sensors, start, end);
delete myQuery; delete myQuery;
......
...@@ -205,7 +205,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer ...@@ -205,7 +205,7 @@ void DCDBQuery::genOutput(std::list<DCDB::SensorDataStoreReading> &results, quer
} }
} }
void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DCDB::TimeStamp start, DCDB::TimeStamp end, bool direct) void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DCDB::TimeStamp start, DCDB::TimeStamp end)
{ {
/* Create a new connection to the database */ /* Create a new connection to the database */
connection = new DCDB::Connection(); connection = new DCDB::Connection();
...@@ -267,17 +267,18 @@ void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DC ...@@ -267,17 +267,18 @@ void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DC
queryCfg.unit = DCDB::UnitConv::fromString(modifierStr); queryCfg.unit = DCDB::UnitConv::fromString(modifierStr);
} }
} }
if(!direct) {
std::list <DCDB::PublicSensor> publicSensors; std::list <DCDB::PublicSensor> publicSensors;
sensorConfig.getPublicSensorsByWildcard(publicSensors, sensorName.c_str()); sensorConfig.getPublicSensorsByWildcard(publicSensors, sensorName.c_str());
for (auto sen: publicSensors) { if (publicSensors.size() > 0) {
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(sen, queryCfg)); for (auto sen: publicSensors) {
} queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(sen, queryCfg));
} else { }
DCDB::PublicSensor pS; } else {
pS.name = sensorName; DCDB::PublicSensor pS;
pS.pattern = sensorName; pS.name = sensorName;
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(pS, queryCfg)); pS.pattern = sensorName;
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(pS, queryCfg));
} }
} }
} }
......
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
void check(std::list<std::string>::iterator it , double* scalingFactor); void check(std::list<std::string>::iterator it , double* scalingFactor);
void checkModifier(std::list<std::string>::iterator it, struct outputFormat *format); void checkModifier(std::list<std::string>::iterator it, struct outputFormat *format);
void doQuery(const char* hostname, std::list<std::string> sensors, DCDB::TimeStamp start, DCDB::TimeStamp end, bool direct=false); void doQuery(const char* hostname, std::list<std::string> sensors, DCDB::TimeStamp start, DCDB::TimeStamp end);
DCDBQuery(); DCDBQuery();
virtual ~DCDBQuery() {}; virtual ~DCDBQuery() {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment