From 5fe763e3ba51b0213b19d90c22affe2c9b6a09a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?=
 <ak4@sanger.ac.uk>
Date: Tue, 21 Jul 2009 16:01:36 +0000
Subject: [PATCH] Add $sth->finish() in appropriate places.

---
 modules/Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/modules/Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm
index c0b4b4a380..28bb493ae9 100644
--- a/modules/Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/OntologyTermAdaptor.pm
@@ -242,6 +242,8 @@ WHERE   relation.child_term_id = child_term.term_id
       push( @{ $term->{'children'}{$relation} }, $child_term );
     }
 
+    $sth->finish();
+
     $term->{'child_terms_fetched'} = 1;
   } else {
     foreach my $relation ( values( %{ $term->{'children'} } ) ) {
@@ -319,6 +321,8 @@ ORDER BY closure.distance, child_term.accession);
       ) );
   }
 
+  $sth->finish();
+
   return \@terms;
 } ## end sub fetch_all_by_ancestor_term
 
@@ -388,6 +392,8 @@ WHERE   relation.child_term_id = ?
       push( @{ $term->{'parents'}{$relation} }, $parent_term );
     }
 
+    $sth->finish();
+
     $term->{'parent_terms_fetched'} = 1;
   } else {
     foreach my $relation ( values( %{ $term->{'parents'} } ) ) {
@@ -501,9 +507,13 @@ ORDER BY closure.distance, parent_term.accession);
           '-name'       => $name,
           '-definition' => $definition,
         ) );
+    } else {
+      last;
     }
   }
 
+  $sth->finish();
+
   return \@terms;
 } ## end sub fetch_all_by_descendant_term
 
@@ -579,6 +589,8 @@ ORDER BY closure.distance);
     push( @{ $id_chart{$subparent_id}{$relation} }, $parent_id );
   }
 
+  $sth->finish();
+
   my @terms = @{ $this->fetch_by_dbID_list( [ keys(%id_chart) ] ) };
 
   foreach my $term (@terms) {
@@ -696,6 +708,8 @@ WHERE   ontology.ontology_id = term.ontology_id
       ) );
   }
 
+  $sth->finish();
+
   return \@terms;
 } ## end sub fetch_by_dbID_list
 
-- 
GitLab