]> git.sesse.net Git - ccbs/blob - bigscreen/fetch_list_of_active_groups.cpp
Add a better framework for showing what's changed.
[ccbs] / bigscreen / fetch_list_of_active_groups.cpp
1 #include "fetch_list_of_active_groups.h"
2
3 FetchListOfActiveGroups::FetchListOfActiveGroups(std::vector<SkeletonGroup> *active) : active(active) {}
4 void FetchListOfActiveGroups::operator() (pqxx::transaction<> &t)
5 {
6         // make sure we start with an empty list
7         active->erase(active->begin(), active->end());
8         
9         pqxx::result res( t.exec("SELECT * FROM bigscreen.active_groups") );
10         for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) {
11                 SkeletonGroup g;
12
13                 g.tournament = i["tournament"].as(g.tournament);
14                 g.round = i["round"].as(g.round);
15                 g.parallel = i["parallel"].as(g.parallel);
16
17                 active->push_back(g);
18         }
19 }