From abfe526abbf6b0eaa43056d15c178c4f5eb4ff1d Mon Sep 17 00:00:00 2001
From: deva <deva>
Date: Tue, 2 Aug 2011 09:20:51 +0000
Subject: Fix missing sessionid for the database lookup in QueryHandlerPracro.

---
 server/src/queryhandlerpracro.cc | 6 ++++--
 server/src/queryhandlerpracro.h  | 3 ++-
 server/src/transactionhandler.cc | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/server/src/queryhandlerpracro.cc b/server/src/queryhandlerpracro.cc
index d617e69..e95d4ff 100644
--- a/server/src/queryhandlerpracro.cc
+++ b/server/src/queryhandlerpracro.cc
@@ -32,10 +32,12 @@
 
 #include "configuration.h"
 
-QueryHandlerPracro::QueryHandlerPracro(Database &_db, std::string cpr)
+QueryHandlerPracro::QueryHandlerPracro(Database &_db, std::string cpr,
+                                       std::string sessionid)
   : db(_db)
 {
   this->cpr = cpr;
+  this->sessionid = sessionid;
 }
 
 QueryResult QueryHandlerPracro::exec(Query &query)
@@ -56,7 +58,7 @@ QueryResult QueryHandlerPracro::exec(Query &query)
     oldest = time(NULL) - Conf::db_max_ttl;
   }
 
-  Values values = db.getValues(cpr, fields, ""/*no session*/, oldest);
+  Values values = db.getValues(cpr, fields, sessionid, oldest);
 
   if(values.find(field) != values.end()) {
     std::string value = values[field].value;
diff --git a/server/src/queryhandlerpracro.h b/server/src/queryhandlerpracro.h
index bdb85db..5029dca 100644
--- a/server/src/queryhandlerpracro.h
+++ b/server/src/queryhandlerpracro.h
@@ -41,7 +41,7 @@
  */
 class QueryHandlerPracro : public QueryHandler {
 public:
-  QueryHandlerPracro(Database &db, std::string cpr);
+  QueryHandlerPracro(Database &db, std::string cpr, std::string sessionid);
   ~QueryHandlerPracro() {}
 
   // Execute all queries.
@@ -50,6 +50,7 @@ public:
 private:
   Database &db;
   std::string cpr;
+  std::string sessionid;
 };
 
 #endif/*__PRACRO_QUERYHANDLERPRACRO_H__*/
diff --git a/server/src/transactionhandler.cc b/server/src/transactionhandler.cc
index 0821cef..5203ee2 100644
--- a/server/src/transactionhandler.cc
+++ b/server/src/transactionhandler.cc
@@ -208,7 +208,7 @@ static std::string handleRequest(Request &request, Environment &env,
         
         if(service == "pracro") {
           // Send the queries to Pentominos (if any)
-          QueryHandlerPracro qh(*db, request.patientid);
+          QueryHandlerPracro qh(*db, request.patientid, session.id());
           
           QueryResult queryresult = qh.exec(*qi);
           lqm.addQueryResult(queryresult);
-- 
cgit v1.2.3