ensembl-hive  2.8.1
NakedTableAdaptor.pm
Go to the documentation of this file.
1 =pod
2 
3 =head1 NAME
4 
6 
7 =head1 SYNOPSIS
8 
9  my $intermediate_result_nt_adaptor = $dba->get_NakedTableAdaptor( 'table_name' => 'intermediate_result' );
10  my $final_result_nt_adaptor = $final_result_nt->adaptor;
11 
12 =head1 DESCRIPTION
13 
14  This module together with its data container are used to enable dataflow into arbitrary tables (rather than just 'job' table).
15  Due to the implementation of EnsEMBL Registry code, NakedTable objects know *where* to dataflow, and NakedTableAdaptor knows *how* to dataflow.
16 
17 =head1 LICENSE
18 
19  See the NOTICE file distributed with this work for additional information
20  regarding copyright ownership.
21 
22  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
23  You may obtain a copy of the License at
24 
25  http://www.apache.org/licenses/LICENSE-2.0
26 
27  Unless required by applicable law or agreed to in writing, software distributed under the License
28  is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29  See the License for the specific language governing permissions and limitations under the License.
30 
31 =head1 CONTACT
32 
33  Please subscribe to the Hive mailing list: http://listserver.ebi.ac.uk/mailman/listinfo/ehive-users to discuss Hive-related questions or to be notified of our updates
34 
35 =cut
36 
37 
38 package Bio::EnsEMBL::Hive::DBSQL::NakedTableAdaptor;
39 
40 use strict;
41 use warnings;
42 
43 use base ('Bio::EnsEMBL::Hive::DBSQL::BaseAdaptor');
44 
45 
46 sub slicer { # take a slice of the hashref (if only we could inline in Perl!)
47  my ($self, $hashref, $fields) = @_;
48 
49  return [ @$hashref{@$fields} ];
50 }
51 
52 
53 sub objectify { # pretend the hashref becomes an object (if only we could inline in Perl!)
54  return pop @_;
55 }
56 
57 
58 sub mark_stored {
59  my ($self, $hashref, $dbID) = @_;
60 
61  if(my $autoinc_id = $self->autoinc_id()) {
62  $hashref->{$autoinc_id} = $dbID;
63  }
64 }
65 
66 
67 sub keys_to_columns {
68  my ($self, $hashref) = @_;
69 
70  my $sorted_keys = [ sort keys %$hashref ];
71 
72  return ( $sorted_keys, join(', ', @$sorted_keys) );
73 }
74 
75 1;
76 
EnsEMBL
Definition: Filter.pm:1
Bio::EnsEMBL::Hive::DBSQL::NakedTableAdaptor
Definition: NakedTableAdaptor.pm:18