# vim: set ft=perl:
# -------------------------------------------------------------------
-# $Id: sqlt,v 1.20 2006-02-22 17:03:57 kycl4rk Exp $
+# $Id: sqlt,v 1.22 2007-03-21 15:21:31 duality72 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
--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
+
General Producer Options
--producer-db-user Database user for producer
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
use SQL::Translator;
use vars qw( $VERSION );
-$VERSION = sprintf "%d.%02d", q$Revision: 1.20 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.22 $ =~ /(\d+)\.(\d+)/;
my $from; # the original database
my $to; # the destination database
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
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
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,
'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,
) or pod2usage(2);
if ($use_same_auth) {
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,
dsn => $dsn,
db_user => $db_user,
db_password => $db_password,
+ mysql_parser_version => $mysql_parser_version,
},
producer_args => {
imap_file => $imap_file,
prefix => $prefix,
indent => $indent,
newlines => $newlines,
+ postgres_version => $postgres_version,
package_name => $package_name,
},
);