[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Thu Jul 21 16:37:35 UTC 2005
mwilkinson
Thu Jul 21 12:37:35 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv29120/MOBY/Adaptor/moby/queryapi
Modified Files:
mysql.pm
Log Message:
updating the service discovery code to be in-line with the new adaptor API
moby-live/Perl/MOBY/Adaptor/moby/queryapi mysql.pm,1.20,1.21
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/07/20 22:34:48 1.20
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/07/21 16:37:35 1.21
@@ -589,9 +589,7 @@
}
}
-# selects all the columns from service_instance table
-# where is lsid?
-sub query_service_instance {
+sub query_service_existence {
my ($self, %args) = @_;
my $dbh = $self->dbh;
@@ -600,9 +598,9 @@
my $id = $args{'authority_id'};
unless ($id){
my $result = $self->query_authority({authority_uri => $authURI});
- return [{}] unless @$result[0];
+ return 0 unless @$result[0];
my $id = @$result[0]->{authority_id};
- return [{}] unless $id;
+ return 0 unless $id;
}
my $statement = "select
service_instance_id,
@@ -620,6 +618,32 @@
my @bindvalues;
($statement, @bindvalues) = add_condition($statement, ({servicename => $servicename},"and",{authority_id=>$id}));
my $final = do_query($dbh, $statement, @bindvalues);
+ if (@$final[0]){return 1} else {return 0}
+
+}
+# selects all the columns from service_instance table
+# where is lsid?
+
+sub query_service_instance {
+ my ($self, @args) = @_;
+ my $dbh = $self->dbh;
+
+ my $statement = "select
+ service_instance_id,
+ category,
+ servicename,
+ service_type_uri,
+ authority_id,
+ url,
+ contact_email,
+ authoritative,
+ description,
+ signatureURL,
+ lsid
+ from service_instance ";
+ my @bindvalues;
+ ($statement, @bindvalues) = add_condition($statement, @args);
+ my $final = do_query($dbh, $statement, @bindvalues);
return $final;
}
@@ -628,7 +652,7 @@
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 $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 $result = do_query($dbh, $statement, @bindvalues);
@@ -1055,10 +1079,10 @@
$kw = $dbh->quote("%$kw%");
$searchstring .= " OR description like $kw ";
}
- $searchstring =~ s/OR//; # just the first one
+ $searchstring =~ s/OR//; # remove just the first OR in the longer statement
# $debug && &_LOG("search $searchstring\n");
- my $statement = "select service_instance_id from service_instance where $searchstring";
+ my $statement = "select service_instance_id,category, servicename, service_type_uri, authority_id, url, contact_email, authoritative, description, signatureURL, lsid from service_instance where $searchstring";
my @bindvalues = ();
my $ids = do_query($dbh, $statement, @bindvalues);
@@ -1087,7 +1111,7 @@
}
my $result = do_query($dbh, $query, ());
- return ($query, $result);
+ return $result;
}
# custom query subroutine for Moby::Central.pm->_searchForCollection()
@@ -1119,7 +1143,7 @@
}
my $result = do_query($dbh, $query, ());
- return ($query, $result);
+ return $result;
}
# custom query subroutine for Moby::Central.pm->RetrieveServiceNames
More information about the MOBY-guts
mailing list