[Bio] / Sprout / SproutStats.pl Repository:
ViewVC logotype

Annotation of /Sprout/SproutStats.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     =head1 Sprout Stats
4 :    
5 :     Display the number of records in each Sprout table.
6 :    
7 :     The currently-supported command-line options are as follows.
8 :    
9 :     =over 4
10 :    
11 :     =item trace
12 :    
13 :     Numeric trace level. A higher trace level causes more messages to appear. The
14 :     default trace level is 2.
15 :    
16 :     =back
17 :    
18 :     =cut
19 :    
20 :     use strict;
21 :     use Tracer;
22 :     use Sprout;
23 :     use ERDB;
24 :     use SFXlate;
25 :    
26 :     # Get the command-line options.
27 :     my ($options, @parameters) = Tracer::ParseCommand({ trace => 2 }, @ARGV);
28 :     # Set up tracing.
29 :     my $traceLevel = $options->{trace};
30 :     TSetup("$traceLevel errors Tracer", "TEXT");
31 :     # Get the ERDB object.
32 :     my $sprout = SFXlate->new_sprout_only();
33 : parrello 1.2 my $erdb = $sprout;
34 : parrello 1.1 # Get its database handle.
35 :     my $dbh = $erdb->{_dbh};
36 :     # Get the list of table names.
37 :     my @tables = $erdb->GetTableNames();
38 :     # Loop through the tables.
39 :     for my $table (@tables) {
40 :     # Insure this table exists.
41 :     if (! $dbh->table_exists($table)) {
42 :     Trace("Table $table not found in database.") if T(0);
43 :     } else {
44 :     # Get the number of records.
45 :     my $rv = $dbh->SQL("SELECT COUNT(*) FROM $table");
46 :     Trace($rv->[0]->[0] . " records in table $table.") if T(2);
47 :     }
48 :     }
49 :    
50 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3