summaryrefslogtreecommitdiff
path: root/server/src/pracrodaopgsql.h
diff options
context:
space:
mode:
authordeva <deva>2010-06-10 07:03:06 +0000
committerdeva <deva>2010-06-10 07:03:06 +0000
commit198b0d886817f2c5bc97cfd11857d4b314dffae3 (patch)
tree4fc2d51de46ab69b9e67149abf0ab6a332032f27 /server/src/pracrodaopgsql.h
parent730eb796bbce6f124be9194f1565b7dda1daddf1 (diff)
Add transaction support on database pr. pracro session. Makes it possible to discard all edited macros.
Diffstat (limited to 'server/src/pracrodaopgsql.h')
-rw-r--r--server/src/pracrodaopgsql.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/server/src/pracrodaopgsql.h b/server/src/pracrodaopgsql.h
index b226cfd..b3e0c86 100644
--- a/server/src/pracrodaopgsql.h
+++ b/server/src/pracrodaopgsql.h
@@ -32,25 +32,45 @@
#ifndef WITHOUT_DB
-#include "pracrodao.h"
+#include <string>
#include <pqxx/pqxx>
+#include "pracrodao.h"
+
class PracroDAOPgsql : public PracroDAO
{
public:
- PracroDAOPgsql(std::string _host, std::string _port, std::string _user, std::string _passwd, std::string _dbname);
+ PracroDAOPgsql(std::string _host, std::string _port,
+ std::string _user, std::string _passwd, std::string _dbname);
~PracroDAOPgsql();
- void commitTransaction(std::string user, std::string patientid, Macro &macro, Fields &fields, time_t now);
- Values getLatestValues(std::string patientid, Macro *macro, Fieldnames &fieldnames, time_t oldest);
- unsigned nrOfCommits(std::string patientid, std::string macroname, time_t oldest);
+ void commitTransaction(std::string user,
+ std::string patientid,
+ Macro &macro,
+ Fields &fields,
+ time_t now);
+ Values getLatestValues(std::string patientid,
+ Macro *macro,
+ Fieldnames &fieldnames,
+ time_t oldest);
+ unsigned nrOfCommits(std::string patientid,
+ std::string macroname,
+ time_t oldest);
void addFieldname(std::string name, std::string description);
void delFieldname(std::string name);
std::vector<Fieldname> getFieldnames();
+ void commit();
+ void discard();
+ std::string serialise();
+ void restore(const std::string &data);
+
private:
pqxx::connection *conn;
+ pqxx::work *W;
+
+ std::string statements;
};
#endif/*WITHOUT_DB*/