Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:58

0001 #!/usr/bin/perl
0002 
0003 use lib "./lib";
0004 
0005 use warnings;
0006 use strict;
0007 $|++;
0008 
0009 use CondDB::MySQL;
0010 use ConnectionFile;
0011 
0012 my $condDB = ConnectionFile::connect();
0013 
0014 my $dbh = $condDB->{dbh};
0015 
0016 my @tables = @{$dbh->selectcol_arrayref("SHOW TABLES")};
0017 
0018 @tables = grep /^COND_/, @tables;
0019 
0020 my $temp1 = qq[ SELECT v.name FROM ? c LEFT JOIN channelView v
0021         ON c.logic_id = v.logic_id LIMIT 1];
0022 
0023 my $temp2 = qq[ SELECT count(distinct logic_id) FROM ? ];
0024 
0025 my $temp3 = qq[ SELECT min(since), max(since) FROM ? ];
0026 
0027 my $temp4 = qq[ SELECT count(*) FROM ? ];
0028 
0029 
0030 print join(',',("cond name", "view name", "# ch", "start", "end", "# rows")),
0031   "\n";
0032 
0033 foreach (@tables) {
0034   my @data = ($_);
0035   push @data, doit($temp1, $_);
0036   push @data, doit($temp2, $_);
0037   push @data, doit($temp3, $_);
0038   push @data, doit($temp4, $_);
0039 
0040   print join(',', @data), "\n";
0041 }
0042 
0043 sub doit {
0044   my $sql = shift;
0045   my $table = shift;
0046   $sql =~ s/\?/$table/g;
0047   return $dbh->selectrow_array($sql);
0048 }