From: Ken Youens-Clark Date: Fri, 3 Oct 2003 17:08:46 +0000 (+0000) Subject: Added options for DBI parser. X-Git-Tag: v0.04~151 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e107f4d2408c80d2c82ea625082b4aa2a66414d0;p=dbsrgits%2FSQL-Translator.git Added options for DBI parser. --- diff --git a/bin/sqlt b/bin/sqlt index cc369bd..4a2de7e 100755 --- a/bin/sqlt +++ b/bin/sqlt @@ -1,7 +1,8 @@ #!/usr/bin/perl -w +# vim: set ft=perl: # ------------------------------------------------------------------- -# $Id: sqlt,v 1.3 2003-09-03 14:52:50 dlc Exp $ +# $Id: sqlt,v 1.4 2003-10-03 17:08:46 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2002 Ken Y. Clark , # darren chamberlain @@ -49,6 +50,12 @@ To translate a schema: --trace Print parser trace info --show-warnings Print warnings to STDERR + DBI Parser Options: + + --dsn DSN for connecting to database + --db-user Database user + --db-password Database password + xSV Parser Options: --fs The field separator @@ -106,7 +113,7 @@ use Pod::Usage; use SQL::Translator; use vars qw( $VERSION ); -$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; my $from; # the original database my $to; # the destination database @@ -130,6 +137,9 @@ my $template; # template to pass to TTSchema producer my $title; # title for HTML/POD producer my $emit_empty_tags; # show empty XML tags my $attrib_values; # use XML attributes instead of tags +my $dsn; # DBI parser +my $db_user; # DBI parser +my $db_password; # DBI parser GetOptions( 'add-drop-table' => \$add_drop_table, @@ -153,6 +163,9 @@ GetOptions( 'title:s' => \$title, 'trace' => \$trace, 'v|validate' => \$validate, + 'dsn:s' => \$dsn, + 'db-user:s' => \$db_user, + 'db-password:s' => \$db_password, ) or pod2usage(2); my @files = @ARGV; # source files @@ -171,6 +184,9 @@ my $translator = SQL::Translator->new( scan_fields => $no_scan ? 0 : 1, field_separator => $field_separator, record_separator => $record_separator, + dsn => $dsn, + db_user => $db_user, + db_password => $db_password, }, producer_args => { imap_file => $imap_file,