1 #include "fetch_max_score_for_players.h"
3 FetchMaxScoreForPlayers::FetchMaxScoreForPlayers(unsigned tournament, unsigned round, std::map<unsigned, unsigned> *scores)
4 : tournament(tournament), round(round), scores(scores) {}
6 void FetchMaxScoreForPlayers::operator() (pqxx::transaction<> &t)
8 scores->erase(scores->begin(), scores->end());
10 pqxx::result res( t.exec("SELECT * FROM get_max_score_for_players("
11 + pqxx::to_string(tournament) + ", " + pqxx::to_string(round) +
14 for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) {
15 unsigned player, max_score;
16 player = i["song"].as(player);
17 max_score = i["max_score"].as(max_score);
19 scores->insert(std::make_pair(player, max_score));