line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#############################################################################
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# Apache::Session::Browseable::SQLite
|
4
|
|
|
|
|
|
|
# Apache persistent user sessions in a SQLite database
|
5
|
|
|
|
|
|
|
# Copyright(c) 2013 Xavier Guimard
|
6
|
|
|
|
|
|
|
# Inspired by Apache::Session::Postgres
|
7
|
|
|
|
|
|
|
# (copyright(c) 1998, 1999, 2000 Jeffrey William Baker (jwbaker@acm.org))
|
8
|
|
|
|
|
|
|
# Distribute under the Perl License
|
9
|
|
|
|
|
|
|
#
|
10
|
|
|
|
|
|
|
############################################################################
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Apache::Session::Browseable::SQLite;
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
538184
|
use strict;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
105
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
1080
|
use Apache::Session;
|
|
2
|
|
|
|
|
2832
|
|
|
2
|
|
|
|
|
54
|
|
17
|
2
|
|
|
2
|
|
864
|
use Apache::Session::Lock::Null;
|
|
2
|
|
|
|
|
366
|
|
|
2
|
|
|
|
|
59
|
|
18
|
2
|
|
|
2
|
|
919
|
use Apache::Session::Browseable::Store::SQLite;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
64
|
|
19
|
2
|
|
|
2
|
|
1003
|
use Apache::Session::Generate::MD5;
|
|
2
|
|
|
|
|
630
|
|
|
2
|
|
|
|
|
61
|
|
20
|
2
|
|
|
2
|
|
938
|
use Apache::Session::Serialize::Base64;
|
|
2
|
|
|
|
|
10051
|
|
|
2
|
|
|
|
|
58
|
|
21
|
2
|
|
|
2
|
|
991
|
use Apache::Session::Browseable::DBI;
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
325
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '1.0';
|
24
|
|
|
|
|
|
|
our @ISA = qw(Apache::Session::Browseable::DBI Apache::Session);
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub populate {
|
27
|
177
|
|
|
177
|
0
|
2758
|
my $self = shift;
|
28
|
|
|
|
|
|
|
|
29
|
177
|
|
|
|
|
612
|
$self->{object_store} =
|
30
|
|
|
|
|
|
|
new Apache::Session::Browseable::Store::SQLite $self;
|
31
|
177
|
|
|
|
|
1632
|
$self->{lock_manager} = new Apache::Session::Lock::Null $self;
|
32
|
177
|
|
|
|
|
944
|
$self->{generate} = \&Apache::Session::Generate::MD5::generate;
|
33
|
177
|
|
|
|
|
294
|
$self->{validate} = \&Apache::Session::Generate::MD5::validate;
|
34
|
177
|
|
|
|
|
289
|
$self->{serialize} = \&Apache::Session::Serialize::Base64::serialize;
|
35
|
177
|
|
|
|
|
232
|
$self->{unserialize} = \&Apache::Session::Serialize::Base64::unserialize;
|
36
|
|
|
|
|
|
|
|
37
|
177
|
|
|
|
|
978
|
return $self;
|
38
|
|
|
|
|
|
|
}
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1;
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Apache::Session::Browseable::SQLite - An implementation of Apache::Session
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use Apache::Session::Browseable::SQLite;
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#if you want Apache::Session to open new DB handles:
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
tie %hash, 'Apache::Session::Browseable::SQLite', $id, {
|
55
|
|
|
|
|
|
|
DataSource => 'dbi:Pg:dbname=sessions',
|
56
|
|
|
|
|
|
|
UserName => $db_user,
|
57
|
|
|
|
|
|
|
Password => $db_pass,
|
58
|
|
|
|
|
|
|
Commit => 1
|
59
|
|
|
|
|
|
|
};
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
#or, if your handles are already opened:
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
tie %hash, 'Apache::Session::Browseable::SQLite', $id, {
|
64
|
|
|
|
|
|
|
Handle => $dbh,
|
65
|
|
|
|
|
|
|
Commit => 1
|
66
|
|
|
|
|
|
|
};
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L function are also available
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This module is an implementation of Apache::Session. It uses the SQLite
|
73
|
|
|
|
|
|
|
backing store and no locking. See the example, and the documentation for
|
74
|
|
|
|
|
|
|
Apache::Session::Browseable::Store::SQLite for more details.
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 USAGE
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The special Apache::Session argument for this module is Commit. You MUST
|
79
|
|
|
|
|
|
|
provide the Commit argument, which instructs this module to either commit
|
80
|
|
|
|
|
|
|
the transaction when it is finished, or to simply do nothing. This feature
|
81
|
|
|
|
|
|
|
is provided so that this module will not have adverse interactions with your
|
82
|
|
|
|
|
|
|
local transaction policy, nor your local database handle caching policy. The
|
83
|
|
|
|
|
|
|
argument is mandatory in order to make you think about this problem.
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 AUTHOR
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This module was written by Xavier Guimard using
|
88
|
|
|
|
|
|
|
Apache::Session::Postgres from Jeffrey William Baker as example.
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 SEE ALSO
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L
|