Commit 48c12a6e authored by Jessica Severin's avatar Jessica Severin
Browse files

added OODB logic to analysis_job.input_id

keep analysis_job.input_id as varchar(255) to allow UNIQUE(analysis_id,input_id)
but in adaptor added logic so that if input_id in AnalysisJob object exceeds
the 255 char limit to store/fetch from the analysis_data table.  The input_id
in the analysis_job table becomes '_ext_input_analysis_data_id ##' which is a unique
internal variable to trigger the fetch routine to know to get the 'real' input_id
from the analysis_data table.
NO MORE 255 char limit on input_id and completely transparent to API user.
parent 4fca79be
......@@ -95,6 +95,11 @@ sub CreateNewJob {
throw("analysis must have adaptor connected to database")
unless($analysis->adaptor and $analysis->adaptor->db);
if(length($input_id) >= 255) {
my $input_data_id = $analysis->adaptor->db->get_AnalysisDataAdaptor->store_if_needed($input_id);
$input_id = "_ext_input_analysis_data_id $input_data_id";
}
my $sql = q{INSERT ignore into analysis_job
(input_id, prev_analysis_job_id,analysis_id,status)
VALUES (?,?,?,?)};
......@@ -331,6 +336,11 @@ sub _objs_from_sth {
$job->completed($column{'completed'});
$job->branch_code($column{'branch_code'});
$job->adaptor($self);
if($column{'input_id'} =~ /_ext_input_analysis_data_id (\d+)/) {
print("input_id was too big so stored in analysis_data table as dbID $1 -- fetching now\n");
$job->input_id($self->db->get_AnalysisDataAdaptor->fetch_by_dbID($1));
}
push @jobs, $job;
}
......
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