From: Ken Youens-Clark Date: Mon, 8 Sep 2003 15:09:19 +0000 (+0000) Subject: Fixed problems in foreign key rule. X-Git-Tag: v0.04~190 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=026f23b36f1fd44842b62d4a3994c34713cce1b4;p=dbsrgits%2FSQL-Translator.git Fixed problems in foreign key rule. --- diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index c280ab5..ab42a73 100644 --- a/lib/SQL/Translator/Parser/MySQL.pm +++ b/lib/SQL/Translator/Parser/MySQL.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::MySQL; # ------------------------------------------------------------------- -# $Id: MySQL.pm,v 1.38 2003-08-26 04:01:36 kycl4rk Exp $ +# $Id: MySQL.pm,v 1.39 2003-09-08 15:09:19 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -123,7 +123,7 @@ Here's the word from the MySQL site use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.38 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.39 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -458,18 +458,19 @@ constraint : primary_key_def | foreign_key_def | -foreign_key_def : opt_constraint(?) /foreign key/i WORD(?) parens_field_list reference_definition +foreign_key_def : opt_constraint(?) /foreign key/i parens_field_list reference_definition { $return = { supertype => 'constraint', type => 'foreign_key', - name => $item[3][0], - fields => $item[4], + name => $item[1][0], + fields => $item[3], %{ $item{'reference_definition'} }, } } -opt_constraint : /constraint/i WORD +opt_constraint : /constraint/i NAME + { $item[2] } primary_key_def : primary_key index_name(?) '(' name_with_opt_paren(s /,/) ')' {