CPAN-MetaCurator
view release on metacpan or search on metacpan
data/cpan.metacurator.conf view on Meta::CPAN
# Database stuff
# --------------
AutoCommit = 1
dsn = dbi:SQLite:dbname=data/cpan.metacurator.sqlite
#dsn = dbi:mysql:database=cpan.metacurator
#dsn = dbi:Pg:dbname=cpan.metacurator
RaiseError = 1
username = local
password = local
mysql_enable_utf8 = 1
sqlite_string_mode = DBD_SQLITE_STRING_MODE_BYTES # Not used. See Create.pm.
# General stuff
# -------------
log_path = log/development.log
[webhost]
# TBA.
lib/CPAN/MetaCurator/Util/Database.pm view on Meta::CPAN
# -----------------------------------------------
sub init_db
{
my($self) = @_;
my($config) = $self -> config;
my(%attributes) =
(
AutoCommit => $$config{AutoCommit},
mysql_enable_utf8 => $$config{mysql_enable_utf8}, #Ignored if not using MySQL.
RaiseError => $$config{RaiseError},
sqlite_unicode => $$config{sqlite_unicode}, #Ignored if not using SQLite.
);
my(@dsn) = split('=', $$config{dsn});
$dsn[1] = File::Spec -> catfile($self -> home_path, $dsn[1]);
$dsn[0] = "$dsn[0]=$dsn[1]";
$self -> dbh(DBI -> connect($dsn[0], $$config{username}, $$config{password}, \%attributes) );
$self -> dbh -> do('PRAGMA foreign_keys = ON') if ($$config{dsn} =~ /SQLite/i);
( run in 0.224 second using v1.01-cache-2.11-cpan-f985c23238c )