[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Mon Jul 25 21:52:25 UTC 2005


mwilkinson
Mon Jul 25 17:52:25 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv21863/MOBY/Adaptor/moby/queryapi

Modified Files:
	mysql.pm 
Log Message:
more of the same.  Pass hashes instead of hashrefs, and avoid passing database ids

moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.35,1.36
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/25 21:30:38	1.35
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/25 21:52:25	1.36
@@ -599,19 +599,20 @@
 	}
 }
 
+# pass servicename and authority_uri
 sub query_service_existence {
 	my ($self, %args) = @_;	
 	my $dbh = $self->dbh;
 
 	my $servicename = $args{'servicename'};
 	my $authURI = $args{'authority_uri'};
-	my $id = $args{'authority_id'};
-	unless ($id){
+#	my $id = $args{'authority_id'};  # is it safe to remove this?  better be!
+#	unless ($id){
 	    my $result = $self->query_authority({authority_uri => $authURI});
 	    return 0 unless @$result[0];
-	    $id = @$result[0]->{authority_id};
+	    my $id = @$result[0]->{authority_id};
 	    return 0 unless $id;
-	}
+#	}
 	my $statement = "select
           service_instance_id,
           category,
@@ -624,10 +625,8 @@
           description,
 		  signatureURL,
 		  lsid 
-          from service_instance ";
-        my @bindvalues;
- 	($statement, @bindvalues) =_add_condition($statement, ({servicename => $servicename},"and",{authority_id=>$id}));
- 	my $final = do_query($dbh, $statement, @bindvalues);
+          from service_instance where servicename = ? and authority_id = ?";
+ 	my $final = do_query($dbh, $statement, ($servicename, $id));
  	if (@$final[0]){return 1} else {return 0}
 	
 }
@@ -676,33 +675,38 @@
 }
 
 # custom query for Moby::Central.pm->findService()
+# hmmmmmmm....  I'm not sure that this routine should exist...
+# it is redundant to the routine above, if the routine above were executed
+# multiple times.  I think that is the more correct (though less efficient)
+# way to go, since it is "scalable" to every possible underlying data source
+# ********FIX  change this later...
 sub match_service_type_uri{
-	my ($self, @args) = @_;	
+	my ($self, %args) = @_;	
 	my $dbh = $self->dbh;
-	my $uri_list = get_value('service_type_uri', @args);
+	my $uri_list = $args{'service_type_uri'};
 	my $statement = "select service_instance_id,category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid from service_instance where service_type_uri in ($uri_list)";
-	my @bindvalues = ();
-	
+	my @bindvalues = ();	
 	my $result = do_query($dbh, $statement, @bindvalues);
 	return $result;
 }
 
+# passs........  blah blah..... 
 sub insert_service_instance {
-	my ($self, @args) = @_;	
+	my ($self, %args) = @_;	
 	my $dbh = $self->dbh;
 
 	$dbh->do(q{insert into service_instance (category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid) values (?,?,?,?,?,?,?,?,?,?)},
 				 undef,(
-				 get_value('category', @args),
-				 get_value('servicename', @args),
-				 get_value('service_type_uri', @args),
-				 get_value('authority_id', @args),
-				 get_value('url', @args),
-				 get_value('contact_email', @args),
-				 get_value('authoritative', @args),
-				 get_value('description', @args),
-				 get_value('signatureURL', @args),
-				 get_value('lsid', @args)));
+				 $args{'category'},
+				 $args{'servicename'},
+				 $args{'service_type_uri'},
+				 $args{'authority_id'},
+				 $args{'url'},
+				 $args{'contact_email'},
+				 $args{'authoritative'},
+				 $args{'description'},
+				 $args{'signatureURL'},
+				 $args{'lsid'}));
 	
 	my $id = $dbh->{mysql_insertid};
 	return $id;




More information about the MOBY-guts mailing list