/usr/bin/sqlt-dumper is in libsql-translator-perl 0.11020-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | #!/usr/bin/env perl
# -------------------------------------------------------------------
# Copyright (C) 2002-2009 SQLFairy Authors
#
# 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; version 2.
#
# 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., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA
# -------------------------------------------------------------------
=head1 NAME
sqlt-dumper - create a dumper script from a schema
=head1 SYNOPSIS
sqlt-dumper -d Oracle [options] schema.sql > dumper.pl
./dumper.pl > data.sql
Options:
-h|--help Show help and exit
--skip=t1[,t2] Skip tables in comma-separated list
--skiplike=regex Skip tables matching the regular expression
-u|--user Database username
-p|--password Database password
--dsn DSN for DBI
=head1 DESCRIPTION
This script uses SQL::Translator to parse the SQL schema and create a
Perl script that can connect to the database and dump the data as
INSERT statements (a la mysqldump) or MySQL's LOAD FILE syntax. You may
specify tables to "skip" (also using a "skiplike" regular expression)
and the generated dumper script will not have those tables. However,
these will also be options in the generated dumper, so you can wait to
specify these options when you dump your database. The database
username, password, and DSN can be hardcoded into the generated
script, or part of the DSN can be intuited from the "database"
argument.
=cut
# -------------------------------------------------------------------
use strict;
use warnings;
use Pod::Usage;
use Getopt::Long;
use SQL::Translator;
use File::Basename qw(basename);
use vars '$VERSION';
$VERSION = '1.59';
my ( $help, $db, $skip, $skiplike, $db_user, $db_pass, $dsn );
GetOptions(
'h|help' => \$help,
'd|f|from|db=s' => \$db,
'skip:s' => \$skip,
'skiplike:s' => \$skiplike,
'u|user:s' => \$db_user,
'p|password:s' => \$db_pass,
'dsn:s' => \$dsn,
) or pod2usage;
pod2usage(0) if $help;
pod2usage( 'No database driver specified' ) unless $db;
$db_user ||= 'username';
$db_pass ||= 'password';
$dsn ||= "dbi:$db:_";
my $file = shift @ARGV or pod2usage( -msg => 'No input file' );
my $t = SQL::Translator->new(
from => $db,
to => 'Dumper',
producer_args => {
skip => $skip,
skiplike => $skiplike,
db_user => $db_user,
db_password => $db_pass,
dsn => $dsn,
}
);
print $t->translate( $file );
exit(0);
# -------------------------------------------------------------------
=pod
=head1 AUTHOR
Ken Youens-Clark E<lt>kclark@cpan.orgE<gt>.
=head1 SEE ALSO
perl, SQL::Translator, SQL::Translator::Producer::Dumper.
=cut
|