Skip to content
Snippets Groups Projects
Commit 0701f8ed authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

This (slightly modified) patch from Steve Searle fixes the problem with

having DNA database and analysis database on separate servers:

  In new(), pick the coordinate system internal IDs from a
  CoordSystemAdaptor created from the DNA database (which may be located
  on another database server), then fetch the meta_coord data from the
  adaptor-local database using these.

Passes unit tests.
parent 1fc173e6
No related branches found
No related tags found
No related merge requests found
......@@ -24,24 +24,30 @@ sub new {
# in and cache them.
#
my @coord_systems =
@{ $self->db()->dnadb()->get_CoordSystemAdaptor->fetch_all() };
my @cs_ids;
foreach my $cs (@coord_systems) { push( @cs_ids, $cs->dbID() ) }
my $sth = $self->prepare(
sprintf(
'SELECT mc.table_name, mc.coord_system_id, mc.max_length '
. 'FROM meta_coord mc, %s.coord_system cs '
. 'WHERE mc.coord_system_id = cs.coord_system_id '
. 'AND cs.species_id = ?',
$self->db()->dnadb()->dbc()->dbname() ) );
. 'FROM meta_coord mc '
. 'WHERE mc.coord_system_id in ('
. join( ',', @cs_ids )
. ')' );
$sth->bind_param( 1, $self->species_id(), SQL_INTEGER );
$sth->execute();
while ( my ( $table_name, $cs_id, $max_length ) =
$sth->fetchrow_array() )
{
$self->{'_feature_cache'}->{ lc($table_name) } ||= [];
push @{ $self->{'_feature_cache'}->{ lc($table_name) } }, $cs_id;
$self->{'_max_len_cache'}->{$cs_id}->{ lc($table_name) } =
$max_length;
$table_name = lc($table_name);
$self->{'_feature_cache'}->{$table_name} ||= [];
push( @{ $self->{'_feature_cache'}->{$table_name} }, $cs_id );
$self->{'_max_len_cache'}->{$cs_id}->{$table_name} = $max_length;
}
$sth->finish();
......
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