From 540d4106893af5a129cf698b3fdcecbddb40710c Mon Sep 17 00:00:00 2001 From: Ian Longden <ianl@sanger.ac.uk> Date: Thu, 29 Sep 2005 12:52:35 +0000 Subject: [PATCH] moved get_schema_version to base class --- .../Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm | 32 ++++++++++++++++++- modules/Bio/EnsEMBL/DBSQL/MetaContainer.pm | 29 ----------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm b/modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm index c7d91f3784..0897bc3427 100644 --- a/modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm +++ b/modules/Bio/EnsEMBL/DBSQL/BaseMetaContainer.pm @@ -37,12 +37,42 @@ use vars qw(@ISA); use strict; 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); # 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 diff --git a/modules/Bio/EnsEMBL/DBSQL/MetaContainer.pm b/modules/Bio/EnsEMBL/DBSQL/MetaContainer.pm index 2a2017c5d2..690ccf3c6c 100644 --- a/modules/Bio/EnsEMBL/DBSQL/MetaContainer.pm +++ b/modules/Bio/EnsEMBL/DBSQL/MetaContainer.pm @@ -47,35 +47,6 @@ use Bio::Species; # 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 -- GitLab