From: Chris Hilton Date: Wed, 3 May 2006 21:46:06 +0000 (+0000) Subject: Fixed preservation of function call as field in function-based indices X-Git-Tag: v0.11008~449 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c4222efdca76000d079586f8cbc5fad5cd8c40eb;p=dbsrgits%2FSQL-Translator.git Fixed preservation of function call as field in function-based indices --- diff --git a/lib/SQL/Translator/Parser/Oracle.pm b/lib/SQL/Translator/Parser/Oracle.pm index 3dbc6e5..45aa5e0 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.22 2006-05-03 21:25:07 duality72 Exp $ +# $Id: Oracle.pm,v 1.23 2006-05-03 21:46:06 duality72 Exp $ # ------------------------------------------------------------------- # Copyright (C) 2002-4 SQLFairy Authors # @@ -97,7 +97,7 @@ was altered to better handle the syntax created by DDL::Oracle. use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.22 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.23 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -218,7 +218,10 @@ create : create_index index_name /on/i table_name index_expr table_option(?) ';' index_expr: parens_word_list { $item[1] } | '(' WORD parens_word_list ')' - { $item[2].$item[3] } + { + my $arg_list = join(",", @{$item[3]}); + $return = "$item[2]($arg_list)"; + } # Create anything else (e.g., domain, function, etc.) create : ...!create_table ...!create_index /create/i WORD /[^;]+/ ';' diff --git a/t/15oracle-parser.t b/t/15oracle-parser.t index aeccec1..07db30e 100644 --- a/t/15oracle-parser.t +++ b/t/15oracle-parser.t @@ -7,7 +7,7 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; use Test::SQL::Translator qw(maybe_plan); -maybe_plan(76, 'SQL::Translator::Parser::Oracle'); +maybe_plan(79, 'SQL::Translator::Parser::Oracle'); SQL::Translator::Parser::Oracle->import('parse'); my $t = SQL::Translator->new( trace => 0 ); @@ -208,6 +208,10 @@ is( scalar @t3_fields, 8, '8 fields in table' ); my @t3_constraints = $t3->get_constraints; is( scalar @t3_constraints, 4, '4 constraints on table' ); +my $t3_c4 = $t3_constraints[3]; +is( $t3_c4->type, UNIQUE, 'Fourth constraint is unique' ); +is( $t3_c4->name, 'qtl_accession_upper', 'Name = "qtl_accession_upper"' ); +is( join(',', $t3_c4->fields), 'UPPER(qtl_accession_id)', 'Fields = "UPPER(qtl_accession_id)"' ); is( $t3->comments, 'qtl table comment', 'Comment "qtl table comment" exists' );