package SQL::Translator::Parser::Oracle;
# -------------------------------------------------------------------
-# $Id: Oracle.pm,v 1.26 2006-06-29 19:24:14 kycl4rk Exp $
+# $Id: Oracle.pm,v 1.27 2007-03-06 21:09:32 duality72 Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.26 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.27 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
{ @table_comments = () }
create_index : /create/i UNIQUE(?) /index/i
- { $return = $item[2] }
+ { $return = @{$item[2]} }
index_name : NAME '.' NAME
{ $item[3] }
@{ $constraints->{ $table_name } || [] };
for my $idata ( @{ $tdata->{'indices'} || [] } ) {
+open(OUT, ">>ACK");
+print OUT $idata->{name}, "\n";
my $index = $table->add_index(
name => $idata->{'name'},
type => uc $idata->{'type'},
use SQL::Translator::Schema::Constants;
use Test::SQL::Translator qw(maybe_plan);
-maybe_plan(85, 'SQL::Translator::Parser::Oracle');
+maybe_plan(89, 'SQL::Translator::Parser::Oracle');
SQL::Translator::Parser::Oracle->import('parse');
my $t = SQL::Translator->new( trace => 0 );
CREATE UNIQUE INDEX qtl_accession ON qtl ( qtl_accession_id );
CREATE UNIQUE INDEX qtl_accession_upper ON qtl ( UPPER(qtl_accession_id) );
+ CREATE INDEX qtl_index ON qtl ( qtl_accession_id );
CREATE TABLE qtl_trait_synonym
(
is( $t3_f2->comments, 'accession comment',
'Comment "accession comment" exists' );
+my @t3_indices = $t3->get_indices;
+is( scalar @t3_indices, 1, '1 index on table' );
+
+my $t3_i1 = shift @t3_indices;
+is( $t3_i1->type, 'NORMAL', 'First index is normal' );
+is( $t3_i1->name, 'qtl_index', 'Name is "qtl_index"' );
+is( join(',', $t3_i1->fields), 'qtl_accession_id', 'Fields = "qtl_accession_id"' );
+
#
# qtl_trait_synonym
#