3 #-----------------------------------------------------
4 # $Id: sql_translator.pl,v 1.1.1.1 2002-03-01 02:26:25 kycl4rk Exp $
6 # File : sql_translator.pl
7 # Programmer : Ken Y. Clark, kclark@logsoft.com
9 # Purpose : invoke SQL::Translator
10 #-----------------------------------------------------
16 use vars qw( $VERSION );
17 $VERSION = (qw$Revision: 1.1.1.1 $)[-1];
19 my $from; # the original database
20 my $to; # the destination database
21 my $help; # show POD and bail
22 my $stdin; # whether to read STDIN for create script
23 my $no_comments; # whether to put comments in out file
24 my $verbose; # whether to print progress/debug
27 # Get options, explain how to use the script if necessary.
33 'v|verbose' => \$verbose,
34 'no_comments' => \$no_comments,
37 my @files = @ARGV; # the create script for the original db
39 pod2usage(1) if $help;
40 pod2usage(2) unless $from && $to && @files;
43 # If everything is OK, translate file(s).
45 my $translator = SQL::Translator->new;
46 my $output = $translator->translate(
51 no_comments => $no_comments,
52 ) or die "Error: " . $translator->error;
53 print "Output:\n", $output;
55 #-----------------------------------------------------
56 # It is not all books that are as dull as their readers.
58 #-----------------------------------------------------
62 sql_translator.pl - convert schema to Oracle syntax
66 ./sql_translator.pl -h|--help
68 ./sql_translator.pl -f|--from mysql -t|--to oracle [options] file
72 -v|--verbose Print debug info to STDERR
73 --no-comments Don't include comments in SQL output
77 Part of the SQL Fairy project (sqlfairy.sourceforge.net), this script
78 will try to convert any database syntax for which it has a grammar
79 into some other format will accept.
83 Ken Y. Clark, kclark@logsoft.com
87 perl(1), SQL::Transport.