sort($teams);
    foreach ($allteams as $team) {
        if (!in_array($team, $current)) {
            printf("missing %s\n", $team);
            $comp->insertTeam($con, $team);
        }
    }
}
function insertMatches($con, $comp, $matches)
{
    foreach ($matches as $match) {
        $red = $match->RedAlliance;
        $blue = $match->BlueAlliance;
        $match->insert($con);
        $red->insert($con);
        $blue->insert($con);
        printf("%s - {$s}: %s, %s\n", $match->Number, $match->ID, $red->ID, $blue->ID);
    }
}
//---------------------------------------------------------------------------//
$name = "Autodesk Portland Regional 2013";
$con = DB::connect();
$comp = competition::selectByName($con, $name);
if (!$comp) {
    die("Competition \"{$name}\" not found.");
}
printf("Competition {$name} ID=%s\n", $comp->ID);
$matches = readMatches($comp, "portland-2013.tsv");
// reportMatches();
addTeams($con, $comp, $matches);
insertMatches($con, $comp, $matches);
            $comp->insertTeam($con, $team->Number);
        } else {
            printf("Team %s to already added.\n", $team->Number);
        }
    }
}
function insertMatches($con, $comp, $matches)
{
    foreach ($matches as $match) {
        $red = $match->RedAlliance;
        $blue = $match->BlueAlliance;
        $match->insert($con);
        $red->insert($con);
        $blue->insert($con);
        printf("%s - {$s}: %s, %s\n", $match->Number, $match->ID, $red->ID, $blue->ID);
    }
}
//---------------------------------------------------------------------------//
$compname = $argv[1];
$teampath = $argv[2];
printf("Importing teams for competition %s from %s.\n", $compname, $teampath);
$con = DB::connect();
$comp = competition::selectByName($con, $compname);
if (!$comp) {
    die("Competition \"{$name}\" not found.");
}
printf("Competition {$name} ID=%s\n", $comp->ID);
$teams = readTeams($comp, $teampath);
// reportTeams($teams);
addTeams($con, $comp, $teams);