1 #include "fetch_max_score_for_song.h"
3 FetchMaxScoreForSong::FetchMaxScoreForSong(unsigned tournament, unsigned song, unsigned *score)
4 : tournament(tournament), song(song), score(score) {}
6 void FetchMaxScoreForSong::operator() (pqxx::transaction<> &t)
8 pqxx::result res( t.exec("SELECT MAX(feetrating)*1000 AS max_score FROM songratings WHERE song=" +
9 pqxx::to_string(song) + " AND machine=( SELECT machine FROM tournaments WHERE tournament=" +
10 pqxx::to_string(tournament) + ")") );
12 *score = res.at(0)["max_score"].as(*score);