#!/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;