X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=bin%2Fsqlt;h=7999c099f5d8f8e6211731b8a6204d164a1fc1bf;hb=4ab3763d2ad756c236b757306989cafa08e7f35e;hp=4ab9148b532937270f2609b8692066178078e677;hpb=9a64caf37a2f9092a5a29223e1cbcb2b1c36318b;p=dbsrgits%2FSQL-Translator.git diff --git a/bin/sqlt b/bin/sqlt index 4ab9148..7999c09 100755 --- a/bin/sqlt +++ b/bin/sqlt @@ -2,9 +2,7 @@ # vim: set ft=perl: # ------------------------------------------------------------------- -# $Id: sqlt,v 1.20 2006-02-22 17:03:57 kycl4rk Exp $ -# ------------------------------------------------------------------- -# Copyright (C) 2002-4 SQLFairy Authors +# 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 @@ -50,6 +48,11 @@ To translate a schema: --trace Print parser trace info --show-warnings Print warnings to STDERR + General Parser Options: + + --skip Comma-separated list of tables to skip (only implemented in some parsers) + --ignore_opts Comma-separated list of table options to ignore + DBI Parser Options: --dsn DSN for connecting to database @@ -64,6 +67,15 @@ To translate a schema: --no-trim Don't trim whitespace on fields --no-scan Don't scan fields for data types and sizes + MySQL Parser Options: + + --mysql-parser-version Target MySQL parser version for dealing with + /*! comments; default = 30000 + + MySQL Producer Options: + + --mysql-version MySQL server version + General Producer Options --producer-db-user Database user for producer @@ -74,8 +86,14 @@ To translate a schema: DB Producer Options: --add-drop-table Add 'DROP TABLE' statements before creates + --quote-table-names Quote all table names in statements + --quote-field-names Qjuote all field names in statements --no-comments Don't include comments in SQL output + PostgreSQL Producer Options: + + --postgres-version PostgreSQL server version + Diagram Producer Options: --imap-file Filename to put image map data @@ -134,7 +152,7 @@ use Pod::Usage; use SQL::Translator; use vars qw( $VERSION ); -$VERSION = sprintf "%d.%02d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/; +$VERSION = '1.59'; my $from; # the original database my $to; # the destination database @@ -142,7 +160,9 @@ my $help; # show POD and bail my $stdin; # whether to read STDIN for create script my $no_comments; # whether to put comments in out file my $show_warnings; # whether to show warnings from SQL::Translator -my $add_drop_table; # whether to show warnings from SQL::Translator +my $add_drop_table; # whether to add "DROP table" statements +my $quote_table_names; # whether to quote table names +my $quote_field_names; # whether to quote field names my $debug; # whether to print debug info my $trace; # whether to print parser trace my $list; # list all parsers and producers @@ -170,13 +190,19 @@ my $db_password; # DBI parser my $show_version; # Show version and exit script my $skip; my $skiplike; +my $ignore_opts; my $producer_db_user; # DSN for producer (e.g. Dumper, ClassDBI) my $producer_db_password; # db_pass " my $producer_dsn; # db_user " my $add_truncate; +my $mysql_parser_version; # MySQL parser arg for /*! comments +my $postgres_version; # PostgreSQL version +my $mysql_version; # MySQL version GetOptions( 'add-drop-table' => \$add_drop_table, + 'quote_table_names' => \$quote_table_names, + 'quote_field_names' => \$quote_field_names, 'd|debug' => \$debug, 'f|from|parser:s' => \$from, 'fs:s' => \$field_separator, @@ -205,6 +231,7 @@ GetOptions( 'producer-db-pass:s'=> \$producer_db_password, 'skip:s' => \$skip, 'skiplike:s' => \$skiplike, + 'ignore_opts:s' => \$ignore_opts, 'add_truncate' => \$add_truncate, 'add-prefix' => \$add_prefix, 'prefix:s' => \$prefix, @@ -213,6 +240,9 @@ GetOptions( 'package=s' => \$package_name, 'use-same-auth' => \$use_same_auth, 'version' => \$show_version, + 'mysql-parser-version=i' => \$mysql_parser_version, + 'postgres-version=f' => \$postgres_version, + 'mysql-version=f' => \$mysql_version, ) or pod2usage(2); if ($use_same_auth) { @@ -245,6 +275,8 @@ my $translator = SQL::Translator->new( no_comments => $no_comments || 0, show_warnings => $show_warnings || 0, add_drop_table => $add_drop_table || 0, + quote_table_names => $quote_table_names || 1, + quote_field_names => $quote_field_names || 1, validate => $validate || 0, parser_args => { trim_fields => $no_trim ? 0 : 1, @@ -254,6 +286,9 @@ my $translator = SQL::Translator->new( dsn => $dsn, db_user => $db_user, db_password => $db_password, + mysql_parser_version => $mysql_parser_version, + skip => $skip, + ignore_opts => $ignore_opts, }, producer_args => { imap_file => $imap_file, @@ -273,6 +308,8 @@ my $translator = SQL::Translator->new( prefix => $prefix, indent => $indent, newlines => $newlines, + postgres_version => $postgres_version, + mysql_version => $mysql_version, package_name => $package_name, }, );