From 45cc5b3dc3e676edf454143e5dc9817dab8785e2 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 31 Jan 2004 20:57:48 +0000 Subject: [PATCH] at close vacuum database if using PostgreSQL or SQLite git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@206 13eb9ef6-21d5-0310-b721-a9d68796d827 --- index_DBI_cache.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index_DBI_cache.pm b/index_DBI_cache.pm index 3422069..724cd1f 100644 --- a/index_DBI_cache.pm +++ b/index_DBI_cache.pm @@ -44,6 +44,8 @@ sub new { my $user = shift || die "need dbi_user= in [global] section of configuration file"; my $passwd = shift || die "need dbi_passwd= in [global] section of configuration file"; + $self->{dbd} = $dbd; + $self->{dbh} = DBI->connect("DBI:$dbd:$dsn",$user,$passwd) || die $DBI::errstr; $Count++; @@ -211,6 +213,11 @@ sub close { $self->{dbh}->commit || die $self->{dbh}->errstr(); } + + if ($self->{dbd} =~ m/(Pg|SQLite)/) { + $self->{dbh}->do(qq{vacuum}) || warn "vacumming failed. It shouldn't if you are using PostgreSQL or SQLite: ".$self->{dbh}->errstr(); + } + $self->bench("disconnecting from database"); $self->{dbh}->disconnect; -- 2.20.1