9 $dataDBA = $db_adaptor->get_AnalysisDataAdaptor;
13 analysis_data table holds LONGTEXT data that is currently used as an extension of some fixed-width fields of
'job' table.
14 It is no longer general-purpose. Please avoid accessing
this table directly or via the adaptor.
18 See the NOTICE file distributed with
this work
for additional information
19 regarding copyright ownership.
21 Licensed under the Apache License, Version 2.0 (the
"License"); you may not use
this file except in compliance with the License.
22 You may obtain a copy of the License at
26 Unless required by applicable law or agreed to in writing, software distributed under the License
27 is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 See the License
for the specific language governing permissions and limitations under the License.
32 Please subscribe to the Hive mailing list: http:
36 The rest of the documentation details each of the
object methods.
37 Internal methods are preceded with a _
42 package Bio::EnsEMBL::Hive::DBSQL::AnalysisDataAdaptor;
47 use Digest::MD5 qw(md5_hex);
49 use base (
'Bio::EnsEMBL::Hive::DBSQL::NakedTableAdaptor');
52 sub default_table_name {
53 return 'analysis_data';
56 =head2 fetch_by_data_to_analysis_data_id
58 Arg [1] : String $input_id
59 Example : $ext_data_id = $analysis_data_adaptor->fetch_by_data_to_analysis_data_id( $input_id );
60 Description: Attempts to find an entry in the analysis_data table by its content (data + MD5 checksum)
61 Returntype : Integer (dbID of the analysis_data table)
65 sub fetch_by_data_to_analysis_data_id { # It is a special
case not covered by AUTOLOAD; note the lowercase _to_
66 my ($self, $input_id) = @_;
68 my $md5sum = md5_hex($input_id);
69 return $self->fetch_by_data_AND_md5sum_TO_analysis_data_id($input_id, $md5sum);
74 my ($self, $data) = @_;
76 my $storable_hash = {
'data' => $data,
'md5sum' => md5_hex($data)};
78 $self->store( $storable_hash );
80 # We now need to check for collisions ourselves since there is no
81 # UNIQUE KEY in the table definition.
82 # This is very similar to check_object_present_in_db_by_content()
83 # but it returns the *first* analysis_data_id that's been stored
84 my $sql =
'SELECT MIN(analysis_data_id) FROM analysis_data WHERE md5sum = ? AND data = ?';
85 my $sth = $self->prepare( $sql );
86 $sth->execute( $storable_hash->{md5sum}, $data );
87 my ($first_dbID) = $sth->fetchrow_array();
89 if ($first_dbID != $storable_hash->{analysis_data_id}) {
90 # Our row duplicates a previous one, so we need to clean up
91 $self->remove($storable_hash);
93 return '_extended_data_id ' . $first_dbID;