aboutsummaryrefslogtreecommitdiffstats
path: root/utils/webNLT.pl
blob: fb29fd292e2d8f5e5310d1e5ef53387ee77ff783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/perl

use DBI;
use CGI;

$q = new CGI;
print $q->header();
print $q->start_html(-title=>"Nightly Tester DB");

unless($q->param('pwd'))
  {
    print $q->startform();
    print $q->password_field(-name=>"pwd", -size=>20, -maxlength=>20);
    print $q->submit();
    print $q->endform();
  }
else
  {
    # database information
    $db="llvmalpha";
    $host="localhost";
    $userid="llvmdbuser";
    $passwd=$q->param('pwd');
    $connectionInfo="dbi:mysql:$db;$host";
    
    # make connection to database
    $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die DBI->errstr;
    $query = "Select DISTINCT(NAME) from Tests";
    my $sth = $dbh->prepare($query) || die "Can't prepare statement: $DBI::errstr";
    my $rc = $sth->execute or die DBI->errstr;
    while (($n) = $sth->fetchrow_array)
      {
        push @names, ($n);
#        print "$n<P>";
      }
    $query = "Select DISTINCT(TEST) from Tests";
    my $sth = $dbh->prepare($query) || die "Can't prepare statement: $DBI::errstr";
    my $rc = $sth->execute or die DBI->errstr;
    while (($n) = $sth->fetchrow_array)
      {
        push @tests, ($n);
#        print "$n\n";
      }

#    print join "<BR>", @names;

    print $q->startform();
    print $q->scrolling_list(-name=>"test", -values=>\@tests, -multiple=>'true');
    print "<P>";
    print $q->scrolling_list(-name=>"name", -values=>\@names, -multiple=>'true');
    print "<P>";
    print $q->submit();
    print $q->hidden("pwd", $q->param('pwd'));
    print $q->endform();

    # disconnect from database
    $dbh->disconnect;

    #now generate the urls to the chart
    if ($q->param('test') && $q->param('name'))
      {
        my @names = $q->param('name');
        my @tests = $q->param('test');
        print "<P>";
        print join "<BR>", @names;
        print "<P>";
        print join "<BR>", @tests;
        print "<P>";
        $str = "pwd=" . $q->param('pwd');
        $count = 0;
        foreach $n (@names)
          {
            foreach $t (@tests)
              {
                $str = "$str&t$count=$t&n$count=$n";
                $count++;
              }
          }
        print "<img src=\"cgiplotNLT.pl?$str\">";
      }
  }

print $q->end_html();