-
Notifications
You must be signed in to change notification settings - Fork 1
/
mkinterfacetable
executable file
·59 lines (49 loc) · 1.5 KB
/
mkinterfacetable
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
#!/usr/bin/perl
use CGI;
use Carp;
use Mysql;
use Env qw(LSBUSER LSBDBPASSWD LSBDB LSBDBHOST);
$query = new CGI(%ARGV);
$Dbh = Mysql->connect($LSBDBHOST,$LSBDB,$LSBUSER, $LSBDBPASSWD) || die $Mysql::db_errstr;
$select ="SELECT DISTINCT Interface.Iname ";
$select .="FROM Standard,Interface,LibInt,Library ";
if ( $query->param('Sname') ) {
push(@where,"Standard.Sname=".$Dbh->quote($query->param('Sname')));
push(@where,"Interface.Istandard=Standard.Sid");
}
if ( $query->param('nSname') ) {
push(@where,"Standard.Sname=".$Dbh->quote($query->param('nSname')));
push(@where,"Interface.Istandard!=Standard.Sid");
}
if ( $query->param('Lname') ) {
push(@where,"Library.Lname=".$Dbh->quote($query->param('Lname')));
push(@where,"LibInt.LIlib=Library.Lid");
push(@where,"LibInt.LIint=Interface.Iid");
}
push(@where,"Interface.Iname NOT LIKE '\\_\\_%'");
if( scalar(@where) > 0 ) {
$select .= " WHERE ".join(" AND ",@where);
}
$select .=" ORDER BY Interface.Iname ";
#printf $select,"\n";
$sth = $Dbh->query($select) || die $select."\n".$Dbh->errmsg();
for(1..$sth->numrows) {
%entry=$sth->fetchhash;
$entry[$_]=$entry{'Iname'};
}
print "<HTML>\n";
print "<BODY>\n";
print "<TABLE>\n";
$inc=($sth->numrows+4)/5;
for(1..$inc) {
print "<TR>";
printf "<TD>%s</TD>",$entry[$_];
printf "<TD>%s</TD>",$entry[$_+$inc];
printf "<TD>%s</TD>",$entry[$_+(2*$inc)];
printf "<TD>%s</TD>",$entry[$_+(3*$inc)];
printf "<TD>%s</TD>",$entry[$_+(4*$inc)];
print "</TR>\n";
}
print "</TABLE>\n";
print "</BODY>\n";
print "</HTML>\n";