From c21e3504d0bf60d667a9b4c7a494fe8b0ae63a62 Mon Sep 17 00:00:00 2001 From: Naama Menda Date: Mon, 21 Nov 2011 22:59:46 -0500 Subject: [PATCH] refining add_unigene method --- lib/CXGN/Phenome/Locus.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/CXGN/Phenome/Locus.pm b/lib/CXGN/Phenome/Locus.pm index 5d38327..174efcc 100644 --- a/lib/CXGN/Phenome/Locus.pm +++ b/lib/CXGN/Phenome/Locus.pm @@ -537,15 +537,15 @@ sub add_unigene { return $existing_id; }else { $self->d( "Locus:add_unigene is inserting a new unigene $unigene_id for locus " . $self->get_locus_id() . " (by person $sp_person_id) !!!"); - my $query="Insert INTO phenome.locus_unigene (locus_id, unigene_id,sp_person_id) VALUES (?,?,?)"; + my $query="Insert INTO phenome.locus_unigene (locus_id, unigene_id,sp_person_id) VALUES (?,?,?) RETURNING locus_unigene_id " ; my $sth=$self->get_dbh->prepare($query); $sth->execute($self->get_locus_id(), $unigene_id, $sp_person_id); - my $id= $self->get_currval("phenome.locus_unigene_locus_unigene_id_seq"); + my ($id) = $sth->fetchrow_array; return $id; } - #se if the unigene has solcyc links + #see if the unigene has solcyc links - my $dbh; + my $dbh=$self->get_dbh; my $unigene= CXGN::Transcript::Unigene->new($dbh, $unigene_id); my @u_dbxrefs= $unigene->get_dbxrefs(); foreach my $d(@u_dbxrefs) { -- 2.11.4.GIT