omnitool-installer
view release on metacpan or search on metacpan
lib/omnitool/installer.pm view on Meta::CPAN
}
# method to set up the 'omnitool' and 'otstatedata' databases
sub setup_databases {
my $self = shift;
my ($dsn, $dbh, $db_name, $sth, $exists, $safe_to_modify);
# try to make the connection
$dsn = qq{DBI:mysql:database=information_schema;host=}.$self->{options}{'database-server'}.qq{;port=3306};
$dbh = DBI->connect($dsn, $self->{options}{'db-username'}, $self->{options}{'db-password'},{ PrintError => 1, RaiseError=>1, mysql_enable_utf8=>8 });
$dbh->{LongReadLen} = 1000000;
# check to see if it has our databases
foreach $db_name ('omnitool','otstatedata','omnitool_applications','omnitool_samples','sample_tools') {
$sth = $dbh->prepare(qq{select CATALOG_NAME from SCHEMATA where SCHEMA_NAME='$db_name'});
$sth->execute or print $dbh->errstr."\n";
($exists) = $sth->fetchrow_array;
if ($exists) { # if it exists, skip it
print "SKIPPED: $db_name already exists and was not be overwritten.\n";
} else { # otherwise, load it in
( run in 0.253 second using v1.01-cache-2.11-cpan-00829025b61 )