From ace7d56373918774f37f300996c25dcbfff3e770 Mon Sep 17 00:00:00 2001
From: Javier Herrero <jherrero@ebi.ac.uk>
Date: Wed, 12 Mar 2008 14:13:05 +0000
Subject: [PATCH] New remove_by_condition_analysis_url method

---
 .../Hive/DBSQL/AnalysisCtrlRuleAdaptor.pm     | 26 +++++++------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisCtrlRuleAdaptor.pm b/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisCtrlRuleAdaptor.pm
index eb684813d..a69cab51a 100755
--- a/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisCtrlRuleAdaptor.pm
+++ b/modules/Bio/EnsEMBL/Hive/DBSQL/AnalysisCtrlRuleAdaptor.pm
@@ -117,28 +117,23 @@ sub store {
 }
 
 
-=head2 remove
+=head2 remove_by_condition_analysis_url
 
-  Arg[1]  : Bio::EnsEMBL::Hive::AnalysisCtrlRule which must be persistent
-            with a valid dbID.
-  Usage   : $self->remove( $rule );
-  Function: removes given object from database.
+  Arg[1]  : string condition_analysis_url
+  Usage   : $self->remove_by_condition_analysis_url("ThisAnalysisLogicName");
+  Function: removes all the control rules for this condition analysis URL
   Returns : -
-  
+
 =cut
 
-sub remove {
-  my ( $self, $rule ) = @_;
+sub remove_by_condition_analysis_url {
+  my ( $self, $condition_analysis_url ) = @_;
 
-  my $dbID = $rule->dbID;
-  if( !defined $dbID ) {
-    throw( "AnalysisCtrlRuleAdaptor->remove called with non persistent AnalysisCtrlRule" );
-  }
-
-  my $sth = $self->prepare("DELETE FROM analysis_ctrl_rule WHERE ctrled_analysis_id = ?, condition_analysis_url = '?'");
-  $sth->execute($rule->ctrled_analysis_id, $rule->condition_analysis_url);
+  my $sth = $self->prepare("DELETE FROM analysis_ctrl_rule WHERE condition_analysis_url =?");
+  $sth->execute($condition_analysis_url);
 }
 
+
 =head2 create_rule
 
   Arg[1]      : condition analysis object (Bio::EnsEMBL::Analysis object)
@@ -284,4 +279,3 @@ sub _generic_fetch {
 
 
 1;
-
-- 
GitLab