#!/usr/bin/perl

print STDERR "Depricated.  Use /app/tools/dbadmin/bin/diff_all.pl\n";
exit 1;

my $file = 'FILE:///app/tools/rps/sql/create/RPS_CLIENT_DB.sql';

my @dbNames = _getAllDatabaseNames();

foreach my $dbName (@dbNames) {
    print "./diff_dbs.pl $file $dbName > $dbName\n";
    `./diff_dbs.pl $file $dbName > $dbName`;
}

sub _getAllDatabaseNames {

    # First, query mysql to get the list of dbs.
    #

    my $dbsRaw = `/usr/bin/mysqlshow -uroot`;

    # Doesn't seem to be a way to get a simple list - so we have to parse the
    # names out from all the extra display frosting this command returns.
    #

    my @dbNames;
    my @lines = split( "\n", $dbsRaw );

    for ( my $i = 0 ; $i < ( scalar @lines ) - 1 ; $i++ ) {

        # First three lines are crap.
        #
        next if $i < 3;

        if ( $lines[$i] =~ m/\| (\S*) (.*)\|/ ) {
            my $name = $1;
            push @dbNames, $1 if 'C_' eq substr( $1, 0, 2 );
        }
    }

    return @dbNames;
}

