diff options
Diffstat (limited to 'server/src/queryhandlerpracro.cc')
-rw-r--r-- | server/src/queryhandlerpracro.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/src/queryhandlerpracro.cc b/server/src/queryhandlerpracro.cc index ab1466e..682708c 100644 --- a/server/src/queryhandlerpracro.cc +++ b/server/src/queryhandlerpracro.cc @@ -30,10 +30,10 @@ #include <stdlib.h> -QueryHandlerPracro::QueryHandlerPracro(Database *db, std::string cpr) +QueryHandlerPracro::QueryHandlerPracro(Database &_db, std::string cpr) + : db(_db) { this->cpr = cpr; - this->db = db; } QueryResult QueryHandlerPracro::exec(Query &query) @@ -47,7 +47,7 @@ QueryResult QueryHandlerPracro::exec(Query &query) std::string ttl = query.attributes["ttl"]; time_t oldest = time(NULL) - atol(ttl.c_str()); - Values values = db->getValues(cpr, fields, oldest); + Values values = db.getValues(cpr, fields, oldest); std::string value = values[field].value; time_t timestamp = values[field].timestamp; @@ -69,7 +69,7 @@ int main() { Database db("pgsql", Conf::database_addr, "", Conf::database_user, Conf::database_passwd, ""); - QueryHandlerPracro qh(&db, "2003791613"); + QueryHandlerPracro qh(db, "2003791613"); Query q1; q1.attributes["device_id"] = "lensmeter"; |