Lemonldap-NG-Common
view release on metacpan or search on metacpan
lib/Lemonldap/NG/Common/Conf/Backends/_DBI.pm view on Meta::CPAN
my $self = shift;
$self->{dbiTable} ||= "lmConfig";
return $self->{_dbh} if ( $self->{_dbh} and $self->{_dbh}->ping );
$self->{_dbh} = DBI->connect_cached( $self->{dbiChain}, $self->{dbiUser},
$self->{dbiPassword}, { RaiseError => 1, AutoCommit => 1, } );
if ( $self->{dbiChain} =~ /^dbi:sqlite/i ) {
$self->{_dbh}->{sqlite_unicode} = 1;
}
elsif ( $self->{dbiChain} =~ /^dbi:mysql/i ) {
eval {
$self->{_dbh}->{mysql_enable_utf8} = 1;
$self->{_dbh}->do("set names 'utf8'");
};
}
elsif ( $self->{dbiChain} =~ /^dbi:pg/i ) {
$self->{_dbh}->{pg_enable_utf8} = 1;
}
# DBD::MariaDB should have o problem here
return $self->{_dbh};
}
lib/Lemonldap/NG/Common/Notifications/DBI.pm view on Meta::CPAN
my $self = shift;
return $self->{_dbh} if ( $self->{_dbh} and $self->{_dbh}->ping );
$self->logger->debug("Notification DBI connection lost, getting a new one");
$self->{_dbh} = DBI->connect_cached( $self->{dbiChain}, $self->{dbiUser},
$self->{dbiPassword}, { RaiseError => 1, AutoCommit => 1, } );
if ( $self->{dbiChain} =~ /^dbi:sqlite/i ) {
$self->{_dbh}->{sqlite_unicode} = 1;
}
elsif ( $self->{dbiChain} =~ /^dbi:mysql/i ) {
eval {
$self->{_dbh}->{mysql_enable_utf8} = 1;
$self->{_dbh}->do("set names 'utf8'");
};
}
elsif ( $self->{dbiChain} =~ /^dbi:pg/i ) {
$self->{_dbh}->{pg_enable_utf8} = 1;
}
return $self->{_dbh};
}
( run in 0.280 second using v1.01-cache-2.11-cpan-00829025b61 )