/usr/share/gmod/chado/bin/testdb.pl is in libchado-perl 1.23-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/usr/bin/perl -w
use strict;
use DBI;
use Bio::GMOD::Config;
use Bio::GMOD::DB::Config;
use Getopt::Long;
use URI::Escape;
my $gmod_conf = $ENV{'GMOD_ROOT'} ?
Bio::GMOD::Config->new($ENV{'GMOD_ROOT'}) :
Bio::GMOD::Config->new();
my $db_conf = Bio::GMOD::DB::Config->new($gmod_conf,'gmod-chado');
my $dbh = eval {$db_conf->dbh};
if( $@ =~ m/couldn't create db connection/i ) {
exit 102;
}
my $nbtables = $dbh->prepare("select count(*) as nbtables from pg_tables");
$nbtables->execute() or exit 102;
my $arrayref = $nbtables->fetchrow_arrayref();
$nbtables = $$arrayref[0];
$dbh->disconnect;
if($nbtables>0) {
print "Database already exists, update it\n";
exit 101;
}
else {
print "Empty database, create it\n";
exit 100;
}
|