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

View of /Sprout/SproutStats.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Fri Sep 16 10:15:27 2005 UTC (14 years, 2 months ago) by parrello
Branch: MAIN
Added to enable checking statistical information about the Sprout load.

#!/usr/bin/perl -w

=head1 Sprout Stats

Display the number of records in each Sprout table.

The currently-supported command-line options are as follows.

=over 4

=item trace

Numeric trace level. A higher trace level causes more messages to appear. The
default trace level is 2.

=back

=cut

use strict;
use Tracer;
use Sprout;
use ERDB;
use SFXlate;

# Get the command-line options.
my ($options, @parameters) = Tracer::ParseCommand({ trace => 2 }, @ARGV);
# Set up tracing.
my $traceLevel = $options->{trace};
TSetup("$traceLevel errors Tracer", "TEXT");
# Get the ERDB object.
my $sprout = SFXlate->new_sprout_only();
my $erdb = $sprout->{_erdb};
# Get its database handle.
my $dbh = $erdb->{_dbh};
# Get the list of table names.
my @tables = $erdb->GetTableNames();
# Loop through the tables.
for my $table (@tables) {
    # Insure this table exists.
    if (! $dbh->table_exists($table)) {
        Trace("Table $table not found in database.") if T(0);
    } else {
        # Get the number of records.
        my $rv = $dbh->SQL("SELECT COUNT(*) FROM $table");
        Trace($rv->[0]->[0] . " records in table $table.") if T(2);
    }
}

1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3