1
# Copyright (C) 2009 Sun Microsystems, Inc. All rights reserved. Use
2
# is subject to license terms.
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful, but
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
# General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21
use lib "$ENV{RQG_HOME}/lib";
24
use GenTest::Translator;
25
use GenTest::Translator::MysqlDML2ANSI;
26
use GenTest::Translator::MysqlDML2pgsql;
27
use GenTest::Translator::MysqlDML2javadb;
28
use GenTest::Translator::Mysqldump2ANSI;
29
use GenTest::Translator::Mysqldump2pgsql;
30
use GenTest::Translator::Mysqldump2javadb;
34
my $from = "unspecified";
37
my $opt_result = GetOptions(
48
$translator1 = GenTest::Translator::Mysqldump2ANSI->new();
49
$translator2 = GenTest::Translator::MysqlDML2ANSI->new();
50
} elsif ($to eq "javadb" || $to eq "derby") {
51
$translator1 = GenTest::Translator::Mysqldump2javadb->new();
52
$translator2 = GenTest::Translator::MysqlDML2javadb->new();
53
} elsif ($to eq "postgres" || $to eq "pg" || $to eq "postgresql" || $to eq "pgsql") {
54
$translator1 = GenTest::Translator::Mysqldump2pgsql->new();
55
$translator2 = GenTest::Translator::MysqlDML2pgsql->new();
57
die "Unknown target \"$to\", use \"ansi\", \"javadb\" or \"postgresql\"";
67
if ($from eq "unspecified") {
68
$result = $translator1->translate($file);
69
$result = $translator2->translate($result);
70
} elsif ($from eq "mysqldump") {
71
$result = $translator1->translate($file);
72
} elsif ($from eq "dml") {
73
$result = $translator2->translate($file);
75
die "Unknown source \"$from\", if specified, use \"mysqldump\" or \"dml\"";