Skip to content
Snippets Groups Projects
Commit 540d4106 authored by Ian Longden's avatar Ian Longden
Browse files

moved get_schema_version to base class

parent d316b5ad
No related branches found
No related tags found
No related merge requests found
...@@ -37,12 +37,42 @@ use vars qw(@ISA); ...@@ -37,12 +37,42 @@ use vars qw(@ISA);
use strict; use strict;
use Bio::EnsEMBL::DBSQL::BaseAdaptor; use Bio::EnsEMBL::DBSQL::BaseAdaptor;
use Bio::EnsEMBL::Utils::Exception qw(deprecate); use Bio::EnsEMBL::Utils::Exception qw(deprecate warning);
@ISA = qw(Bio::EnsEMBL::DBSQL::BaseAdaptor); @ISA = qw(Bio::EnsEMBL::DBSQL::BaseAdaptor);
# new() is inherited from Bio::EnsEMBL::DBSQL::BaseAdaptor # new() is inherited from Bio::EnsEMBL::DBSQL::BaseAdaptor
=head2 get_schema_version
Arg [1] : none
Example : $schema_ver = $meta_container->get_schema_version();
Description: Retrieves the schema version from the database meta table
Returntype : int
Exceptions : none
Caller : ?
Status : Medium risk
=cut
sub get_schema_version {
my $self = shift;
my $arrRef = $self->list_value_by_key( 'schema_version' );
if( @$arrRef ) {
my ($ver) = ($arrRef->[0] =~ /^\s*(\d+)\s*$/);
if(!defined($ver)){ # old style format
return 0;
}
return $ver;
} else {
warning("Please insert meta_key 'schema_version' " .
"in meta table at core db.\n");
}
return 0;
}
=head2 list_value_by_key =head2 list_value_by_key
......
...@@ -47,35 +47,6 @@ use Bio::Species; ...@@ -47,35 +47,6 @@ use Bio::Species;
# add well known meta info get-functions below # add well known meta info get-functions below
=head2 get_schema_version
Arg [1] : none
Example : $schema_ver = $meta_container->get_schema_version();
Description: Retrieves the schema version from the database meta table
Returntype : int
Exceptions : none
Caller : ?
Status : Medium risk
=cut
sub get_schema_version {
my $self = shift;
my $arrRef = $self->list_value_by_key( 'schema_version' );
if( @$arrRef ) {
my ($ver) = ($arrRef->[0] =~ /^\s*(\d+)\s*$/);
if(!defined($ver)){ # old style format
return 0;
}
return $ver;
} else {
$self->warn("Please insert meta_key 'schema_version' " .
"in meta table at core db.\n");
}
return 0;
}
=head2 get_Species =head2 get_Species
......
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