Removed in anticipation of a merge.
[dbsrgits/SQL-Translator.git] / bin / sql_translator.pl
CommitLineData
16dc9970 1#!/usr/bin/perl -w
2
3#-----------------------------------------------------
4# $Id: sql_translator.pl,v 1.1.1.1 2002-03-01 02:26:25 kycl4rk Exp $
5#
6# File : sql_translator.pl
7# Programmer : Ken Y. Clark, kclark@logsoft.com
8# Created : 2002/02/27
9# Purpose : invoke SQL::Translator
10#-----------------------------------------------------
11
12use strict;
13use Getopt::Long;
14use Pod::Usage;
15use SQL::Translator;
16use vars qw( $VERSION );
17$VERSION = (qw$Revision: 1.1.1.1 $)[-1];
18
19my $from; # the original database
20my $to; # the destination database
21my $help; # show POD and bail
22my $stdin; # whether to read STDIN for create script
23my $no_comments; # whether to put comments in out file
24my $verbose; # whether to print progress/debug
25
26#
27# Get options, explain how to use the script if necessary.
28#
29GetOptions(
30 'f|from=s' => \$from,
31 't|to=s' => \$to,
32 'h|help' => \$help,
33 'v|verbose' => \$verbose,
34 'no_comments' => \$no_comments,
35) or pod2usage(2);
36
37my @files = @ARGV; # the create script for the original db
38
39pod2usage(1) if $help;
40pod2usage(2) unless $from && $to && @files;
41
42#
43# If everything is OK, translate file(s).
44#
45my $translator = SQL::Translator->new;
46my $output = $translator->translate(
47 from => $from,
48 to => $to,
49 input => \@files,
50 verbose => $verbose,
51 no_comments => $no_comments,
52) or die "Error: " . $translator->error;
53print "Output:\n", $output;
54
55#-----------------------------------------------------
56# It is not all books that are as dull as their readers.
57# Henry David Thoreau
58#-----------------------------------------------------
59
60=head1 NAME
61
62sql_translator.pl - convert schema to Oracle syntax
63
64=head1 SYNOPSIS
65
66 ./sql_translator.pl -h|--help
67
68 ./sql_translator.pl -f|--from mysql -t|--to oracle [options] file
69
70 Options:
71
72 -v|--verbose Print debug info to STDERR
73 --no-comments Don't include comments in SQL output
74
75=head1 DESCRIPTION
76
77Part of the SQL Fairy project (sqlfairy.sourceforge.net), this script
78will try to convert any database syntax for which it has a grammar
79into some other format will accept.
80
81=head1 AUTHOR
82
83Ken Y. Clark, kclark@logsoft.com
84
85=head1 SEE ALSO
86
87perl(1), SQL::Transport.
88
89=cut