From: <rv...@us...> - 2009-06-12 02:00:43
|
Revision: 45 http://treebase.svn.sourceforge.net/treebase/?rev=45&view=rev Author: rvos Date: 2009-06-12 01:37:07 +0000 (Fri, 12 Jun 2009) Log Message: ----------- Added --zip flag to sqldump Modified Paths: -------------- trunk/treebase-core/src/main/perl/dump/sqldump Modified: trunk/treebase-core/src/main/perl/dump/sqldump =================================================================== --- trunk/treebase-core/src/main/perl/dump/sqldump 2009-06-12 01:13:12 UTC (rev 44) +++ trunk/treebase-core/src/main/perl/dump/sqldump 2009-06-12 01:37:07 UTC (rev 45) @@ -13,6 +13,7 @@ my $with_creates = 0; # write create statements my $name_file_after_table = 0; # name output file after table my $schema = 'TBASE2'; # name of schema to analyze +my $zip = 0; # zip output # get command line options, see Getopt::Long GetOptions( @@ -24,6 +25,7 @@ 'pass=s' => \$ENV{'TREEBASE_DB_PASS'}, 'dsn=s' => \$ENV{'TREEBASE_DB_DSN'}, 'table=s' => \@tables, + 'zip' => \$zip, 'all' => sub { @tables = get_all_tables() }, 'help|?' => sub { pod2usage( '-verbose' => 0 ) }, # see Pod::Usage 'man' => sub { pod2usage( '-verbose' => 1 ) }, # see Pod::Usage @@ -73,12 +75,18 @@ ) or die "Couldn't instantiate CIPRES::TreeBase::RecDumper"; # give dumper the output handle to write to, i.e. either STDOUT, - # or a file specified on the command line, or the table name + # or a file specified on the command line, or the table name... if ( $name_file_after_table ) { close $outhandle; open my $fh, '>', "${table}.sql" or die $!; $outhandle = $fh; } + # ...or a compressed file + elsif ( $zip ) { + close $outhandle; + open my $ziph, "| gzip -9 > ${table}.gz" or die $!; + $outhandle = $ziph; + } $dumper->set_output($outhandle); # write create table statements This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |