From ca188a21708a43d7daea23016e077fcd312c4c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Thu, 29 Oct 2009 14:30:17 +0000 Subject: [PATCH] Be more straight-forward. --- modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm index f6fc6a180a..c6bd0e2521 100644 --- a/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm @@ -1542,24 +1542,27 @@ sub fetch_all_by_source { sub fetch_all_synonyms { + my ( $self, $dbID ) = @_; - my ($self, $dbID) = @_; + my @synonyms = (); - my @synonyms; + my $sth = + $self->prepare( "SELECT synonym " + . "FROM external_synonym " + . "WHERE xref_id = ?" ); - my $sth = $self->prepare("SELECT synonym FROM external_synonym WHERE xref_id = ?"); + $sth->bind_param( 1, $dbID, SQL_INTEGER ); - $sth->bind_param(1, $dbID, SQL_INTEGER); $sth->execute(); - while ( my $arrayref = $sth->fetchrow_arrayref()){ - my ($synonym) = @$arrayref; - push (@synonyms, $synonym); - } - @synonyms = () if (!@synonyms); + my $synonym; + $sth->bind_col(1, \$synonym); - return \@synonyms; + while ( $sth->fetch() ) { + push( @synonyms, $synonym ); + } + return \@synonyms; } -- GitLab