Newer
Older
Ian Longden
committed
my ($self) = @_;
Ian Longden
committed
my $core_db = $self->core->dbc;
$core_db->connect();
my $row = @{$core_db->db_handle->selectall_arrayref("SELECT COUNT(*) FROM external_db")}[0];
my $count = @{$row}[0];
if ($count == 0) {
my $edb = cwd() . "/../external_db/external_dbs.txt";
print "external_db table is empty, uploading from $edb\n";
Ian Longden
committed
my $edb_sth = $core_db->prepare("LOAD DATA INFILE \'$edb\' INTO TABLE external_db");
$edb_sth->execute();
} else {
print "external_db table already has $count rows, will not change it\n";
}
}