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-2017 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
|
|
145241
|
use strict; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
116
|
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
1827
|
use Apache::Session; |
|
2
|
|
|
|
|
5932
|
|
|
2
|
|
|
|
|
107
|
|
17
|
2
|
|
|
2
|
|
1347
|
use Apache::Session::Lock::Null; |
|
2
|
|
|
|
|
561
|
|
|
2
|
|
|
|
|
87
|
|
18
|
2
|
|
|
2
|
|
1519
|
use Apache::Session::Browseable::Store::SQLite; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
105
|
|
19
|
2
|
|
|
2
|
|
1070
|
use Apache::Session::Generate::SHA256; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
69
|
|
20
|
2
|
|
|
2
|
|
1012
|
use Apache::Session::Serialize::JSON; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
448
|
|
21
|
2
|
|
|
2
|
|
939
|
use Apache::Session::Browseable::DBI; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
307
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '1.2.2'; |
24
|
|
|
|
|
|
|
our @ISA = qw(Apache::Session::Browseable::DBI Apache::Session); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub populate { |
27
|
177
|
|
|
177
|
0
|
2679
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$self->{object_store} = |
30
|
177
|
|
|
|
|
714
|
new Apache::Session::Browseable::Store::SQLite $self; |
31
|
177
|
|
|
|
|
1692
|
$self->{lock_manager} = new Apache::Session::Lock::Null $self; |
32
|
177
|
|
|
|
|
1129
|
$self->{generate} = \&Apache::Session::Generate::SHA256::generate; |
33
|
177
|
|
|
|
|
405
|
$self->{validate} = \&Apache::Session::Generate::SHA256::validate; |
34
|
177
|
|
|
|
|
351
|
$self->{serialize} = \&Apache::Session::Serialize::JSON::serialize; |
35
|
177
|
|
|
|
|
355
|
$self->{unserialize} = \&Apache::Session::Serialize::JSON::unserialize; |
36
|
|
|
|
|
|
|
|
37
|
177
|
|
|
|
|
1178
|
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 |