Commit 447682a7 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Be more careful with dbname in get_species_and_object_type()

parent 01821275
......@@ -2463,17 +2463,24 @@ sub get_species_and_object_type {
if ( lc($species) eq 'multi' ) { next }
if ( !defined($dbc) || $dbc->host() ne $dba->dbc()->host() ) {
if ( !defined($dbc)
|| $dbc->host() ne $dba->dbc()->host()
|| $dbc->dbname() ne $dba->dbc()->dbname() )
{
$dbc = $dba->dbc();
}
my $dbh = $dbc->db_handle();
my $dbname = $dbc->dbname();
my $statement = sprintf(
"SELECT meta_value "
. "FROM %s "
. "WHERE meta_key = 'species.stable_id_prefix' "
. "AND species_id = ?",
$dbh->quote_identifier( undef, $dbname, 'meta' )
);
my $statement =
"SELECT meta_value "
. "FROM meta "
. "WHERE meta_key = 'species.stable_id_prefix' "
. "AND species_id = ?";
my $sth = $dbh->prepare($statement);
......@@ -2593,7 +2600,10 @@ SECONDLOOP:
'-species' => $species
) } )
{
if ( !defined($dbc) || $dbc->host() ne $dba->dbc()->host() ) {
if ( !defined($dbc)
|| $dbc->host() ne $dba->dbc()->host()
|| $dbc->dbname() ne $dba->dbc()->dbname() )
{
$dbc = $dba->dbc();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment