[MOBY-guts] biomoby commit

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


mwilkinson
Mon Jul 25 17:30:38 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv21742/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.34,1.35
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/25 21:13:51	1.34
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm	2005/07/25 21:30:38	1.35
@@ -519,6 +519,7 @@
 	$statement = $statement.$condition;
 	$dbh->do( $statement,undef, ($term) );
 	
+	$self->_delete_object_term2term(type => $term);
 	if ($dbh->err){
 		return (1, $dbh->errstr);
 	}
@@ -575,15 +576,20 @@
 	return $dbh->{mysql_insertid};
 }
 
-sub delete_object_term2term{
-	my ($self, @args) = @_;	
-	my $dbh = $self->dbh;
+# pass object 'type' as term or lsid
+# this should be a private routine, not a public one.
+# SHOULD NOT BE DOCUMENTED IN THE API
+sub _delete_object_term2term{
+	my ($self, %args) = @_;
+	my $type = $args{type};
+	return 0 unless $type;
+	my $result = $self->query_object(type => $type);
+	my $row = shift @$result;
+	my $id = $row->object_id;
 	
-	my $statement = "delete from object_term2term ";
-	my @bindvalues = ();
-	($statement, @bindvalues) =_add_condition($statement, @args); 
-	$dbh->do( $statement,
-			  undef, @bindvalues );
+	my $dbh = $self->dbh;	
+	my $statement = "delete from object_term2term where object1_id=?";
+	$dbh->do( $statement,undef, ($id));
 	
 	if ($dbh->err){
 		return (1, $dbh->errstr);




More information about the MOBY-guts mailing list