MetaContainer.pm 1.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
=pod

=head1 NAME

  Bio::EnsEMBL::Hive::DBSQL::MetaContainer

=head1 SYNOPSIS

  $meta_container = $db_adaptor->get_MetaContainer;

=head1 DESCRIPTION

13
  This module extends EnsEMBL Core's BaseMetaContainer, adding some Hive-specific stuff.
14 15 16 17 18 19 20 21 22 23 24

=head1 CONTACT

  Please contact ehive-users@ebi.ac.uk mailing list with questions/suggestions.

=cut


package Bio::EnsEMBL::Hive::DBSQL::MetaContainer;

use strict;
25
use Bio::EnsEMBL::Hive::Utils ('destringify');
26

27
use base ('Bio::EnsEMBL::DBSQL::BaseMetaContainer');
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

=head2 get_param_hash

    Description: returns the content of the 'meta' table as a hash

=cut

sub get_param_hash {
    my $self = shift @_;

    my %meta_params_hash = ();

        # Here we are assuming that meta_keys are unique.
        # If they are not, you'll be getting the value with the highest meta_id.
        #
    my $sth = $self->prepare("SELECT meta_key, meta_value FROM meta ORDER BY meta_id");
    $sth->execute();
    while (my ($meta_key, $meta_value)=$sth->fetchrow_array()) {

        $meta_params_hash{$meta_key} = destringify($meta_value);
    }
    $sth->finish();

    return \%meta_params_hash;
}

1;