From ed24baca8576c0516db07dbe904f9567a65c37c3 Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 17 Feb 2011 12:35:46 +0000 Subject: 'Renamed' active/setActive methods to idle/setIdle, since these names makes more sence. --- server/src/pracrodaopgsql.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'server/src/pracrodaopgsql.cc') diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc index b8fb505..8eb3d16 100644 --- a/server/src/pracrodaopgsql.cc +++ b/server/src/pracrodaopgsql.cc @@ -492,7 +492,7 @@ void PracroDAOPgsql::discard(std::string sessionid) } } -bool PracroDAOPgsql::active(std::string sessionid) +bool PracroDAOPgsql::idle(std::string sessionid) { std::string ts = "SELECT status FROM commits WHERE uid='"+sessionid+"';"; pqxx::work W(*conn); @@ -500,22 +500,18 @@ bool PracroDAOPgsql::active(std::string sessionid) pqxx::result::const_iterator ri = R.begin(); if(ri != R.end()) { std::string status = (*ri)[0].c_str(); - if(status == "idle") { - return false; - } else { - return true; - } + return status == "idle"; } return false; } -void PracroDAOPgsql::setActive(std::string sessionid, bool a) +void PracroDAOPgsql::setIdle(std::string sessionid, bool idle) { std::string ts; try { pqxx::work W(*conn); - if(a == false) { + if(idle) { ts = "UPDATE commits SET status='idle' WHERE uid="+sessionid+ " AND status='active';"; } else { @@ -526,7 +522,7 @@ void PracroDAOPgsql::setActive(std::string sessionid, bool a) W.commit(); } catch (std::exception &e) { - ERR_LOG(db, "setActive failed: %s: %s\n", e.what(), ts.c_str()); + ERR_LOG(db, "setIdle failed: %s: %s\n", e.what(), ts.c_str()); } } -- cgit v1.2.3