-/* A trigger that sets a flag whenever it's trigged. */
-class FlagTrigger : pqxx::trigger {
-private:
- bool flag;
-
-public:
- FlagTrigger(pqxx::connection_base &conn, const PGSTD::string &name)
- : pqxx::trigger(conn, name), flag(false) {}
- virtual ~FlagTrigger() throw () {}
-
- virtual void operator() (int pid)
- {
- 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;
- }
-};
+Tournament active_tournament;
+std::vector<Group> active_groups;
+unsigned char framebuf[800 * 600 * 4];