c27ebf5b18599445eab4c20d1f5d8bcdf32c52df
[ccbs] / html / do-set-active-tournament.pl
1 #! /usr/bin/perl
2
3 use ccbs;
4 use strict;
5 use warnings;
6
7 my $dbh = ccbs::db_connect();
8 my $cgi = new CGI;
9
10 my $tournament = $cgi->param('tournament');
11 $dbh->{AutoCommit} = 0;
12
13 $dbh->do('DELETE FROM bigscreen.active_groups');
14 $dbh->do('DELETE FROM bigscreen.active_tournament');
15 if ($tournament != -1) {
16         $dbh->do('INSERT INTO bigscreen.active_tournament VALUES (?)', undef, $tournament);
17 }
18
19 # we don't have triggers in place yet, notify manually
20 $dbh->do('NOTIFY active_tournament');
21 $dbh->commit;
22
23 ccbs::print_see_other('set-active-tournament.pl');
24
25 $dbh->disconnect;