1 #include "fetch_highscore.h"
3 FetchHighscore::FetchHighscore(unsigned song, Highscore *hs)
4 : song(song), hs(hs) {}
6 void FetchHighscore::operator() (pqxx::transaction<> &t)
8 pqxx::result res( t.exec("SELECT score,nick,tournamentname FROM scores NATURAL JOIN players NATURAL JOIN tournaments WHERE song=" + pqxx::to_string(song) + " AND score IS NOT NULL ORDER BY score DESC LIMIT 1") );
13 pqxx::result::tuple highscore = res.at(0);
15 hs->score = highscore["score"].as(hs->score);
16 hs->nick = highscore["nick"].as(hs->nick);
17 hs->tournament_name = highscore["tournamentname"].as(hs->tournament_name);
18 } catch (PGSTD::out_of_range &e) {