From: Ken Youens-Clark Date: Sun, 25 Jan 2004 18:09:51 +0000 (+0000) Subject: Changed default_val rule according to bug report on RT.cpan.org. X-Git-Tag: v0.06~235 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=09fa21a61ddab6f0fd8f7cdcdd7cbda74e44566c;p=dbsrgits%2FSQL-Translator.git Changed default_val rule according to bug report on RT.cpan.org. --- diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index 1ef1909..a877a9b 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.41 2004-01-23 03:34:32 kycl4rk Exp $ +# $Id: MySQL.pm,v 1.42 2004-01-25 18:09:51 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.41 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.42 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -442,9 +442,15 @@ not_null : /not/i /null/i { $return = 0 } unsigned : /unsigned/i { $return = 0 } -default_val : /default/i /(?:')?[\s\w\d:.-]*(?:')?/ - { - $item[2] =~ s/'//g; +#default_val : /default/i /(?:')?[\s\w\d:.-]*(?:')?/ +# { +# $item[2] =~ s/'//g; +# $return = $item[2]; +# } + +default_val : /default/i /'(?:.*?\\')*.*?'|(?:')?[\w\d:.-]*(?:')?/ + { + $item[2] =~ s/^\s*'|'\s*$//g; $return = $item[2]; } @@ -463,7 +469,7 @@ foreign_key_def : foreign_key_def_begin parens_field_list reference_definition supertype => 'constraint', type => 'foreign_key', name => $item[1], - fields => $item[3], + fields => $item[2], %{ $item{'reference_definition'} }, } }