MariaDB.pm

filter: Statementstmt 76.4% 26 / 34 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 77.2% 34 / 44 CC 1 SCAR 1.1
CC
1
Cov
76%
populate
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« MariaDB/NoLock.pm ↑ Summary Lock/MariaDB.pm »
1 package Apache::Session::MariaDB;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base 'Apache::Session';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '0.01';
9  
10 1 ▶use Apache::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Apache::Session::Lock::MariaDB;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Apache::Session::Store::MariaDB;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Apache::Session::Generate::MD5;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Apache::Session::Serialize::Storable;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 0 ▶sub populate {
Subroutine populate: not called CC=1 SCAR=6.9
Pod undocumented
17 0 my $self = shift;
18  
19 0 $self->{object_store} = new Apache::Session::Store::MariaDB $self;
20 0 $self->{lock_manager} = new Apache::Session::Lock::MariaDB $self;
21 0 $self->{generate} = \&Apache::Session::Generate::MD5::generate;
22 0 $self->{validate} = \&Apache::Session::Generate::MD5::validate;
23 0 $self->{serialize} = \&Apache::Session::Serialize::Storable::serialize;
24 0 $self->{unserialize} = \&Apache::Session::Serialize::Storable::unserialize;
25  
26 0 return $self;
27 }
28  
29 1 1;
30  
31  
32 =pod
33  
34 =head1 NAME
35  
36 Apache::Session::MariaDB - An implementation of Apache::Session using MariaDB
37  
38 =head1 SYNOPSIS
39  
40 use Apache::Session::MariaDB;
41  
42 #if you want Apache::Session to open new DB handles:
43  
44 tie %hash, 'Apache::Session::MariaDB', $id, {
45 DataSource => 'dbi:MariaDB:sessions',
46 UserName => $db_user,
47 Password => $db_pass,
48 LockDataSource => 'dbi:MariaDB:sessions',
49 LockUserName => $db_user,
50 LockPassword => $db_pass
51 };
52  
53 #or, if your handles are already opened:
54  
55 tie %hash, 'Apache::Session::MariaDB', $id, {
56 Handle => $dbh,
57 LockHandle => $dbh
58 };
59  
60 =head1 DESCRIPTION
61  
62 This module is an implementation of Apache::Session. It uses the
63 MariaDB backing store and the MariaDB locking scheme. See the example,
64 and the documentation for Apache::Session::Store::MariaDB and
65 Apache::Session::Lock::MariaDB for more details.
66  
67 It's based on L<Apache::Session::MySQL> but uses L<DBD::MariaDB> instead
68 of L<DBD::mysql>. The initial reason to create this new module is that
69 L<DBD::MariaDB> requires to explicitly indicate C<a_session> column as
70 binary in L<DBI>'s bind_param calls, which is different from L<DBD::mysql>
71 and thus L<Apache::Session::MySQL> doesn't support it.
72  
73 =head1 AUTHOR
74  
75 Best Practical Solutions, LLC E<lt>modules@bestpractical.comE<gt>
76  
77 Jeffrey William Baker E<lt>jwbaker@acm.orgE<gt>
78  
79 Tomas Doran E<lt>bobtfish@bobtfish.net<gt>
80  
81 =head1 LICENSE AND COPYRIGHT
82  
83 Copyright (C) 2024, Best Practical Solutions LLC.
84  
85 This library is free software; you can redistribute it and/or modify it
86 under the same terms as Perl itself.
87  
88 =head1 SEE ALSO
89  
90 L<Apache::Session::MySQL>, L<Apache::Session::File>, L<Apache::Session::Flex>,
91 L<Apache::Session::DB_File>, L<Apache::Session::Postgres>, L<Apache::Session>
« MariaDB/NoLock.pm ↑ Summary Lock/MariaDB.pm »