From: Ken Youens-Clark Date: Wed, 27 Aug 2003 02:26:16 +0000 (+0000) Subject: Added rule for "create index" and fine tuned "default_value" rule. X-Git-Tag: v0.04~208 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b85a95ec7bdeacf1ccdfb50a3a8a3762485b6f6f;p=dbsrgits%2FSQL-Translator.git Added rule for "create index" and fine tuned "default_value" rule. --- diff --git a/lib/SQL/Translator/Parser/Oracle.pm b/lib/SQL/Translator/Parser/Oracle.pm index cd423f8..b5cbfd8 100644 --- a/lib/SQL/Translator/Parser/Oracle.pm +++ b/lib/SQL/Translator/Parser/Oracle.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::Oracle; # ------------------------------------------------------------------- -# $Id: Oracle.pm,v 1.9 2003-08-26 21:50:03 kycl4rk Exp $ +# $Id: Oracle.pm,v 1.10 2003-08-27 02:26:16 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark # @@ -95,7 +95,7 @@ constrnt_state use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -196,6 +196,16 @@ create : create_table table_name '(' create_definition(s /,/) ')' table_option(s 1; } +create : /create/i /index/i WORD /on/i table_name parens_word_list ';' + { + my $table_name = $item[5]; + push @{ $tables{ $table_name }{'indices'} }, { + name => $item[3], + type => 'normal', + fields => $item[6][0], + }; + } + # Create anything else (e.g., domain, function, etc.) create : /create/i WORD /[^;]+/ ';' { @table_comments = () } @@ -380,8 +390,8 @@ field_meta : default_val default_val : /default/i /(?:')?[\w\d.-]*(?:')?/ { - my $val = $item[2] || ''; - $val =~ s/'//g; + my $val = $item[2]; + $val =~ s/'//g if defined $val; $return = { supertype => 'constraint', type => 'default',