--- nfo/perl/libs/Data/Storage/Handler/DBI.pm 2002/12/19 16:31:05 1.11 +++ nfo/perl/libs/Data/Storage/Handler/DBI.pm 2003/01/30 22:28:21 1.12 @@ -1,8 +1,11 @@ ################################# # -# $Id: DBI.pm,v 1.11 2002/12/19 16:31:05 joko Exp $ +# $Id: DBI.pm,v 1.12 2003/01/30 22:28:21 joko Exp $ # # $Log: DBI.pm,v $ +# Revision 1.12 2003/01/30 22:28:21 joko +# + implemented new concrete methods +# # Revision 1.11 2002/12/19 16:31:05 joko # + sub dropDb # + sub rebuildDb @@ -313,4 +316,29 @@ return $res; } +sub testAvailability { + my $self = shift; + my $status = $self->testDsn(); + $self->{locator}->{status}->{available} = $status; + return $status; +} + +sub testDsn { + my $self = shift; + my $dsn = $self->{locator}->{dbi}->{dsn}; + my $result; + if ( my $dbh = DBI->connect($dsn, '', '', { + PrintError => 0, + } ) ) { + + # TODO: REVIEW + $dbh->disconnect(); + + return 1; + } else { + $logger->warning( __PACKAGE__ . "[$self->{locator}->{type}]" . "->testDsn(): " . "DBI-error: " . $DBI::errstr ); + } +} + 1; +__END__