+ flag = true;
+ std::fprintf(stderr, "Received a flag trigger from pid %u\n", pid);
+ }
+
+ bool get_flag() const
+ {
+ return flag;
+ }
+
+ void reset_flag()
+ {
+ flag = false;
+ }
+};
+
+/* A transactor that fetches the current tournament and some information about it. */
+class FetchCurrentTournament : public pqxx::transactor<> {
+private:
+ int id;
+ std::string name;
+
+public:
+ FetchCurrentTournament() {}
+ void operator() (pqxx::transaction<> &t)
+ {
+ pqxx::result res( t.exec("SELECT * FROM bigscreen.active_tournament NATURAL JOIN tournaments") );
+ try {
+ pqxx::result::tuple tournament = res.at(0);
+
+ id = tournament["tournament"].as(id);
+ name = tournament["tournament"].as(name);
+ } catch (PGSTD::out_of_range &e) {
+ std::fprintf(stderr, "foof\n");
+
+ id = -1;
+ name = "";
+ }
+ }
+
+ int get_tournament_id() const
+ {
+ return id;
+ }
+
+ std::string get_tournament_name() const
+ {
+ return name;