[MOBY-guts] biomoby commit

Dennis Wang dwang at pub.open-bio.org
Wed Jul 13 21:55:36 UTC 2005


dwang
Wed Jul 13 17:55:36 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv22080/Perl/MOBY/Adaptor/moby/queryapi

Modified Files:
	mysql.pm 
Log Message:
Implementation of queryapi.pm
Contains all SQL statements used in Moby::authority.pm and Moby::Central.pm.
Changed all query routines to return reference of an array containing hash references, with the exception of general_quer().

moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.11,1.12
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/13 18:33:41	1.11
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/13 21:55:36	1.12
@@ -168,7 +168,7 @@
 # 	statement - a string SQL statement
 #	bind_values - an array of values to be bound to the parameters
 # returns:
-#	resultset - reference to an array containing array references
+#	resultset - reference to an array containing ARRAY references
 sub general_query{
 	my ($self, @args) = @_;	
 	my $dbh = $self->dbh;
@@ -604,12 +604,11 @@
 sub match_service_type_uri{
 	my ($self, @args) = @_;	
 	my $dbh = $self->dbh;
-	
 	my $uri_list = get_value('service_type_uri', @args);
+	my $statement = "select service_instance_id from service_instance where service_type_uri in ($uri_list)";
+	my @bindvalues = ();
 	
-	my $result = $dbh->selectall_arrayref(
-"select service_instance_id from service_instance where service_type_uri in ($uri_list)"
-		  );
+	my $result = do_query($dbh, $statement, @bindvalues);
 	return $result;
 }
 
@@ -672,6 +671,7 @@
  	return $result;
 }
 
+# custom query routine used in Moby::Central.pm -> retrieveServiceProviders()
 sub getUniqueAuthorityURI{
 	my ($self, @args) = @_;
 	my $dbh = $self->dbh;
@@ -693,7 +693,7 @@
 		(get_value('authority_common_name', @args),
 		get_value('authority_uri' @args),
 		get_value('contact_email', @args)));
-	my $id=$dbh->{mysql_insertid};
+	my $id = $dbh->{mysql_insertid};
 	return $id;
 }
 
@@ -1036,11 +1036,10 @@
 		$searchstring =~ s/OR//;    # just the first one
 		$debug && &_LOG("search $searchstring\n");
 
-		my $ids =
-		  $dbh->selectall_arrayref(
-"select service_instance_id from service_instance where $searchstring"
-		  );
-		  
+	my $statement = "select service_instance_id from service_instance where $searchstring";
+	my @bindvalues = ();
+	
+	my $ids = do_query($dbh, $statement, @bindvalues);		  
 	return ($ids, $searchstring);
 }	
 	
@@ -1162,7 +1161,8 @@
 }
 
 # relationship query for any table used in Moby::OntologyServer->_doRelationshipQuery()
-getRelationship{
+# note: returns a reference to an array containing ARRAY references
+sub getRelationship{
 	my ($self, %args) = @_;	
 	my $dbh = $self->dbh;
 	my $defs;




More information about the MOBY-guts mailing list