line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Apache::Session::Browseable::Store::DBI; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17904
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
127
|
|
4
|
3
|
|
|
3
|
|
503
|
use Apache::Session::Store::DBI; |
|
3
|
|
|
|
|
537
|
|
|
3
|
|
|
|
|
1236
|
|
5
|
|
|
|
|
|
|
our @ISA = qw(Apache::Session::Store::DBI); |
6
|
|
|
|
|
|
|
our $VERSION = 1.0; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub insert { |
9
|
29
|
|
|
29
|
0
|
4315
|
my ( $self, $session ) = @_; |
10
|
|
|
|
|
|
|
|
11
|
29
|
|
|
|
|
151
|
$self->connection($session); |
12
|
|
|
|
|
|
|
|
13
|
29
|
|
|
|
|
282
|
local $self->{dbh}->{RaiseError} = 1; |
14
|
|
|
|
|
|
|
|
15
|
29
|
50
|
|
|
|
730
|
my $index = |
16
|
|
|
|
|
|
|
ref( $session->{args}->{Index} ) |
17
|
|
|
|
|
|
|
? $session->{args}->{Index} |
18
|
|
|
|
|
|
|
: [ split /\s+/, $session->{args}->{Index} ]; |
19
|
|
|
|
|
|
|
|
20
|
29
|
50
|
|
|
|
110
|
if ( !defined $self->{insert_sth} ) { |
21
|
56
|
|
|
|
|
100
|
$self->{insert_sth} = |
22
|
|
|
|
|
|
|
$self->{dbh}->prepare_cached( "INSERT INTO $self->{table_name} (" |
23
|
29
|
|
|
|
|
163
|
. join( ',', 'id', 'a_session', map { s/'/''/g; $_ } @$index ) |
|
56
|
|
|
|
|
416
|
|
24
|
|
|
|
|
|
|
. ') VALUES (' |
25
|
|
|
|
|
|
|
. join( ',', ('?') x ( 2 + @$index ) ) |
26
|
|
|
|
|
|
|
. ')' ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
29
|
|
|
|
|
8456
|
$self->{insert_sth}->bind_param( 1, $session->{data}->{_session_id} ); |
30
|
29
|
|
|
|
|
157
|
$self->{insert_sth}->bind_param( 2, $session->{serialized} ); |
31
|
29
|
|
|
|
|
42
|
my $i = 3; |
32
|
29
|
|
|
|
|
71
|
foreach my $f (@$index) { |
33
|
56
|
|
|
|
|
285
|
$self->{insert_sth}->bind_param( $i, $session->{data}->{$f} ); |
34
|
56
|
|
|
|
|
133
|
$i++; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
29
|
|
|
|
|
8367
|
$self->{insert_sth}->execute; |
38
|
|
|
|
|
|
|
|
39
|
29
|
|
|
|
|
524
|
$self->{insert_sth}->finish; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub update { |
43
|
29
|
|
|
29
|
0
|
24476
|
my $self = shift; |
44
|
29
|
|
|
|
|
48
|
my $session = shift; |
45
|
|
|
|
|
|
|
|
46
|
29
|
|
|
|
|
106
|
$self->connection($session); |
47
|
|
|
|
|
|
|
|
48
|
29
|
|
|
|
|
329
|
local $self->{dbh}->{RaiseError} = 1; |
49
|
|
|
|
|
|
|
|
50
|
29
|
50
|
|
|
|
697
|
my $index = |
51
|
|
|
|
|
|
|
ref( $session->{args}->{Index} ) |
52
|
|
|
|
|
|
|
? $session->{args}->{Index} |
53
|
|
|
|
|
|
|
: [ split /\s+/, $session->{args}->{Index} ]; |
54
|
|
|
|
|
|
|
|
55
|
29
|
50
|
|
|
|
149
|
if ( !defined $self->{update_sth} ) { |
56
|
29
|
|
|
|
|
253
|
$self->{update_sth} = |
57
|
|
|
|
|
|
|
$self->{dbh}->prepare_cached( "UPDATE $self->{table_name} SET " |
58
|
|
|
|
|
|
|
. join( ' = ?, ', 'a_session', @$index ) |
59
|
|
|
|
|
|
|
. ' = ? WHERE id = ?' ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
29
|
|
|
|
|
3378
|
$self->{update_sth}->bind_param( 1, $session->{serialized} ); |
63
|
29
|
|
|
|
|
45
|
my $i = 2; |
64
|
29
|
|
|
|
|
74
|
foreach my $f (@$index) { |
65
|
56
|
|
|
|
|
195
|
$self->{update_sth}->bind_param( $i, $session->{data}->{$f} ); |
66
|
56
|
|
|
|
|
88
|
$i++; |
67
|
|
|
|
|
|
|
} |
68
|
29
|
|
|
|
|
146
|
$self->{update_sth}->bind_param( $i, $session->{data}->{_session_id} ); |
69
|
|
|
|
|
|
|
|
70
|
29
|
|
|
|
|
6329
|
$self->{update_sth}->execute; |
71
|
|
|
|
|
|
|
|
72
|
29
|
|
|
|
|
486
|
$self->{update_sth}->finish; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |