[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Fri Jun 27 02:52:03 UTC 2003
mwilkinson
Thu Jun 26 22:52:03 EDT 2003
Update of /home/repository/moby/moby-live/Perl/MOBY
In directory pub.open-bio.org:/tmp/cvs-serv21369/Perl/MOBY
Modified Files:
Central.pm
Log Message:
there was a flaw in the SQL that tested for the use of a namespace prior to deleting it. I think this will fix it. The database structure is pretty stupid in this regard, but I'm too preoccupied to change it right now.
moby-live/Perl/MOBY Central.pm,1.84,1.85
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Central.pm,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/06/27 02:27:13 1.84
+++ /home/repository/moby/moby-live/Perl/MOBY/Central.pm 2003/06/27 02:52:03 1.85
@@ -764,17 +764,43 @@
return &_error("Namespace Type $term does not exist","") unless ($existingURI);
my $dbh = MOBY::central_db_connection->new->dbh;
- my ($id) = $dbh->selectrow_array("select service_instance.service_instance_id from service_instance natural join simple_input where namespace_type_uris like '%$existingURI%'");
- return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($id);
-
- ($id) = $dbh->selectrow_array("select service_instance.service_instance_id from service_instance natural join simple_output where namespace_type_uris like '%$existingURI%'");
- return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($id);
-
- ($id) = $dbh->selectrow_array("select service_instance.service_instance_id from service_instance natural join collection_input natural join simple_input where namespace_type_uris like '%$existingURI%'");
- return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($id);
+ my $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_input where namespace_type_uris like '%$existingURI%'");
+ $sth->execute;
+ while (my ($id, $ns) = $sth->fetchrow_array()){
+ my @nss = split ",", $ns;
+ foreach (@nss){
+ $_=~s/\s//g;
+ return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($_ eq $existingURI);
+ }
+ }
- ($id) = $dbh->selectrow_array("select service_instance.service_instance_id from service_instance natural join collection_output natural join simple_output where namespace_type_uris like '%$existingURI%'");
- return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($id);
+ $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join simple_output where namespace_type_uris like '%$existingURI%'");
+ $sth->execute;
+ while (my ($id, $ns) = $sth->fetchrow_array()){
+ my @nss = split ",", $ns;
+ foreach (@nss){
+ $_=~s/\s//g;
+ return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($_ eq $existingURI);
+ }
+ }
+ $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_input where namespace_type_uris like '%$existingURI%'");
+ $sth->execute;
+ while (my ($id, $ns) = $sth->fetchrow_array()){
+ my @nss = split ",", $ns;
+ foreach (@nss){
+ $_=~s/\s//g;
+ return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($_ eq $existingURI);
+ }
+ }
+ $sth = $dbh->prepare("select service_instance.service_instance_id, namespace_type_uris from service_instance natural join collection_output where namespace_type_uris like '%$existingURI%'");
+ $sth->execute;
+ while (my ($id, $ns) = $sth->fetchrow_array()){
+ my @nss = split ",", $ns;
+ foreach (@nss){
+ $_=~s/\s//g;
+ return &_error("Namespace Type $term is used by a service and may not be deregistered","") if ($_ eq $existingURI);
+ }
+ }
my ($success2, $message2, $URI) = $OntologyServer->deleteNamespace(
term => $term);
More information about the MOBY-guts
mailing list