Skip to content
Snippets Groups Projects
Commit c71e359f authored by Will Spooner's avatar Will Spooner
Browse files

Fixed SQL error in HSP update

parent 68007cc7
No related branches found
No related tags found
No related merge requests found
......@@ -157,6 +157,7 @@ VALUES ( ? , ? , ? , ? , ? )";
our $SQL_HSP_UPDATE = "
UPDATE blast_hsp%s
SET object = ?,
ticket = ?,
chr_name = ?,
chr_start = ?,
chr_end = ?
......@@ -463,13 +464,7 @@ sub store_hsp{
$rv = $sth->execute( $id ) || $self->throw( $sth->errstr );
$sth->finish;
}
if( $rv > 0 ){ # Update
my $sth = $dbh->prepare( sprintf $SQL_HSP_UPDATE, $use_date );
my @bound = ( $frozen, $ticket, $chr_name, $chr_start, $chr_end, $id );
$sth->execute( @bound ) || $self->throw( $sth->errstr );
$sth->finish;
}
else{ # Insert
if( $rv < 1 ){ # Insert
my $use_date = $self->use_date('HSP') || '';
my $sth = $dbh->prepare( sprintf $SQL_HSP_STORE, $use_date );
my @bound = ( $frozen, $ticket, $chr_name, $chr_start, $chr_end );
......@@ -478,6 +473,12 @@ sub store_hsp{
$hsp->token( join( '!!', $id, $use_date ) );
$sth->finish;
}
else{ # Update
my $sth = $dbh->prepare( sprintf $SQL_HSP_UPDATE, $use_date );
my @bound = ( $frozen, $ticket, $chr_name, $chr_start, $chr_end, $id );
$sth->execute( @bound ) || $self->throw( $sth->errstr );
$sth->finish;
}
return $hsp->token();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment