ADD: more tests
This commit is contained in:
parent
bc4433b429
commit
102139ebe3
@ -29,6 +29,7 @@ sub init {
|
|||||||
$self->createQuery();
|
$self->createQuery();
|
||||||
|
|
||||||
$self->createDSN();
|
$self->createDSN();
|
||||||
|
$self->tryToConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub createDSN
|
sub createDSN
|
||||||
@ -84,6 +85,21 @@ sub createQuery
|
|||||||
$self->log(LOGDEBUG, "created query " . $self->{sqlquery});
|
$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
|
sub prepareParams
|
||||||
{
|
{
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
@ -196,7 +212,7 @@ sub askDatabase
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $dsn = $self->{dsn};
|
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())
|
if ($dbh->err())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user