05.03., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit 5295027d authored by Alessio Netti's avatar Alessio Netti

libdcdb: minor fixes

parent 40353098
......@@ -164,7 +164,7 @@ public:
* @param tol_ns Tolerance of the fuzzy query in nanoseconds.
* @param storeSid If true, Sensor IDs will be retrieved for each reading.
*/
void fuzzyQuery(std::list<SensorDataStoreReading>& result, std::list<SensorId>& sids, TimeStamp& ts, uint64_t tol_ns=10000000000, bool storeSids);
void fuzzyQuery(std::list<SensorDataStoreReading>& result, std::list<SensorId>& sids, TimeStamp& ts, uint64_t tol_ns=10000000000, bool storeSids=true);
/**
* @brief This function queries a sensor's values in
......
......@@ -493,8 +493,11 @@ void SensorDataStoreImpl::fuzzyQuery(std::list<SensorDataStoreReading>& result,
CassStatement *statement = NULL;
CassFuture *future = NULL;
const CassPrepared *prepared = nullptr;
const char *queryBefore = (storeSids ? "SELECT sid,ts,value FROM " : "SELECT ts,value FROM ") KEYSPACE_NAME
"." CF_SENSORDATA " WHERE sid in ? AND ws = ? AND ts <= ? ORDER BY ws DESC, ts DESC PER PARTITION LIMIT 1";
const char *queryBefore;
if(storeSids)
queryBefore = "SELECT sid,ts,value FROM " KEYSPACE_NAME "." CF_SENSORDATA " WHERE sid in ? AND ws = ? AND ts <= ? ORDER BY ws DESC, ts DESC PER PARTITION LIMIT 1";
else
queryBefore = "SELECT ts,value FROM " KEYSPACE_NAME "." CF_SENSORDATA " WHERE sid in ? AND ws = ? AND ts <= ? ORDER BY ws DESC, ts DESC PER PARTITION LIMIT 1";
future = cass_session_prepare(session, queryBefore);
cass_future_wait(future);
......
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