Uses Test::SQL::Translator.pm
[dbsrgits/SQL-Translator.git] / bin / sqlt-diagram
index cfe5f91..344226c 100755 (executable)
@@ -1,14 +1,32 @@
 #!/usr/bin/perl
 
-# $Id: sqlt-diagram,v 1.1 2003-08-26 02:29:12 kycl4rk Exp $
+# -------------------------------------------------------------------
+# $Id: sqlt-diagram,v 1.3 2004-02-06 17:48:16 kycl4rk Exp $
+# -------------------------------------------------------------------
+# Copyright (C) 2002-4 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
+# published by the Free Software Foundation; version 2.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# 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
+# -------------------------------------------------------------------
 
 =head1 NAME 
 
-sqlt-diagram.pl - Automatically create a diagram from a database schema
+sqlt-diagram - Automatically create a diagram from a database schema
 
 =head1 SYNOPSIS
 
-  ./sqlt-diagram.pl -d|--db=db_parser [options] schema.sql
+  ./sqlt-diagram -d|-f|--from|--db=db_parser [options] schema.sql
 
   Options:
 
@@ -36,7 +54,7 @@ name is given, then image will be printed to STDOUT, so you should
 redirect the output into a file.
 
 The default action is to assume the presence of foreign key
-relationships defined via "REFERNCES" or "FOREIGN KEY" constraints on
+relationships defined via "REFERENCES" or "FOREIGN KEY" constraints on
 the tables.  If you are parsing the schema of a file that does not
 have these, you will find the natural join options helpful.  With
 natural joins, like-named fields will be considered foreign keys.
@@ -46,7 +64,7 @@ include it in the "skip" option, and all fields called "name" will be
 excluded from natural joins.  A more efficient method, however, might
 be to simply deduce the foriegn keys from primary keys to other fields
 named the same in other tables.  Use the "natural-join-pk" option
-to acheive this.
+to achieve this.
 
 =cut
 
@@ -56,7 +74,8 @@ use Getopt::Long;
 use Pod::Usage;
 use SQL::Translator;
 
-my $VERSION = (qw$Revision: 1.1 $)[-1];
+use vars '$VERSION';
+$VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/;
 
 #
 # Get arguments.
@@ -68,7 +87,7 @@ my (
 );
 
 GetOptions(
-    'd|db=s'          => \$db_driver,
+    'd|db|f|from=s'   => \$db_driver,
     'o|output:s'      => \$out_file,
     'i|image:s'       => \$image_type,
     't|title:s'       => \$title,
@@ -119,10 +138,12 @@ for my $file (@files) {
     }
 }
 
+# -------------------------------------------------------------------
+
 =pod
 
 =head1 AUTHOR
 
-Ken Y. Clark E<lt>kclark@cpan.orgE<gt>
+Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
 
 =cut