-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdiffinterfacetable
More file actions
executable file
·112 lines (95 loc) · 3.03 KB
/
diffinterfacetable
File metadata and controls
executable file
·112 lines (95 loc) · 3.03 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/perl
use CGI;
use Carp;
use DBI;
use Env qw(LSBUSER LSBDBPASSWD LSBDB LSBDBHOST);
$query = new CGI(%ARGV);
#foreach $name ( $query->param('nLname')) {
# print $name,"\n";
#}
#exit;
$dbh = DBI->connect('DBI:mysql:database='.$LSBDB.';host='.$LSBDBHOST, $LSBUSER, $LSBDBPASSWD)
or die "Couldn't connect to database: ".DBI->errstr;
foreach $lib ( $query->param('nLname') ) {
local(*where);
local(*where2);
$select ="SELECT DISTINCT Interface.Iname ";
$select .="FROM Interface,LibInt,Library ";
push(@where,"Library.Lname='$lib'");
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 STDERR $select,"\n";
$sth = $dbh->prepare($select) or die "Couldn't prepare $select query: ".DBI->errstr;
$sth->execute or die "Couldn't execute $select query: ".DBI->errstr;
#printf STDERR "numrows=%d\n", $sth->numrows;
for(1..$sth->rows) {
$entry = $sth->fetchrow_hashref;
$exclude{$entry->{'Iname'}}=$_;
}
$sth->finish;
$select ="SELECT DISTINCT Mangle.Mname ";
$select .="FROM Mangle,Library ";
push(@where2,"Library.Lname='$lib'");
push(@where2,"Mangle.Mlib=Library.Lid");
if( scalar(@where2) > 0 ) {
$select .= " WHERE ".join(" AND ",@where2);
}
$select .=" ORDER BY Mangle.Mname ";
#printf STDERR $select,"\n";
$sth2 = $dbh->prepare($select) or die "Couldn't prepare $select query: ".DBI->errstr;
$sth2->execute or die "Couldn't execute $select query: ".DBI->errstr;
#printf STDERR "numrows=%d\n", $sth->numrows;
for(1..$sth2->rows) {
$entry = $sth2->fetchrow_hashref;
$exclude{$entry->{'Mname'}}=$_;
#print $entry->{'Mname'}."<BR>";
}
$sth2->finish;
}
$numentry=0;
foreach $lib ( $query->param('Lname') ) {
local(*where);
local(*where2);
$select ="SELECT DISTINCT Interface.Iname ";
$select .="FROM Interface,LibInt,Library ";
push(@where3,"Library.Lname='$lib'");
push(@where3,"LibInt.LIlib=Library.Lid");
push(@where3,"LibInt.LIint=Interface.Iid");
#push(@where3,"Interface.Iname NOT LIKE '\\_\\_%'");
if( scalar(@where3) > 0 ) {
$select .= " WHERE ".join(" AND ",@where3);
}
$select .=" ORDER BY Interface.Iname ";
#printf STDERR $select,"\n";
$sth = $dbh->prepare($select) or die "Couldn't prepare $select query: ".DBI->errstr;
$sth->execute or die "Couldn't execute $select query: ".DBI->errstr;
#printf STDERR "numrows=%d\n", $sth->numrows;
for(1..$sth->rows) {
$entry = $sth->fetchrow_hashref;
if ( ! $exclude{$entry->{'Iname'}} ) {
$tentry[$numentry++]=$entry->{'Iname'};
}
}
$sth->finish;
}
print "<HTML>\n";
print "<BODY>\n";
print "<TABLE>\n";
$inc=($numentry+4)/5;
for(1..$inc) {
print "<TR>";
printf "<TD>%s</TD>",$tentry[$_];
printf "<TD>%s</TD>",$tentry[$_+$inc];
printf "<TD>%s</TD>",$tentry[$_+(2*$inc)];
printf "<TD>%s</TD>",$tentry[$_+(3*$inc)];
printf "<TD>%s</TD>",$tentry[$_+(4*$inc)];
print "</TR>\n";
}
print "</TABLE>\n";
print "</BODY>\n";
print "</HTML>\n";