[MOBY-guts] biomoby commit

Mark Wilkinson mwilkinson at pub.open-bio.org
Wed Jul 27 14:06:15 UTC 2005


mwilkinson
Wed Jul 27 10:06:15 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv28503/MOBY/Adaptor/moby/queryapi

Modified Files:
	mysql.pm 
Log Message:
interesting architectural SNAFU. The adaptor is designed to know about one data-source at a time (mobycentral, mobyobject, mobynamespace, mobyservice).  However, certain functions need to cross-reference these different data sources.  Thus I need to create a new instance of the adaptor in the adaptor itself to support this.  Ugly... not illegal... but ugly.  I'll fix this one day.

moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.43,1.44
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/27 00:00:45	1.43
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/27 14:06:15	1.44
@@ -55,6 +55,13 @@
 
 }
 
+sub _getDBHandle {
+    my ($ontology) = @_;
+    my $CONF = MOBY::Config->new;
+    $CONF->getDataAdaptor(source => $ontology);
+    return $CONF->dbh;
+}
+
 sub new {
 	my ($caller, %args) = @_;
 	my $self = $caller->SUPER::new(%args);
@@ -476,7 +483,7 @@
           contact_email
           from object $condition";
 
-	my $dbh = $self->dbh;
+	my $dbh = _getDBHandle("mobyobject");
 	my $result;
 	if ($type){
 	    $result = do_query($dbh, $statement, ($type));
@@ -807,8 +814,9 @@
 	} elsif ($type) {
 	    $condition = "where service_type = ?";
 	}
+	
+	my $dbh = _getDBHandle("mobyservice");
 
-	my $dbh = $self->dbh;
 	my $statement = "select
 	  service_id, 
           service_lsid,
@@ -963,7 +971,7 @@
 	} elsif ($type) {
 	    $condition = " where namespace_type = ?";
 	}
-	my $dbh = $self->dbh;
+	my $dbh = _getDBHandle("mobynamespace");
 	
 	my $statement = "select
           namespace_id,




More information about the MOBY-guts mailing list