summaryrefslogtreecommitdiff
path: root/server/src/pracrodaopgsql.cc
diff options
context:
space:
mode:
authordeva <deva>2011-02-04 13:34:40 +0000
committerdeva <deva>2011-02-04 13:34:40 +0000
commit6bae4fd17d2660d53279dac9287de52be2a00c6c (patch)
tree595f7aa65558735a3fc05062d39e95e88b026a51 /server/src/pracrodaopgsql.cc
parente6a824034c742b9a414d32ecfbcc8531180f93dc (diff)
Database pool is now used instead of one connection per session. Admin interface supports session unlock.
Diffstat (limited to 'server/src/pracrodaopgsql.cc')
-rw-r--r--server/src/pracrodaopgsql.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc
index 5a08e3a..c86797d 100644
--- a/server/src/pracrodaopgsql.cc
+++ b/server/src/pracrodaopgsql.cc
@@ -510,6 +510,27 @@ bool PracroDAOPgsql::active(std::string sessionid)
return false;
}
+void PracroDAOPgsql::setActive(std::string sessionid, bool a)
+{
+ std::string ts;
+ try {
+ pqxx::work W(*conn);
+ if(a) {
+ ts = "UPDATE commits SET status='idle' WHERE uid="+sessionid+
+ " AND status='active';";
+ } else {
+ ts = "UPDATE commits SET status='active' WHERE uid="+sessionid+
+ " AND status='idle';";
+ }
+ /*pqxx::result R = */W.exec(ts);
+
+ W.commit();
+ } catch (std::exception &e) {
+ ERR_LOG(db, "setActive failed: %s: %s\n", e.what(), ts.c_str());
+ }
+
+}
+
#endif/*WITHOUT_DB*/
#ifdef TEST_PRACRODAOPGSQL