From fdfac3779e6ba36612c0c5794c6b841646107865 Mon Sep 17 00:00:00 2001 From: Daniel Rios <dr2@sanger.ac.uk> Date: Thu, 23 Feb 2006 15:25:14 +0000 Subject: [PATCH] modified LIMIT to use a function from DBConnection --- .../EnsEMBL/DBSQL/ArchiveStableIdAdaptor.pm | 14 +++++------- .../Bio/EnsEMBL/Utils/ConversionSupport.pm | 22 ++++++++++--------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/ArchiveStableIdAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/ArchiveStableIdAdaptor.pm index 511afd1f84..1b820bcb37 100644 --- a/modules/Bio/EnsEMBL/DBSQL/ArchiveStableIdAdaptor.pm +++ b/modules/Bio/EnsEMBL/DBSQL/ArchiveStableIdAdaptor.pm @@ -556,15 +556,11 @@ sub _lookup_version { if( ! defined $arch_id->{'db_name'} ) { # latest version of this stable id - - $sql = qq( - SELECT new_db_name, new_version - FROM stable_id_event sie, mapping_session m - WHERE sie.mapping_session_id = m.mapping_session_id - AND new_stable_id = "@{[$arch_id->stable_id]}" - $EXTRA_SQL - ORDER BY m.created DESC - LIMIT 1); + my $sql_tmp = "SELECT new_db_name, new_version "; + $sql_tmp .= "FROM stable_id_event sie, mapping_session m "; + $sql_tmp .= "WHERE sie.mapping_session_id = m.mapping_session_id AND new_stable_id = \"@{[$arch_id->stable_id]}\" $EXTRA_SQL "; + $sql_tmp .= "ORDER BY m.created DESC"; + $sql = $self->dbc->add_limit_clause($sql_tmp,1); } else { $sql = qq( SELECT old_db_name, old_version diff --git a/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm b/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm index 7d3faa5823..aa2f69a730 100644 --- a/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm +++ b/modules/Bio/EnsEMBL/Utils/ConversionSupport.pm @@ -874,7 +874,7 @@ sub get_taxonomy_id { Description : Retrieves the species scientific name (Genus species) from the meta table Return type : String - species scientific name - Exceptions : thrown if species name can't be determined from db + Exceptions : thrown if species name can not be determined from db Caller : general =cut @@ -882,15 +882,17 @@ sub get_taxonomy_id { sub get_species_scientific_name { my ($self, $dba) = @_; $dba ||= $self->dba; - my $sql = qq( - SELECT - meta_value - FROM - meta - WHERE meta_key = "species.classification" - ORDER BY meta_id - LIMIT 2 - ); + my $sql_tmp = "SELECT meta_value FROM meta WHERE meta_key = \'species.classification\' ORDER BY meta_id"; + my $sql = $dba->dbc->add_limit_clause($sql_tmp,2); +# my $sql = qq( +# SELECT +# meta_value +# FROM +# meta +# WHERE meta_key = "species.classification" +# ORDER BY meta_id +# LIMIT 2 +# ); my $sth = $dba->dbc->db_handle->prepare($sql); $sth->execute; my @sp; -- GitLab