]> git.sesse.net Git - ccbs/blobdiff - bigscreen/fetch_max_score_for_song.cpp
Fetch all the "max score for song" entries in one go instead of one at a time.
[ccbs] / bigscreen / fetch_max_score_for_song.cpp
diff --git a/bigscreen/fetch_max_score_for_song.cpp b/bigscreen/fetch_max_score_for_song.cpp
deleted file mode 100644 (file)
index efac925..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "fetch_max_score_for_song.h"
-
-FetchMaxScoreForSong::FetchMaxScoreForSong(unsigned tournament, unsigned song, unsigned *score)
-       : tournament(tournament), song(song), score(score) {}
-       
-void FetchMaxScoreForSong::operator() (pqxx::transaction<> &t)
-{
-       pqxx::result res( t.exec("SELECT MAX(feetrating)*1000 AS max_score FROM songratings WHERE song=" +
-               pqxx::to_string(song) + " AND machine=( SELECT machine FROM tournaments WHERE tournament=" +
-               pqxx::to_string(tournament) + ")") );
-       
-       *score = res.at(0)["max_score"].as(*score);
-}