Rubric::DBI - Rubric's subclass of Class::DBI


Rubric documentation Contained in the Rubric distribution.

Index


Code Index:

NAME

Top

Rubric::DBI - Rubric's subclass of Class::DBI

VERSION

Top

version 0.147

DESCRIPTION

Top

Rubric::DBI subclasses Class::DBI. It sets the connection by using the DSN retrieved from Rubric::Config.

METHODS

Top

vacuum

This method performs periodic maintenance, cleaning up records that are no longer needed.

TODO

Top

AUTHOR

Top

Ricardo SIGNES, <rjbs@cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-rubric@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT

Top


Rubric documentation Contained in the Rubric distribution.
use strict;
use warnings;
package Rubric::DBI;
our $VERSION = '0.147';

use Rubric::Config;
use base qw(Class::DBI);

use Class::DBI::AbstractSearch;

DBI->trace(Rubric::Config->dbi_trace_level, Rubric::Config->dbi_trace_file);

my $dsn = Rubric::Config->dsn;
my $db_user = Rubric::Config->db_user;
my $db_pass = Rubric::Config->db_pass;

__PACKAGE__->connection(
	$dsn,
	$db_user,
	$db_pass,
	{ AutoCommit => 1 }
);

sub vacuum {
	my $self = shift;
	my $dbh = $self->db_Main;
	my $pruned_links = $dbh->do(
		"DELETE FROM links WHERE id NOT IN ( SELECT link FROM entries )"
	);
}

1;