ADD: more tests

This commit is contained in:
Dominik Meyer 2024-01-02 23:36:02 +01:00
parent bc4433b429
commit 102139ebe3
Signed by: byterazor
GPG Key ID: EABDA0FD5981BC97

View File

@ -29,6 +29,7 @@ sub init {
$self->createQuery();
$self->createDSN();
$self->tryToConnect();
}
sub createDSN
@ -84,6 +85,21 @@ sub createQuery
$self->log(LOGDEBUG, "created query " . $self->{sqlquery});
}
sub tryToConnect
{
my $self = shift;
my $dbh = DBI::connect($self->{dsn}, $self->{user}, $self->{pass});
if ($dbh->err())
{
$self->log(LOGERROR, "error connecting to DB: " . $dbh->errstr());
return DECLINED;
}
$dbh->disconnect;
}
sub prepareParams
{
my $self = shift;
@ -196,7 +212,7 @@ sub askDatabase
}
my $dsn = $self->{dsn};
my $dbh = DBI::connect($dsn, $self->{user}, $self->{pass},{ RaiseError => 1, PrintError => 0 });
my $dbh = DBI::connect($dsn, $self->{user}, $self->{pass});
if ($dbh->err())
{