Added linefeeds so beginning of create view/procedure statements don't end up comment...
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Parser / XML / XMI / Rational.pm
index 3a3f800..1047a7f 100644 (file)
@@ -1,7 +1,7 @@
 package SQL::Translator::Parser::XML::XMI::Rational;
 
 # -------------------------------------------------------------------
-# $Id: Rational.pm,v 1.2 2003-10-01 17:47:02 grommit Exp $
+# $Id: Rational.pm,v 1.6 2003-10-06 15:43:41 grommit Exp $
 # -------------------------------------------------------------------
 # Copyright (C) 2003 Mark Addison <mark.addison@itn.co.uk>,
 #
@@ -28,12 +28,21 @@ Data Modeling Profile.
 =cut
 
 use strict;
+
+use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
+$VERSION = sprintf "%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/;
+$DEBUG   = 0 unless defined $DEBUG;
+use Exporter;
+use base qw(Exporter);
+@EXPORT_OK = qw(parse);
+
 use SQL::Translator::Parser::XML::XMI;
 use SQL::Translator::Utils 'debug';
 
 # Set the parg for the conversion sub then use the XMI parser
 sub parse {
     my ( $translator ) = @_;
+    local $DEBUG  = $translator->debug;
     my $pargs = $translator->parser_args;
        $pargs->{classes2schema} = \&classes2schema;
        return SQL::Translator::Parser::XML::XMI::parse(@_);
@@ -102,7 +111,7 @@ sub classes2schema {
                        elsif ( $stereo eq "PK" ) {
                                $data{type} = "PRIMARY_KEY";
                        }
-                       # TODO We need to work out the ref table
+                       # Work out the ref table
                        elsif ( $stereo eq "FK" ) {
                                $data{type} = "FOREIGN_KEY";
                                _add_fkey_refs($class,$op,\%data);
@@ -128,12 +137,6 @@ sub _add_fkey_refs {
 
        # Find the association ends
        my ($end) = grep { $_->{name} eq $op->{name} } @{$class->{associationEnds}};
-       #my $end;
-       #foreach $end ( @{$class->{associationEnds}} ) {
-       #       warn "END: $end->{name} $op->{name}\n";
-       #       last if $end->{name} eq $op->{name};
-       #}
-warn "END: ",Dumper($end),"\n";
        return unless $end;
        # Find the fkey op
        my ($refop) = grep { $_->{name} eq $end->{otherEnd}{name} }