line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
12
|
|
|
12
|
|
4865
|
use strict; |
|
12
|
|
|
|
|
25
|
|
|
12
|
|
|
|
|
315
|
|
2
|
12
|
|
|
12
|
|
58
|
use warnings; |
|
12
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
1381
|
|
3
|
|
|
|
|
|
|
package Rubric::DBI; |
4
|
|
|
|
|
|
|
# ABSTRACT: Rubric's subclass of Class::DBI |
5
|
|
|
|
|
|
|
$Rubric::DBI::VERSION = '0.156'; |
6
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
7
|
|
|
|
|
|
|
#pod |
8
|
|
|
|
|
|
|
#pod Rubric::DBI subclasses Class::DBI. It sets the connection by using the DSN |
9
|
|
|
|
|
|
|
#pod retrieved from Rubric::Config. |
10
|
|
|
|
|
|
|
#pod |
11
|
|
|
|
|
|
|
#pod =cut |
12
|
|
|
|
|
|
|
|
13
|
12
|
|
|
12
|
|
67
|
use Rubric::Config; |
|
12
|
|
|
|
|
17
|
|
|
12
|
|
|
|
|
72
|
|
14
|
12
|
|
|
12
|
|
15582
|
use Class::DBI 0.96; |
|
12
|
|
|
|
|
692579
|
|
|
12
|
|
|
|
|
117
|
|
15
|
12
|
|
|
12
|
|
535
|
use base qw(Class::DBI); |
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
825
|
|
16
|
|
|
|
|
|
|
|
17
|
12
|
|
|
12
|
|
9045
|
use Class::DBI::AbstractSearch; |
|
12
|
|
|
|
|
317664
|
|
|
12
|
|
|
|
|
1965
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
DBI->trace(Rubric::Config->dbi_trace_level, Rubric::Config->dbi_trace_file); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $dsn = Rubric::Config->dsn; |
22
|
|
|
|
|
|
|
my $db_user = Rubric::Config->db_user; |
23
|
|
|
|
|
|
|
my $db_pass = Rubric::Config->db_pass; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__PACKAGE__->connection( |
26
|
|
|
|
|
|
|
$dsn, |
27
|
|
|
|
|
|
|
$db_user, |
28
|
|
|
|
|
|
|
$db_pass, |
29
|
|
|
|
|
|
|
{ AutoCommit => 1 } |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
#pod =head1 METHODS |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod =head2 vacuum |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod This method performs periodic maintenance, cleaning up records that are no |
37
|
|
|
|
|
|
|
#pod longer needed. |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod =cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub vacuum { |
42
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
43
|
0
|
|
|
|
|
|
my $dbh = $self->db_Main; |
44
|
0
|
|
|
|
|
|
my $pruned_links = $dbh->do( |
45
|
|
|
|
|
|
|
"DELETE FROM links WHERE id NOT IN ( SELECT link FROM entries )" |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |