summaryrefslogtreecommitdiff
path: root/server/src/queryhandlerpracro.cc
diff options
context:
space:
mode:
authordeva <deva>2009-07-29 07:25:25 +0000
committerdeva <deva>2009-07-29 07:25:25 +0000
commitab96caac3c631ca452b21a0529372f1165638002 (patch)
tree40c385fde66904abf19555df375b5c88f0efe633 /server/src/queryhandlerpracro.cc
parent2da1fd29b11d9b069d7783a37e2718023850462b (diff)
Split up commits and requests to seperate functions. Changed Database * to Database &
Diffstat (limited to 'server/src/queryhandlerpracro.cc')
-rw-r--r--server/src/queryhandlerpracro.cc8
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";