Commit 6054ecb0 authored by Leo Gordon's avatar Leo Gordon
Browse files

AnalysisDataAdaptor now inherits from NakedTableAdaptor

parent 2c7f73ae
......@@ -42,62 +42,20 @@ package Bio::EnsEMBL::Hive::DBSQL::AnalysisDataAdaptor;
use strict;
use base ('Bio::EnsEMBL::DBSQL::BaseAdaptor');
use base ('Bio::EnsEMBL::Hive::DBSQL::NakedTableAdaptor');
sub fetch_by_dbID {
my ($self, $data_id) = @_;
my $sql = "SELECT data FROM analysis_data WHERE analysis_data_id = ?";
my $sth = $self->prepare($sql);
$sth->execute($data_id);
my ($data) = $sth->fetchrow_array();
$sth->finish();
return $data;
}
#
# STORE METHODS
#
################
sub store {
my ($self, $data) = @_;
return 0 unless($data);
my $sth = $self->prepare("INSERT INTO analysis_data (data) VALUES (?)");
$sth->execute($data);
my $data_id = $self->dbc->db_handle->last_insert_id(undef, undef, 'analysis_data', 'analysis_data_id');
$sth->finish;
return $data_id;
sub default_table_name {
return 'analysis_data';
}
sub store_if_needed {
my ($self, $data) = @_;
my $data_id;
return 0 unless($data);
my $sth = $self->prepare("SELECT analysis_data_id FROM analysis_data WHERE data = ?");
$sth->execute($data);
($data_id) = $sth->fetchrow_array();
$sth->finish;
my ($self, $data) = @_;
if($data_id) {
# print("data already stored as id $data_id\n");
return $data_id;
}
my ($stored_hash) = $self->store({'data'=> $data}, 1);
return $self->store($data);
return $stored_hash->{'analysis_data_id'};
}
1;
......@@ -355,15 +355,15 @@ sub _objs_from_sth {
while ($sth->fetch()) {
my $input_id = ($column{'input_id'} =~ /^_ext(?:\w+)_data_id (\d+)$/)
? $self->db->get_AnalysisDataAdaptor->fetch_by_dbID($1)
? $self->db->get_AnalysisDataAdaptor->fetch_by_analysis_data_id_TO_data($1)
: $column{'input_id'};
my $param_id_stack = ($column{'param_id_stack'} =~ /^_ext(?:\w+)_data_id (\d+)$/)
? $self->db->get_AnalysisDataAdaptor->fetch_by_dbID($1)
? $self->db->get_AnalysisDataAdaptor->fetch_by_analysis_data_id_TO_data($1)
: $column{'param_id_stack'};
my $accu_id_stack = ($column{'accu_id_stack'} =~ /^_ext(?:\w+)_data_id (\d+)$/)
? $self->db->get_AnalysisDataAdaptor->fetch_by_dbID($1)
? $self->db->get_AnalysisDataAdaptor->fetch_by_analysis_data_id_TO_data($1)
: $column{'accu_id_stack'};
......@@ -815,7 +815,7 @@ sub fetch_input_ids_for_job_ids {
while(my ($job_id, $input_id) = $sth->fetchrow_array() ) {
if($input_id =~ /^_ext(?:\w+)_data_id (\d+)$/) {
$input_id = $self->db->get_AnalysisDataAdaptor->fetch_by_dbID($1);
$input_id = $self->db->get_AnalysisDataAdaptor->fetch_by_analysis_data_id_TO_data($1);
}
$input_ids{$job_id * $id_scale + $id_offset} = $input_id;
}
......
Markdown is supported
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