Release commit for 1.62
[dbsrgits/SQL-Translator.git] / script / sqlt
index 091c250..28e6ada 100755 (executable)
@@ -15,8 +15,8 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-# 02111-1307  USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
 # -------------------------------------------------------------------
 
 =head1 NAME
@@ -51,7 +51,7 @@ To translate a schema:
   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 
+    --ignore_opts      Comma-separated list of table options to ignore
 
   DBI Parser Options:
 
@@ -87,7 +87,7 @@ To translate a schema:
 
     --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
+    --quote-field-names  Quote all field names in statements
     --no-comments      Don't include comments in SQL output
 
   PostgreSQL Producer Options:
@@ -153,7 +153,7 @@ use Pod::Usage;
 use SQL::Translator;
 
 use vars qw( $VERSION );
-$VERSION = '1.59';
+$VERSION = '1.62';
 
 my $from;             # the original database
 my $to;               # the destination database
@@ -202,8 +202,8 @@ my $mysql_version; # MySQL version
 
 GetOptions(
     'add-drop-table'   => \$add_drop_table,
-    'quote_table_names'   => \$quote_table_names,
-    'quote_field_names'   => \$quote_field_names,
+    'quote-table-names|quote_table_names'   => \$quote_table_names,
+    'quote-field-names|quote_field_names'   => \$quote_field_names,
     'd|debug'          => \$debug,
     'f|from|parser:s'  => \$from,
     'fs:s'             => \$field_separator,
@@ -247,12 +247,12 @@ GetOptions(
 ) or pod2usage(2);
 
 if ($use_same_auth) {
-       $producer_dsn = $dsn;
-       $producer_db_user = $db_user;
-       $producer_db_password = $db_password;
+    $producer_dsn = $dsn;
+    $producer_db_user = $db_user;
+    $producer_db_password = $db_password;
 }
 
-if ( 
+if (
     ( !defined $from && defined $dsn )
     ||
     $from =~ /^DBI.*/
@@ -277,14 +277,14 @@ if ( $show_version ) {
     exit(0);
 }
 
-my $translator           =  SQL::Translator->new( 
+my $translator           =  SQL::Translator->new(
     debug                => $debug          ||  0,
     trace                => $trace          ||  0,
     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,
+    quote_table_names    => defined $quote_table_names ? $quote_table_names : 1,
+    quote_field_names    => defined $quote_field_names ? $quote_field_names : 1,
     validate             => $validate       ||  0,
     parser_args          => {
         trim_fields      => $no_trim ? 0 : 1,
@@ -318,7 +318,7 @@ my $translator           =  SQL::Translator->new(
         newlines         => $newlines,
         postgres_version => $postgres_version,
         mysql_version    => $mysql_version,
-           package_name     => $package_name,
+        package_name     => $package_name,
     },
 );
 
@@ -345,7 +345,7 @@ $translator->parser($from);
 $translator->producer($to);
 
 for my $file (@files) {
-    my @args = 
+    my @args =
         ($file eq '-') ? (data => \*STDIN) :
         ($file eq '!') ? (data => '') :
         (file => $file);