Accept DBD::MariaDB (#1490)

This commit is contained in:
Xavier Guimard 2018-08-23 07:01:22 +02:00
parent 27aea3ecd2
commit 7e8a007b02
4 changed files with 10 additions and 5 deletions

View File

@ -108,7 +108,7 @@ logLevel = warn
;
; type = RDBI
; ;type = CDBI
; dbiChain = DBI:mysql:database=lemonldap-ng;host=1.2.3.4
; dbiChain = DBI:MariaDB:database=lemonldap-ng;host=1.2.3.4
; dbiUser = lemonldap
; dbiPassword = password
;

View File

@ -174,6 +174,9 @@ sub get_key_from_all_sessions {
$args->{unserialize} =
\&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::_unserialize;
}
# For now, Apache::Session::MariaDB doesn't exists.
# Apache::Session::Browseable::MariaDB has its own get_key_from_all_sessions
if ( $backend =~
/^Apache::Session::(SQLite\d?|MySQL|MySQL::NoLock|Postgres|Oracle|Sybase|Informix)$/
)

View File

@ -45,7 +45,7 @@ BEGIN {
# - Nothing: default configuration file is tested,
# - { confFile => "/path/to/storage.conf" },
# - { Type => "File", dirName => "/path/to/conf/dir/" },
# - { Type => "DBI", dbiChain => "DBI:mysql:database=lemonldap-ng;host=1.2.3.4",
# - { Type => "DBI", dbiChain => "DBI:MariaDB:database=lemonldap-ng;host=1.2.3.4",
# dbiUser => "user", dbiPassword => "password" },
# - { Type => "SOAP", proxy => "https://auth.example.com/config" },
# - { Type => "LDAP", ldapServer => "ldap://localhost", ldapConfBranch => "ou=conf,ou=applications,dc=example,dc=com",

View File

@ -70,12 +70,14 @@ sub _dbh {
elsif ( $self->{dbiChain} =~ /^dbi:pg/i ) {
$self->{_dbh}->{pg_enable_utf8} = 1;
}
# DBD::MariaDB should have o problem here
return $self->{_dbh};
}
sub lock {
my $self = shift;
if ( $self->{dbiChain} =~ /^dbi:mysql:/i ) {
if ( $self->{dbiChain} =~ /^dbi:(?:MariaDB|mysql):/i ) {
my @row = $self->_dbh->selectrow_array("SELECT GET_LOCK('lmconf', 0)");
return $row[0] || 0;
}
@ -84,7 +86,7 @@ sub lock {
sub isLocked {
my $self = shift;
if ( $self->{dbiChain} =~ /^dbi:mysql:/i ) {
if ( $self->{dbiChain} =~ /^dbi:(?:MariaDB|mysql):/i ) {
my @row = $self->_dbh->selectrow_array("SELECT IS_FREE_LOCK('lmconf')");
return $row[0] ? 0 : 1;
}
@ -93,7 +95,7 @@ sub isLocked {
sub unlock {
my $self = shift;
if ( $self->{dbiChain} =~ /^dbi:mysql:/i ) {
if ( $self->{dbiChain} =~ /^dbi:(?:MariaDB|mysql):/i ) {
my @row = $self->_dbh->selectrow_array("SELECT RELEASE_LOCK('lmconf')");
return $row[0] || 0;
}