X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=html%2Fdo-set-active-tournament.pl;fp=html%2Fdo-set-active-tournament.pl;h=297cc6c71ab59d4d79626a54532629bc2a4cca45;hp=0000000000000000000000000000000000000000;hb=30242c3b02e59866f05eb99872d247ccdeda513f;hpb=17fb1bf2b14db43f9e9e9342ed355169a60099cb diff --git a/html/do-set-active-tournament.pl b/html/do-set-active-tournament.pl new file mode 100755 index 0000000..297cc6c --- /dev/null +++ b/html/do-set-active-tournament.pl @@ -0,0 +1,24 @@ +#! /usr/bin/perl + +use ccbs; +use strict; +use warnings; + +my $dbh = ccbs::db_connect(); +my $cgi = new CGI; + +my $tournament = $cgi->param('tournament'); +$dbh->{AutoCommit} = 0; + +$dbh->do('DELETE FROM bigscreen.active_tournament'); +if ($tournament != -1) { + $dbh->do('INSERT INTO bigscreen.active_tournament VALUES (?)', undef, $tournament); +} + +# we don't have triggers in place yet, notify manually +$dbh->do('NOTIFY active_tournament'); +$dbh->commit; + +ccbs::print_see_other('set-active-tournament.pl'); + +$dbh->disconnect;