From: martinahansen Date: Mon, 27 Jul 2009 10:47:37 +0000 (+0000) Subject: added list_mysql_databases X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=323cda8d315ee86497c9f3c249493173cc3e65c7;p=biopieces.git added list_mysql_databases git-svn-id: http://biopieces.googlecode.com/svn/trunk@597 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/list_mysql_databases b/bp_bin/list_mysql_databases new file mode 100755 index 0000000..5c34482 --- /dev/null +++ b/bp_bin/list_mysql_databases @@ -0,0 +1,74 @@ +#!/usr/bin/env perl + +# Copyright (C) 2007-2009 Martin A. Hansen. + +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# http://www.gnu.org/copyleft/gpl.html + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +# Display all MySQL databases. + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +use warnings; +use strict; +use Maasha::Common; +use Maasha::Biopieces; +use Maasha::SQL; + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +my ( $options, $user, $password, @databases, $database ); + +$user = $ENV{ "USER" }; +$password = $ENV{ "USER" }; + +$options = Maasha::Biopieces::parse_options( + [ + { long => 'user', short => 'i', type => 'string', mandatory => 'no', default => $user, allowed => undef, disallowed => undef }, + { long => 'password', short => 'n', type => 'string', mandatory => 'no', default => $password, allowed => undef, disallowed => undef }, + ] +); + +@databases = Maasha::SQL::list_databases( $options->{ 'user' }, $options->{ 'password' } ); + +map { Maasha::Biopieces::put_record( { 'DATABASE' => $_ } ) } @databases; + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +BEGIN +{ + Maasha::Biopieces::status_set(); +} + + +END +{ + Maasha::Biopieces::status_log(); +} + + +# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + +__END__ diff --git a/code_perl/Maasha/Biopieces.pm b/code_perl/Maasha/Biopieces.pm index 61dfdf2..20e1083 100644 --- a/code_perl/Maasha/Biopieces.pm +++ b/code_perl/Maasha/Biopieces.pm @@ -413,7 +413,7 @@ sub check_print_usage if ( exists $options->{ 'help' } ) { `print_wiki --data_in=$wiki --help`; - } elsif ( $script =~ /^(list_biopieces|list_genomes|biostat)$/ ) { + } elsif ( $script =~ /^(list_biopieces|list_genomes|list_mysql_databases|biostat)$/ ) { return; } else { `print_wiki --data_in=$wiki`;