]> git.sesse.net Git - ccbs/blobdiff - bigscreen/fetch_max_score_for_songs.h
Fetch all the "max score for song" entries in one go instead of one at a time.
[ccbs] / bigscreen / fetch_max_score_for_songs.h
diff --git a/bigscreen/fetch_max_score_for_songs.h b/bigscreen/fetch_max_score_for_songs.h
new file mode 100644 (file)
index 0000000..935dd0a
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef _FETCH_MAX_SCORE_FOR_SONGS_H
+#define _FETCH_MAX_SCORE_FOR_SONGS_H 1
+
+#include <pqxx/transactor>
+#include <map>
+
+/* A transactor that fetches the maximum score for all songs */
+class FetchMaxScoreForSongs : public pqxx::transactor<> {
+private:
+       unsigned tournament;
+       std::map<unsigned, unsigned> *score;
+
+public:
+       FetchMaxScoreForSongs(unsigned tournament, std::map<unsigned, unsigned> *score);
+       void operator() (pqxx::transaction<> &t);
+};
+
+#endif /* !defined(_FETCH_MAX_SCORE_FOR_SONGS_H) */