Apache-Session-MariaDB

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

DESCRIPTION

    This module is an implementation of Apache::Session. It uses the
    MariaDB backing store and the MariaDB locking scheme. See the example,
    and the documentation for Apache::Session::Store::MariaDB and
    Apache::Session::Lock::MariaDB for more details.

    It's based on Apache::Session::MySQL but uses DBD::MariaDB instead of
    DBD::mysql. The initial reason to create this new module is that
    DBD::MariaDB requires to explicitly indicate a_session column as binary
    in DBI's bind_param calls, which is different from DBD::mysql and thus
    Apache::Session::MySQL doesn't support it.

AUTHOR

    Best Practical Solutions, LLC <modules@bestpractical.com>

    Jeffrey William Baker <jwbaker@acm.org>

    Tomas Doran <bobtfish@bobtfish.net<gt>

lib/Apache/Session/MariaDB.pm  view on Meta::CPAN

=head1 DESCRIPTION

This module is an implementation of Apache::Session. It uses the
MariaDB backing store and the MariaDB locking scheme. See the example,
and the documentation for Apache::Session::Store::MariaDB and
Apache::Session::Lock::MariaDB for more details.

It's based on L<Apache::Session::MySQL> but uses L<DBD::MariaDB> instead
of L<DBD::mysql>. The initial reason to create this new module is that
L<DBD::MariaDB> requires to explicitly indicate C<a_session> column as
binary in L<DBI>'s bind_param calls, which is different from L<DBD::mysql>
and thus L<Apache::Session::MySQL> doesn't support it.

=head1 AUTHOR

Best Practical Solutions, LLC E<lt>modules@bestpractical.comE<gt>

Jeffrey William Baker E<lt>jwbaker@acm.orgE<gt>

Tomas Doran E<lt>bobtfish@bobtfish.net<gt>

lib/Apache/Session/Store/MariaDB.pm  view on Meta::CPAN


    local $self->{dbh}->{RaiseError} = 1;

    if ( !defined $self->{insert_sth} ) {
        $self->{insert_sth} = $self->{dbh}->prepare_cached(
            qq{
                INSERT INTO $self->{'table_name'} (id, a_session) VALUES (?,?)}
        );
    }

    $self->{insert_sth}->bind_param( 1, $session->{data}->{_session_id} );
    $self->{insert_sth}->bind_param( 2, $session->{serialized}, DBI::SQL_BLOB );

    $self->{insert_sth}->execute;

    $self->{insert_sth}->finish;
}


sub update {
    my $self    = shift;
    my $session = shift;

lib/Apache/Session/Store/MariaDB.pm  view on Meta::CPAN


    local $self->{dbh}->{RaiseError} = 1;

    if ( !defined $self->{update_sth} ) {
        $self->{update_sth} = $self->{dbh}->prepare_cached(
            qq{
                UPDATE $self->{'table_name'} SET a_session = ? WHERE id = ?}
        );
    }

    $self->{update_sth}->bind_param( 1, $session->{serialized}, DBI::SQL_BLOB );
    $self->{update_sth}->bind_param( 2, $session->{data}->{_session_id} );

    $self->{update_sth}->execute;

    $self->{update_sth}->finish;
}

1;

=pod



( run in 1.028 second using v1.01-cache-2.11-cpan-2398b32b56e )