[MOBY-guts] biomoby commit
Mark Wilkinson
mwilkinson at pub.open-bio.org
Mon Jul 25 20:14:35 UTC 2005
mwilkinson
Mon Jul 25 16:14:35 EDT 2005
Update of /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi
In directory pub.open-bio.org:/tmp/cvs-serv21136/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.31,1.32
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/07/25 19:53:36 1.31
+++ /home/repository/moby/moby-live/Perl/MOBY/Adaptor/moby/queryapi/mysql.pm 2005/07/25 20:14:35 1.32
@@ -297,15 +297,14 @@
return $id;
}
+# pass service_instance_lsid
sub delete_simple_input{
- my ($self, @args) = @_;
+ my ($self, %args) = @_;
my $dbh = $self->dbh;
my ($siid) = $self->getSIIDFromLSID($args{service_instance_lsid});
- my $statement = "delete from simple_input ";
- my @bindvalues = ();
- ($statement, @bindvalues) =_add_condition($statement, @args);
- $dbh->do( $statement,
- undef, @bindvalues );
+ my $statement = "delete from simple_input where service_instance_lsid = ?";
+
+ $dbh->do( $statement, undef,($siid));
if ($dbh->err){
return (1, $dbh->errstr);
}
@@ -314,50 +313,71 @@
}
}
+sub delete_inputs { # this should replace all other delete_*_input
+ my ($self, %args) = @_;
+ my $dbh = $self->dbh;
+ my ($siid) = $self->getSIIDFromLSID($args{service_instance_lsid});
+ my $result_ids = $adaptor->query_collection_input(service_instance_lsid => $self->lsid);
+
+ my $statement = "delete from simple_input where service_instance_lsid = ?";
+
+ $dbh->do( $statement, undef,($siid));
+ if ($dbh->err){
+ return (1, $dbh->errstr);
+ }
+ else{
+ return 0;
+ }
+
+}
+
+sub delete_output { # this should replace all other delete_*_output
+
+}
+
+# UGH this has to know too much bout the underlying database structure e.g. that one is null and other is full
+# this problem is in MOBY::Central line 3321 3346 and 3374
+#****** FIX
+# send service_instance_lsid, collection_input_id
sub query_simple_output{
- my ($self, @args) = @_;
- my $dbh = $self->dbh;
-
- my $statement = "select
- simple_output_id,
- object_type_uri,
- namespace_type_uris,
- article_name,
- service_instance_id,
- collection_output_id
- from simple_output ";
- my @bindvalues = ();
-
- if (@args > 0)
- {
- ($statement, @bindvalues) =_add_condition($statement, @args);
- }
-
- my $result = do_query($dbh, $statement, @bindvalues);
- return $result;
+ my ($self, %args) = @_;
+ my ($siid) = $self->getSIIDFromLSID($args{service_instance_lsid});
+ my $collid = $args{collection_input_id};
+ my $dbh = $self->dbh;
+
+ my $statement = "select
+ simple_output_id,
+ object_type_uri,
+ namespace_type_uris,
+ article_name,
+ service_instance_id,
+ collection_output_id
+ from simple_output where service_instance_id = ? and collection_input_id= ?";
+ my $result = do_query($dbh, $statement, ($siid, $collid));
+ return $result;
}
+# pass args service_instance_id and collection_output_id
sub insert_simple_output {
- my ($self, @args) = @_;
- my $dbh = $self->dbh;
- my $si = get_value('collection_output_id', @args)?undef:get_value('service_instance_id', @args);
+ my ($self, %args) = @_;
+ my ($siid) = $self->getSIIDFromLSID($args{service_instance_lsid});
+ my $dbh = $self->dbh;
- $dbh->do("insert into simple_output
- (object_type_uri,
- namespace_type_uris,
- article_name,
- service_instance_id,
- collection_output_id)
- values (?,?,?,?,?)",
- undef,
- (get_value('object_type_uri', @args),
- get_value('namespace_type_uris', @args),
- get_value('article_name', @args),
-# and here
- $si,
- get_value('collection_output_id', @args)));
- my $id=$dbh->{mysql_insertid};
- return $id;
+ $dbh->do("insert into simple_output
+ (object_type_uri,
+ namespace_type_uris,
+ article_name,
+ service_instance_id,
+ collection_output_id)
+ values (?,?,?,?,?)",
+ undef,(
+ $args{'object_type_uri'},
+ $args{'namespace_type_uris'},
+ $args{'article_name'},
+ $siid,
+ $args{'collection_output_id'}));
+ my $id=$dbh->{mysql_insertid};
+ return $id;
}
More information about the MOBY-guts
mailing list