X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Ffetch_list_of_active_groups.cpp;fp=bigscreen%2Ffetch_list_of_active_groups.cpp;h=1df67585ce55c94d15816dde7dc3226445173d4d;hp=0000000000000000000000000000000000000000;hb=44f3ad694f8fe5dd76602d30c9bc1f3de9650f97;hpb=c582866b27054fcbce6fcde40dbec73c7ae9d91d diff --git a/bigscreen/fetch_list_of_active_groups.cpp b/bigscreen/fetch_list_of_active_groups.cpp new file mode 100644 index 0000000..1df6758 --- /dev/null +++ b/bigscreen/fetch_list_of_active_groups.cpp @@ -0,0 +1,19 @@ +#include "fetch_list_of_active_groups.h" + +FetchListOfActiveGroups::FetchListOfActiveGroups(std::vector *active) : active(active) {} +void FetchListOfActiveGroups::operator() (pqxx::transaction<> &t) +{ + // make sure we start with an empty list + active->erase(active->begin(), active->end()); + + pqxx::result res( t.exec("SELECT * FROM bigscreen.active_groups") ); + for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) { + Group g; + + g.tournament = i["tournament"].as(g.tournament); + g.round = i["round"].as(g.round); + g.parallel = i["parallel"].as(g.parallel); + + active->push_back(g); + } +}