{
$Test::Chado::DBManager::Postgression::VERSION
=
'v4.1.1'
;
}
sub
_build_dbh {
my
(
$self
) =
@_
;
my
$ua
= HTTP::Tiny->new(
default_headers
=> {
'Accept'
=>
'application/json'
} );
if
(!
$response
->{success}) {
say
"request to postgression failed !!!!"
;
die
"status: $response->{status}\treason: $response->{reason}\n"
;
}
my
$resp_hash
= decode_json
$response
->{content};
my
$dsn
=
"dbi:Pg:dbname=$resp_hash->{dbname};host=$resp_hash->{host};port=$resp_hash->{port}"
;
$self
->dsn(
$dsn
);
$self
->user(
$resp_hash
->{username} );
$self
->password(
$resp_hash
->{password} );
my
$attr
=
$self
->dbi_attributes;
$attr
->{AutoCommit} = 1;
my
$dbh
= DBI->
connect
(
$self
->dsn,
$self
->user,
$self
->password,
$attr
);
$dbh
->
do
(
qq{SET client_min_messages=WARNING}
);
return
$dbh
;
}
1;