[moby] [MOBY-dev] Perl API: MOBY::Central::DUMP_MySQL()
Mark Wilkinson
markw at illuminae.com
Wed Jul 6 15:09:44 UTC 2005
Hi Pieter,
I didn't realize that the calls were hard-coded! Ugh!
Thanks for catching that error - please do go ahead and fix the code.
We will be committing a major change to the organization of SQL in the
codebase in the next few days, so once you have committed I am going to
tag this version and make a release before the chaos ensues :-)
M
On Wed, 2005-07-06 at 16:50 +0200, Pieter Neerincx wrote:
> Hi all,
>
> This message is for those who use Perl and have local MOBY Centrals.
> I had some problems with the way MOBY::Central::DUMP_MySQL()
> currently works. Getting a DUMP fails for example with the new
> central at:
>
> URL: http://mobycentral.icapture.ubc.ca/cgi-bin/MOBY05/mobycentral.pl
> URI: http://mobycentral.icapture.ubc.ca/MOBY/Central
>
> Currently DUMP_MySQL() has the mysql username, the path to mysqldump
> and the lack of a password, host and portnumber hard coded. Hence it
> ignores whatever you have in your mobycentral.config file. Therefore
> I propose the code below which uses MOBY::Config->new() to get the
> connection details from your mobycentral.config. The path to
> mysqldump is no longer hard coded. Hence if it's not in the path of
> webserver user, I think it's better to modify the path env var as
> compared to hard coding it in the perl modules:) Unless anyone has
> objections against the porposed code I'll merge this with the code in
> the CVS in a few days...
>
> Cheers,
>
> Pieter
>
> --------------------------------------------------
> sub DUMP_MySQL {
> my ( $pkg ) = @_;
> my $config = MOBY::Config->new();
> my @dbsections = ('mobycentral', 'mobyobject',
> 'mobyservice', 'mobynamespace', 'mobyrelationship');
> my @response;
>
> foreach my $dbsection (@dbsections) {
> my $dbname = ${${$config}{$dbsection}}{'dbname'};
> my $username = ${${$config}{$dbsection}}{'username'};
> my $password = ${${$config}{$dbsection}}{'password'};
> my $host = ${${$config}{$dbsection}}{'url'};
> my $port = ${${$config}{$dbsection}}{'port'};
> open( IN, "mysqldump -h $host -P $port -u $username
> --password=$password $dbname|" )
> || die "can't open $dbname for dumping";
> my @dbdump;
> while ( <IN> ) {
> push @dbdump, $_;
> }
> my $dbdump = ( join "", @dbdump );
> push @response, $dbdump;
> }
> return [@response];
> }
> ------------------------------------------------
>
>
>
> Wageningen University and Research centre (WUR)
> Laboratory of Bioinformatics
> Transitorium (building 312) room 1038
> Dreijenlaan 3
> 6703 HA Wageningen
> phone: 0317-484 706
> fax: 0317-483 584
> mobile: 06-143 66 783
> pieter.neerincx at wur.nl
>
>
> _______________________________________________
> MOBY-dev mailing list
> MOBY-dev at biomoby.org
> http://www.biomoby.org/mailman/listinfo/moby-dev
--
Mark Wilkinson
Asst. Professor
Dept. of Medical Genetics
University of British Columbia
PI in Bioinformatics
iCAPTURE Centre
St. Paul's Hospital
Vancouver, BC
More information about the MOBY-dev
mailing list