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

Remove -d parameter for queries

parent 4d191371
......@@ -54,7 +54,6 @@ void usage(void)
std::cout << std::endl;
std::cout << "Options:" << std::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 << " -l Report times in local time (not UTC)" << std::endl;
}
......@@ -111,18 +110,14 @@ int main(int argc, char * const argv[])
myQuery = new DCDBQuery();
/* Get the options */
bool direct = false;
int ret;
const char *host = getenv("DCDB_HOSTNAME");
if (!host) {
host = "localhost";
}
while ((ret=getopt(argcReal, argvReal, "+h:drlf"))!=-1) {
while ((ret=getopt(argcReal, argvReal, "+h:rlf"))!=-1) {
switch(ret) {
case 'd':
direct = true;
break;
case 'h':
host = optarg;
break;
......@@ -162,7 +157,7 @@ int main(int argc, char * const argv[])
sensors.push_back(argvReal[arg]);
}
myQuery->doQuery(host, sensors, start, end, direct);
myQuery->doQuery(host, sensors, start, end);
delete myQuery;
......
......@@ -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 */
connection = new DCDB::Connection();
......@@ -267,9 +267,10 @@ void DCDBQuery::doQuery(const char* hostname, std::list<std::string> sensors, DC
queryCfg.unit = DCDB::UnitConv::fromString(modifierStr);
}
}
if(!direct) {
std::list <DCDB::PublicSensor> publicSensors;
sensorConfig.getPublicSensorsByWildcard(publicSensors, sensorName.c_str());
if (publicSensors.size() > 0) {
for (auto sen: publicSensors) {
queries.insert(std::pair<DCDB::PublicSensor, queryConfig_t>(sen, queryCfg));
}
......
......@@ -88,7 +88,7 @@ public:
void check(std::list<std::string>::iterator it , double* scalingFactor);
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();
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