| 1 | 12 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 12 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | package Rubric::DBI 0.157; | ||
| 4 | # ABSTRACT: Rubric's subclass of Class::DBI | ||
| 5 | |||
| 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 | ▶ | use Rubric::Config; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 12 | ▶ | use Class::DBI 0.96; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 12 | ▶ | use base qw(Class::DBI); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 12 | ▶ | use Class::DBI::AbstractSearch; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | 12 | DBI->trace(Rubric::Config->dbi_trace_level, Rubric::Config->dbi_trace_file); | |
| 20 | |||
| 21 | 12 | my $dsn = Rubric::Config->dsn; | |
| 22 | 12 | my $db_user = Rubric::Config->db_user; | |
| 23 | 12 | my $db_pass = Rubric::Config->db_pass; | |
| 24 | |||
| 25 | 12 | __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 | 0 | ▶ | sub vacuum { |
|
Subroutine
vacuum: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | 0 | 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 | 12 | 1; | |
| 50 | |||
| 51 | __END__ | ||