Upped version numbers, cleaned up code, fixed my name.
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator / Parser / Access.pm
index 6196f3b..5e812e7 100644 (file)
@@ -1,9 +1,7 @@
 package SQL::Translator::Parser::Access;
 
 # -------------------------------------------------------------------
-# $Id: Access.pm,v 1.1 2004-04-19 16:38:17 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
@@ -41,7 +39,7 @@ something similar to the output of mdbtools (http://mdbtools.sourceforge.net/).
 
 use strict;
 use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/;
+$VERSION = '1.60';
 $DEBUG   = 0 unless defined $DEBUG;
 
 use Data::Dumper;
@@ -159,23 +157,12 @@ comment : /^\s*--(.*)\n/
 
 field : field_name data_type field_qualifier(s?) reference_definition(?)
     { 
-#        my %qualifiers  = map { %$_ } @{ $item{'field_qualifier(s?)'} || [] };
-#        if ( my @type_quals = @{ $item{'data_type'}{'qualifiers'} || [] } ) {
-#            $qualifiers{ $_ } = 1 for @type_quals;
-#        }
-#
-#        my $null = defined $qualifiers{'not_null'} 
-#                   ? $qualifiers{'not_null'} : 1;
-#        delete $qualifiers{'not_null'};
-
         $return = { 
             supertype   => 'field',
             name        => $item{'field_name'}, 
             data_type   => $item{'data_type'}{'type'},
             size        => $item{'data_type'}{'size'},
-#            null        => $null,
             constraints => $item{'reference_definition(?)'},
-#            %qualifiers,
         } 
     }
     | <error>
@@ -222,15 +209,15 @@ field_qualifier : /character set/i WORD
         }
     }
 
-reference_definition : /references/i table_name parens_field_list(?) match_type(?) on_delete_do(?) on_update_do(?)
+reference_definition : /references/i table_name parens_field_list(?) match_type(?) on_delete(?) on_update(?)
     {
         $return = {
             type             => 'foreign_key',
             reference_table  => $item[2],
             reference_fields => $item[3][0],
             match_type       => $item[4][0],
-            on_delete_do     => $item[5][0],
-            on_update_do     => $item[6][0],
+            on_delete        => $item[5][0],
+            on_update        => $item[6][0],
         }
     }
 
@@ -238,10 +225,10 @@ match_type : /match full/i { 'full' }
     |
     /match partial/i { 'partial' }
 
-on_delete_do : /on delete/i reference_option
+on_delete : /on delete/i reference_option
     { $item[2] }
 
-on_update_do : /on update/i reference_option
+on_update : /on update/i reference_option
     { $item[2] }
 
 reference_option: /restrict/i | 
@@ -460,19 +447,6 @@ sub parse {
             ) or die $table->error;
 
             $table->primary_key( $field->name ) if $fdata->{'is_primary_key'};
-
-#            for my $qual ( qw[ binary unsigned zerofill list ] ) {
-#                if ( my $val = $fdata->{ $qual } || $fdata->{ uc $qual } ) {
-#                    next if ref $val eq 'ARRAY' && !@$val;
-#                    $field->extra( $qual, $val );
-#                }
-#            }
-
-#            for my $cdata ( @{ $fdata->{'constraints'} } ) {
-#                next unless $cdata->{'type'} eq 'foreign_key';
-#                $cdata->{'fields'} ||= [ $field->name ];
-#                push @{ $tdata->{'constraints'} }, $cdata;
-#            }
         }
 
         for my $idata ( @{ $tdata->{'indices'} || [] } ) {
@@ -482,19 +456,6 @@ sub parse {
                 fields => $idata->{'fields'},
             ) or die $table->error;
         }
-
-#        for my $cdata ( @{ $tdata->{'constraints'} || [] } ) {
-#            my $constraint       =  $table->add_constraint(
-#                name             => $cdata->{'name'},
-#                type             => $cdata->{'type'},
-#                fields           => $cdata->{'fields'},
-#                reference_table  => $cdata->{'reference_table'},
-#                reference_fields => $cdata->{'reference_fields'},
-#                match_type       => $cdata->{'match_type'} || '',
-#                on_delete        => $cdata->{'on_delete_do'},
-#                on_update        => $cdata->{'on_update_do'},
-#            ) or die $table->error;
-#        }
     }
 
     return 1;
@@ -511,7 +472,7 @@ sub parse {
 
 =head1 AUTHOR
 
-Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
+Ken Youens-Clark E<lt>kclark@cpan.orgE<gt>.
 
 =head1 SEE ALSO