Commit 7e8a007b authored by Xavier Guimard's avatar Xavier Guimard

Accept DBD::MariaDB (#1490)

parent 27aea3ec
......@@ -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
;
......
......@@ -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)$/
)
......
......@@ -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",
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment