diff options
author | deva <deva> | 2011-02-17 12:35:46 +0000 |
---|---|---|
committer | deva <deva> | 2011-02-17 12:35:46 +0000 |
commit | ed24baca8576c0516db07dbe904f9567a65c37c3 (patch) | |
tree | 569e8c7944c5f9d7f513670af212dc75c110e771 /server/src/pracrodaopgsql.cc | |
parent | db144840aba95affb3a6b5b2536059f49f0677ff (diff) |
'Renamed' active/setActive methods to idle/setIdle, since these names makes more sence.
Diffstat (limited to 'server/src/pracrodaopgsql.cc')
-rw-r--r-- | server/src/pracrodaopgsql.cc | 14 |
1 files changed, 5 insertions, 9 deletions
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()); } } |