diff --git a/.gitignore b/.gitignore index 915cedccf..5c7db8f02 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ share/PrecompiledParsers/Parse/RecDescent/DDL/SQLT/*.pm *~ .#* *# +.tidyall.d/* diff --git a/.perltidyrc b/.perltidyrc new file mode 100644 index 000000000..fe006b8d2 --- /dev/null +++ b/.perltidyrc @@ -0,0 +1,15 @@ +-pbp # Start with Perl Best Practices +--maximum-line-length=120 +--maximum-consecutive-blank-lines=2 +--indent-columns=2 +--opening-brace-always-on-right +--cuddled-else +--vertical-tightness=0 +--paren-tightness=2 +--weld-nested-containers +--weld-fat-comma +--extended-continuation-indentation +-bom # keep method chain's linebreaks +-isbc # don't indent comments w/o leading space +--nostandard-output +--noblanks-before-comments diff --git a/BUGS b/BUGS deleted file mode 100644 index 4c45c186c..000000000 --- a/BUGS +++ /dev/null @@ -1 +0,0 @@ -Please report via rt.cpan.org. diff --git a/lib/SQL/Translator.pm b/lib/SQL/Translator.pm index e7f260761..2b94b83d8 100644 --- a/lib/SQL/Translator.pm +++ b/lib/SQL/Translator.pm @@ -1,413 +1,422 @@ package SQL::Translator; use Moo; -our ( $DEFAULT_SUB, $DEBUG, $ERROR ); +our ($DEFAULT_SUB, $DEBUG, $ERROR); -our $VERSION = '1.64'; +our $VERSION = '1.64'; $VERSION =~ tr/_//d; -$DEBUG = 0 unless defined $DEBUG; -$ERROR = ""; +$DEBUG = 0 unless defined $DEBUG; +$ERROR = ""; use Carp qw(carp croak); use Data::Dumper; use File::Find; use File::Spec::Functions qw(catfile); -use File::Basename qw(dirname); +use File::Basename qw(dirname); use IO::Dir; use Sub::Quote qw(quote_sub); use SQL::Translator::Producer; use SQL::Translator::Schema; use SQL::Translator::Utils qw(throw ex2err carp_ro normalize_quote_options); -$DEFAULT_SUB = sub { $_[0]->schema } unless defined $DEFAULT_SUB; +$DEFAULT_SUB = sub { $_[0]->schema } + unless defined $DEFAULT_SUB; with qw( - SQL::Translator::Role::Debug - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs + SQL::Translator::Role::Debug + SQL::Translator::Role::Error + SQL::Translator::Role::BuildArgs ); around BUILDARGS => sub { - my $orig = shift; - my $self = shift; - my $config = $self->$orig(@_); + my $orig = shift; + my $self = shift; + my $config = $self->$orig(@_); - # If a 'parser' or 'from' parameter is passed in, use that as the - # parser; if a 'producer' or 'to' parameter is passed in, use that - # as the producer; both default to $DEFAULT_SUB. - $config->{parser} ||= $config->{from} if defined $config->{from}; - $config->{producer} ||= $config->{to} if defined $config->{to}; + # If a 'parser' or 'from' parameter is passed in, use that as the + # parser; if a 'producer' or 'to' parameter is passed in, use that + # as the producer; both default to $DEFAULT_SUB. + $config->{parser} ||= $config->{from} if defined $config->{from}; + $config->{producer} ||= $config->{to} if defined $config->{to}; - $config->{filename} ||= $config->{file} if defined $config->{file}; + $config->{filename} ||= $config->{file} if defined $config->{file}; - my $quote = normalize_quote_options($config); - $config->{quote_identifiers} = $quote if defined $quote; + my $quote = normalize_quote_options($config); + $config->{quote_identifiers} = $quote if defined $quote; - return $config; + return $config; }; sub BUILD { - my ($self) = @_; - # Make sure all the tool-related stuff is set up - foreach my $tool (qw(producer parser)) { - $self->$tool($self->$tool); - } + my ($self) = @_; + + # Make sure all the tool-related stuff is set up + foreach my $tool (qw(producer parser)) { + $self->$tool($self->$tool); + } } has $_ => ( - is => 'rw', - default => quote_sub(q{ 0 }), - coerce => quote_sub(q{ $_[0] ? 1 : 0 }), + is => 'rw', + default => quote_sub(q{ 0 }), + coerce => quote_sub(q{ $_[0] ? 1 : 0 }), ) foreach qw(add_drop_table no_comments show_warnings trace validate); # quote_identifiers is on by default, use a 0-but-true as indicator # so we can allow individual producers to change the default has quote_identifiers => ( - is => 'rw', - default => quote_sub(q{ '0E0' }), - coerce => quote_sub(q{ $_[0] || 0 }), + is => 'rw', + default => quote_sub(q{ '0E0' }), + coerce => quote_sub(q{ $_[0] || 0 }), ); sub quote_table_names { - (@_ > 1 and ($_[1] xor $_[0]->quote_identifiers) ) - ? croak 'Using quote_table_names as a setter is no longer supported' - : $_[0]->quote_identifiers; + (@_ > 1 and ($_[1] xor $_[0]->quote_identifiers)) + ? croak 'Using quote_table_names as a setter is no longer supported' + : $_[0]->quote_identifiers; } sub quote_field_names { - (@_ > 1 and ($_[1] xor $_[0]->quote_identifiers) ) - ? croak 'Using quote_field_names as a setter is no longer supported' - : $_[0]->quote_identifiers; + (@_ > 1 and ($_[1] xor $_[0]->quote_identifiers)) + ? croak 'Using quote_field_names as a setter is no longer supported' + : $_[0]->quote_identifiers; } after quote_identifiers => sub { - if (@_ > 1) { - # synchronize for old code reaching directly into guts - $_[0]->{quote_table_names} - = $_[0]->{quote_field_names} - = $_[1] ? 1 : 0; - } + if (@_ > 1) { + + # synchronize for old code reaching directly into guts + $_[0]->{quote_table_names} = $_[0]->{quote_field_names} = $_[1] ? 1 : 0; + } }; -has producer => ( is => 'rw', default => sub { $DEFAULT_SUB } ); +has producer => (is => 'rw', default => sub {$DEFAULT_SUB}); around producer => sub { - my $orig = shift; - shift->_tool({ - orig => $orig, - name => 'producer', - path => "SQL::Translator::Producer", - default_sub => "produce", - }, @_); + my $orig = shift; + shift->_tool( + { + orig => $orig, + name => 'producer', + path => "SQL::Translator::Producer", + default_sub => "produce", + }, + @_ + ); }; -has producer_type => ( is => 'rwp', init_arg => undef ); +has producer_type => (is => 'rwp', init_arg => undef); around producer_type => carp_ro('producer_type'); -has producer_args => ( is => 'rw', default => quote_sub(q{ +{} }) ); +has producer_args => (is => 'rw', default => quote_sub(q{ +{} })); around producer_args => sub { - my $orig = shift; - shift->_args($orig, @_); + my $orig = shift; + shift->_args($orig, @_); }; -has parser => ( is => 'rw', default => sub { $DEFAULT_SUB } ); +has parser => (is => 'rw', default => sub {$DEFAULT_SUB}); around parser => sub { - my $orig = shift; - shift->_tool({ - orig => $orig, - name => 'parser', - path => "SQL::Translator::Parser", - default_sub => "parse", - }, @_); + my $orig = shift; + shift->_tool( + { + orig => $orig, + name => 'parser', + path => "SQL::Translator::Parser", + default_sub => "parse", + }, + @_ + ); }; -has parser_type => ( is => 'rwp', init_arg => undef ); +has parser_type => (is => 'rwp', init_arg => undef); around parser_type => carp_ro('parser_type'); -has parser_args => ( is => 'rw', default => quote_sub(q{ +{} }) ); +has parser_args => (is => 'rw', default => quote_sub(q{ +{} })); around parser_args => sub { - my $orig = shift; - shift->_args($orig, @_); + my $orig = shift; + shift->_args($orig, @_); }; has filters => ( - is => 'rw', - default => quote_sub(q{ [] }), - coerce => sub { - my @filters; - # Set. Convert args to list of [\&code,@args] - foreach (@{$_[0]||[]}) { - my ($filt,@args) = ref($_) eq "ARRAY" ? @$_ : $_; - if ( isa($filt,"CODE") ) { - push @filters, [$filt,@args]; - next; - } - else { - __PACKAGE__->debug("Adding $filt filter. Args:".Dumper(\@args)."\n") if __PACKAGE__->debugging; - $filt = _load_sub("$filt\::filter", "SQL::Translator::Filter") - || throw(__PACKAGE__->error); - push @filters, [$filt,@args]; - } - } - return \@filters; - }, + is => 'rw', + default => quote_sub(q{ [] }), + coerce => sub { + my @filters; + + # Set. Convert args to list of [\&code,@args] + foreach (@{ $_[0] || [] }) { + my ($filt, @args) = ref($_) eq "ARRAY" ? @$_ : $_; + if (isa($filt, "CODE")) { + push @filters, [ $filt, @args ]; + next; + } else { + __PACKAGE__->debug("Adding $filt filter. Args:" . Dumper(\@args) . "\n") + if __PACKAGE__->debugging; + $filt = _load_sub("$filt\::filter", "SQL::Translator::Filter") + || throw(__PACKAGE__->error); + push @filters, [ $filt, @args ]; + } + } + return \@filters; + }, ); around filters => sub { - my $orig = shift; - my $self = shift; - return @{$self->$orig([@{$self->$orig}, @_])} if @_; - return @{$self->$orig}; + my $orig = shift; + my $self = shift; + return @{ $self->$orig([ @{ $self->$orig }, @_ ]) } if @_; + return @{ $self->$orig }; }; has filename => ( - is => 'rw', - isa => sub { - foreach my $filename (ref($_[0]) eq 'ARRAY' ? @{$_[0]} : $_[0]) { - if (-d $filename) { - throw("Cannot use directory '$filename' as input source"); - } - elsif (not -f _ && -r _) { - throw("Cannot use '$filename' as input source: ". - "file does not exist or is not readable."); - } - } - }, + is => 'rw', + isa => sub { + foreach my $filename (ref($_[0]) eq 'ARRAY' ? @{ $_[0] } : $_[0]) { + if (-d $filename) { + throw("Cannot use directory '$filename' as input source"); + } elsif (not -f _ && -r _ ) { + throw("Cannot use '$filename' as input source: " . "file does not exist or is not readable."); + } + } + }, ); around filename => \&ex2err; has data => ( - is => 'rw', - builder => 1, - lazy => 1, - coerce => sub { - # Set $self->data based on what was passed in. We will - # accept a number of things; do our best to get it right. - my $data = shift; - if (isa($data, 'ARRAY')) { - $data = join '', @$data; - } - elsif (isa($data, 'GLOB')) { - seek ($data, 0, 0) if eof ($data); - local $/; - $data = <$data>; - } - return isa($data, 'SCALAR') ? $data : \$data; - }, + is => 'rw', + builder => 1, + lazy => 1, + coerce => sub { + + # Set $self->data based on what was passed in. We will + # accept a number of things; do our best to get it right. + my $data = shift; + if (isa($data, 'ARRAY')) { + $data = join '', @$data; + } elsif (isa($data, 'GLOB')) { + seek($data, 0, 0) if eof($data); + local $/; + $data = <$data>; + } + return isa($data, 'SCALAR') ? $data : \$data; + }, ); around data => sub { - my $orig = shift; - my $self = shift; + my $orig = shift; + my $self = shift; - if (@_ > 1 && !ref $_[0]) { - return $self->$orig(\join('', @_)); - } - elsif (@_) { - return $self->$orig(@_); - } - return ex2err($orig, $self); + if (@_ > 1 && !ref $_[0]) { + return $self->$orig(\join('', @_)); + } elsif (@_) { + return $self->$orig(@_); + } + return ex2err($orig, $self); }; sub _build_data { - my $self = shift; - # If we have a filename but no data yet, populate. - if (my $filename = $self->filename) { - $self->debug("Opening '$filename' to get contents.\n"); - local $/; - my $data; + my $self = shift; - my @files = ref($filename) eq 'ARRAY' ? @$filename : ($filename); + # If we have a filename but no data yet, populate. + if (my $filename = $self->filename) { + $self->debug("Opening '$filename' to get contents.\n"); + local $/; + my $data; - foreach my $file (@files) { - open my $fh, '<', $file - or throw("Can't read file '$file': $!"); + my @files = ref($filename) eq 'ARRAY' ? @$filename : ($filename); - $data .= <$fh>; + foreach my $file (@files) { + open my $fh, '<', $file + or throw("Can't read file '$file': $!"); - close $fh or throw("Can't close file '$file': $!"); - } + $data .= <$fh>; - return \$data; + close $fh or throw("Can't close file '$file': $!"); } + + return \$data; + } } has schema => ( - is => 'lazy', - init_arg => undef, - clearer => 'reset', - predicate => '_has_schema', + is => 'lazy', + init_arg => undef, + clearer => 'reset', + predicate => '_has_schema', ); around schema => carp_ro('schema'); around reset => sub { - my $orig = shift; - my $self = shift; - $self->$orig(@_); - return 1 + my $orig = shift; + my $self = shift; + $self->$orig(@_); + return 1; }; sub _build_schema { SQL::Translator::Schema->new(translator => shift) } sub translate { - my $self = shift; - my ($args, $parser, $parser_type, $producer, $producer_type); - my ($parser_output, $producer_output, @producer_output); - - # Parse arguments - if (@_ == 1) { - # Passed a reference to a hash? - if (isa($_[0], 'HASH')) { - # yep, a hashref - $self->debug("translate: Got a hashref\n"); - $args = $_[0]; - } + my $self = shift; + my ($args, $parser, $parser_type, $producer, $producer_type); + my ($parser_output, $producer_output, @producer_output); - # Passed a GLOB reference, i.e., filehandle - elsif (isa($_[0], 'GLOB')) { - $self->debug("translate: Got a GLOB reference\n"); - $self->data($_[0]); - } + # Parse arguments + if (@_ == 1) { - # Passed a reference to a string containing the data - elsif (isa($_[0], 'SCALAR')) { - # passed a ref to a string - $self->debug("translate: Got a SCALAR reference (string)\n"); - $self->data($_[0]); - } + # Passed a reference to a hash? + if (isa($_[0], 'HASH')) { - # Not a reference; treat it as a filename - elsif (! ref $_[0]) { - # Not a ref, it's a filename - $self->debug("translate: Got a filename\n"); - $self->filename($_[0]); - } - - # Passed something else entirely. - else { - # We're not impressed. Take your empty string and leave. - # return ""; - - # Actually, if data, parser, and producer are set, then we - # can continue. Too bad, because I like my comment - # (above)... - return "" unless ($self->data && - $self->producer && - $self->parser); - } - } - else { - # You must pass in a hash, or you get nothing. - return "" if @_ % 2; - $args = { @_ }; + # yep, a hashref + $self->debug("translate: Got a hashref\n"); + $args = $_[0]; } - # ---------------------------------------------------------------------- - # Can specify the data to be transformed using "filename", "file", - # "data", or "datasource". - # ---------------------------------------------------------------------- - if (my $filename = ($args->{'filename'} || $args->{'file'})) { - $self->filename($filename); + # Passed a GLOB reference, i.e., filehandle + elsif (isa($_[0], 'GLOB')) { + $self->debug("translate: Got a GLOB reference\n"); + $self->data($_[0]); } - if (my $data = ($args->{'data'} || $args->{'datasource'})) { - $self->data($data); + # Passed a reference to a string containing the data + elsif (isa($_[0], 'SCALAR')) { + + # passed a ref to a string + $self->debug("translate: Got a SCALAR reference (string)\n"); + $self->data($_[0]); } - # ---------------------------------------------------------------- - # Get the data. - # ---------------------------------------------------------------- - my $data = $self->data; + # Not a reference; treat it as a filename + elsif (!ref $_[0]) { - # ---------------------------------------------------------------- - # Local reference to the parser subroutine - # ---------------------------------------------------------------- - if ($parser = ($args->{'parser'} || $args->{'from'})) { - $self->parser($parser); - } - $parser = $self->parser; - $parser_type = $self->parser_type; - - # ---------------------------------------------------------------- - # Local reference to the producer subroutine - # ---------------------------------------------------------------- - if ($producer = ($args->{'producer'} || $args->{'to'})) { - $self->producer($producer); - } - $producer = $self->producer; - $producer_type = $self->producer_type; - - # ---------------------------------------------------------------- - # Execute the parser, the filters and then execute the producer. - # Allowances are made for each piece to die, or fail to compile, - # since the referenced subroutines could be almost anything. In - # the future, each of these might happen in a Safe environment, - # depending on how paranoid we want to be. - # ---------------------------------------------------------------- - - # Run parser - unless ( $self->_has_schema ) { - eval { $parser_output = $parser->($self, $$data) }; - if ($@ || ! $parser_output) { - my $msg = sprintf "translate: Error with parser '%s': %s", - $parser_type, ($@) ? $@ : " no results"; - return $self->error($msg); - } + # Not a ref, it's a filename + $self->debug("translate: Got a filename\n"); + $self->filename($_[0]); } - $self->debug("Schema =\n", Dumper($self->schema), "\n") if $self->debugging;; - # Validate the schema if asked to. - if ($self->validate) { - my $schema = $self->schema; - return $self->error('Invalid schema') unless $schema->is_valid; + # Passed something else entirely. + else { + # We're not impressed. Take your empty string and leave. + # return ""; + + # Actually, if data, parser, and producer are set, then we + # can continue. Too bad, because I like my comment + # (above)... + return "" + unless ($self->data + && $self->producer + && $self->parser); } + } else { + # You must pass in a hash, or you get nothing. + return "" if @_ % 2; + $args = {@_}; + } + + # ---------------------------------------------------------------------- + # Can specify the data to be transformed using "filename", "file", + # "data", or "datasource". + # ---------------------------------------------------------------------- + if (my $filename = ($args->{'filename'} || $args->{'file'})) { + $self->filename($filename); + } - # Run filters - my $filt_num = 0; - foreach ($self->filters) { - $filt_num++; - my ($code,@args) = @$_; - eval { $code->($self->schema, @args) }; - my $err = $@ || $self->error || 0; - return $self->error("Error with filter $filt_num : $err") if $err; + if (my $data = ($args->{'data'} || $args->{'datasource'})) { + $self->data($data); + } + + # ---------------------------------------------------------------- + # Get the data. + # ---------------------------------------------------------------- + my $data = $self->data; + + # ---------------------------------------------------------------- + # Local reference to the parser subroutine + # ---------------------------------------------------------------- + if ($parser = ($args->{'parser'} || $args->{'from'})) { + $self->parser($parser); + } + $parser = $self->parser; + $parser_type = $self->parser_type; + + # ---------------------------------------------------------------- + # Local reference to the producer subroutine + # ---------------------------------------------------------------- + if ($producer = ($args->{'producer'} || $args->{'to'})) { + $self->producer($producer); + } + $producer = $self->producer; + $producer_type = $self->producer_type; + + # ---------------------------------------------------------------- + # Execute the parser, the filters and then execute the producer. + # Allowances are made for each piece to die, or fail to compile, + # since the referenced subroutines could be almost anything. In + # the future, each of these might happen in a Safe environment, + # depending on how paranoid we want to be. + # ---------------------------------------------------------------- + + # Run parser + unless ($self->_has_schema) { + eval { $parser_output = $parser->($self, $$data) }; + if ($@ || !$parser_output) { + my $msg = sprintf "translate: Error with parser '%s': %s", $parser_type, ($@) ? $@ : " no results"; + return $self->error($msg); } + } + $self->debug("Schema =\n", Dumper($self->schema), "\n") + if $self->debugging; - # Run producer - # Calling wantarray in the eval no work, wrong scope. - my $wantarray = wantarray ? 1 : 0; - eval { - if ($wantarray) { - @producer_output = $producer->($self); - } else { - $producer_output = $producer->($self); - } - }; - if ($@ || !( $producer_output || @producer_output)) { - my $err = $@ || $self->error || "no results"; - my $msg = "translate: Error with producer '$producer_type': $err"; - return $self->error($msg); + # Validate the schema if asked to. + if ($self->validate) { + my $schema = $self->schema; + return $self->error('Invalid schema') unless $schema->is_valid; + } + + # Run filters + my $filt_num = 0; + foreach ($self->filters) { + $filt_num++; + my ($code, @args) = @$_; + eval { $code->($self->schema, @args) }; + my $err = $@ || $self->error || 0; + return $self->error("Error with filter $filt_num : $err") if $err; + } + + # Run producer + # Calling wantarray in the eval no work, wrong scope. + my $wantarray = wantarray ? 1 : 0; + eval { + if ($wantarray) { + @producer_output = $producer->($self); + } else { + $producer_output = $producer->($self); } + }; + if ($@ || !($producer_output || @producer_output)) { + my $err = $@ || $self->error || "no results"; + my $msg = "translate: Error with producer '$producer_type': $err"; + return $self->error($msg); + } - return wantarray ? @producer_output : $producer_output; + return wantarray ? @producer_output : $producer_output; } sub list_parsers { - return shift->_list("parser"); + return shift->_list("parser"); } sub list_producers { - return shift->_list("producer"); + return shift->_list("producer"); } - # ====================================================================== # Private Methods # ====================================================================== @@ -418,23 +427,24 @@ sub list_producers { # Gets or sets ${type}_args. Called by parser_args and producer_args. # ---------------------------------------------------------------------- sub _args { - my $self = shift; - my $orig = shift; - - if (@_) { - # If the first argument is an explicit undef (remember, we - # don't get here unless there is stuff in @_), then we clear - # out the producer_args hash. - if (! defined $_[0]) { - shift @_; - $self->$orig({}); - } + my $self = shift; + my $orig = shift; - my $args = isa($_[0], 'HASH') ? shift : { @_ }; - return $self->$orig({ %{$self->$orig}, %$args }); + if (@_) { + + # If the first argument is an explicit undef (remember, we + # don't get here unless there is stuff in @_), then we clear + # out the producer_args hash. + if (!defined $_[0]) { + shift @_; + $self->$orig({}); } - return $self->$orig; + my $args = isa($_[0], 'HASH') ? shift : {@_}; + return $self->$orig({ %{ $self->$orig }, %$args }); + } + + return $self->$orig; } # ---------------------------------------------------------------------- @@ -446,114 +456,113 @@ sub _args { # }, @_); # ---------------------------------------------------------------------- sub _tool { - my ($self,$args) = (shift, shift); - my $name = $args->{name}; - my $orig = $args->{orig}; - return $self->{$name} unless @_; # get accessor - - my $path = $args->{path}; - my $default_sub = $args->{default_sub}; - my $tool = shift; - - # passed an anonymous subroutine reference - if (isa($tool, 'CODE')) { - $self->$orig($tool); - $self->${\"_set_${name}_type"}("CODE"); - $self->debug("Got $name: code ref\n"); - } - - # Module name was passed directly - # We try to load the name; if it doesn't load, there's a - # possibility that it has a function name attached to it, - # so we give it a go. - else { - $tool =~ s/-/::/g if $tool !~ /::/; - my ($code,$sub); - ($code,$sub) = _load_sub("$tool\::$default_sub", $path); - unless ($code) { - if ( __PACKAGE__->error =~ m/Can't find module/ ) { - # Mod not found so try sub - ($code,$sub) = _load_sub("$tool", $path) unless $code; - die "Can't load $name subroutine '$tool' : ".__PACKAGE__->error - unless $code; - } - else { - die "Can't load $name '$tool' : ".__PACKAGE__->error; - } - } + my ($self, $args) = (shift, shift); + my $name = $args->{name}; + my $orig = $args->{orig}; + return $self->{$name} unless @_; # get accessor + + my $path = $args->{path}; + my $default_sub = $args->{default_sub}; + my $tool = shift; + + # passed an anonymous subroutine reference + if (isa($tool, 'CODE')) { + $self->$orig($tool); + $self->${ \"_set_${name}_type" }("CODE"); + $self->debug("Got $name: code ref\n"); + } - # get code reference and assign - my (undef,$module,undef) = $sub =~ m/((.*)::)?(\w+)$/; - $self->$orig($code); - $self->${\"_set_$name\_type"}($sub eq "CODE" ? "CODE" : $module); - $self->debug("Got $name: $sub\n"); + # Module name was passed directly + # We try to load the name; if it doesn't load, there's a + # possibility that it has a function name attached to it, + # so we give it a go. + else { + $tool =~ s/-/::/g if $tool !~ /::/; + my ($code, $sub); + ($code, $sub) = _load_sub("$tool\::$default_sub", $path); + unless ($code) { + if (__PACKAGE__->error =~ m/Can't find module/) { + + # Mod not found so try sub + ($code, $sub) = _load_sub("$tool", $path) unless $code; + die "Can't load $name subroutine '$tool' : " . __PACKAGE__->error + unless $code; + } else { + die "Can't load $name '$tool' : " . __PACKAGE__->error; + } } - # At this point, $self->{$name} contains a subroutine - # reference that is ready to run + # get code reference and assign + my (undef, $module, undef) = $sub =~ m/((.*)::)?(\w+)$/; + $self->$orig($code); + $self->${ \"_set_$name\_type" }($sub eq "CODE" ? "CODE" : $module); + $self->debug("Got $name: $sub\n"); + } + + # At this point, $self->{$name} contains a subroutine + # reference that is ready to run - # Anything left? If so, it's args - my $meth = "$name\_args"; - $self->$meth(@_) if (@_); + # Anything left? If so, it's args + my $meth = "$name\_args"; + $self->$meth(@_) if (@_); - return $self->{$name}; + return $self->{$name}; } # ---------------------------------------------------------------------- # _list($type) # ---------------------------------------------------------------------- sub _list { - my $self = shift; - my $type = shift || return (); - my $uctype = ucfirst lc $type; - - # - # First find all the directories where SQL::Translator - # parsers or producers (the "type") appear to live. - # - load("SQL::Translator::$uctype") or return (); - my $path = catfile "SQL", "Translator", $uctype; - my @dirs; - for (@INC) { - my $dir = catfile $_, $path; - $self->debug("_list_${type}s searching $dir\n"); - next unless -d $dir; - push @dirs, $dir; - } + my $self = shift; + my $type = shift || return (); + my $uctype = ucfirst lc $type; + + # + # First find all the directories where SQL::Translator + # parsers or producers (the "type") appear to live. + # + load("SQL::Translator::$uctype") or return (); + my $path = catfile "SQL", "Translator", $uctype; + my @dirs; + for (@INC) { + my $dir = catfile $_, $path; + $self->debug("_list_${type}s searching $dir\n"); + next unless -d $dir; + push @dirs, $dir; + } - # - # Now use File::File::find to look recursively in those - # directories for all the *.pm files, then present them - # with the slashes turned into dashes. - # - my %found; - find( - sub { - if ( -f && m/\.pm$/ ) { - my $mod = $_; - $mod =~ s/\.pm$//; - my $cur_dir = $File::Find::dir; - my $base_dir = quotemeta catfile 'SQL', 'Translator', $uctype; - - # - # See if the current directory is below the base directory. - # - if ( $cur_dir =~ m/$base_dir(.*)/ ) { - $cur_dir = $1; - $cur_dir =~ s!^/!!; # kill leading slash - $cur_dir =~ s!/!-!g; # turn other slashes into dashes - } - else { - $cur_dir = ''; - } - - $found{ join '-', map { $_ || () } $cur_dir, $mod } = 1; - } - }, - @dirs - ); - - return sort { lc $a cmp lc $b } keys %found; + # + # Now use File::File::find to look recursively in those + # directories for all the *.pm files, then present them + # with the slashes turned into dashes. + # + my %found; + find( + sub { + if (-f && m/\.pm$/) { + my $mod = $_; + $mod =~ s/\.pm$//; + my $cur_dir = $File::Find::dir; + my $base_dir = quotemeta catfile 'SQL', 'Translator', $uctype; + + # + # See if the current directory is below the base directory. + # + if ($cur_dir =~ m/$base_dir(.*)/) { + $cur_dir = $1; + $cur_dir =~ s!^/!!; # kill leading slash + $cur_dir =~ s!/!-!g; # turn other slashes into dashes + } else { + $cur_dir = ''; + } + + $found{ join '-', map { $_ || () } $cur_dir, $mod } = 1; + } + }, + @dirs + ); + + return sort { lc $a cmp lc $b } keys %found; } # ---------------------------------------------------------------------- @@ -573,27 +582,29 @@ sub _list { # it), therefore a single word name without a path fails. # ---------------------------------------------------------------------- sub load { - my $name = shift; - my @path; - push @path, "" if $name =~ /::/; # Empty path to check name on its own first - push @path, @_ if @_; - - foreach (@path) { - my $module = $_ ? "$_\::$name" : $name; - my $file = $module; $file =~ s[::][/]g; $file .= ".pm"; - __PACKAGE__->debug("Loading $name as $file\n"); - return $module if $INC{$file}; # Already loaded - - eval { require $file }; - next if $@ =~ /Can't locate $file in \@INC/; - eval { $module->import() } unless $@; - return __PACKAGE__->error("Error loading $name as $module : $@") + my $name = shift; + my @path; + push @path, "" if $name =~ /::/; # Empty path to check name on its own first + push @path, @_ if @_; + + foreach (@path) { + my $module = $_ ? "$_\::$name" : $name; + my $file = $module; + $file =~ s[::][/]g; + $file .= ".pm"; + __PACKAGE__->debug("Loading $name as $file\n"); + return $module if $INC{$file}; # Already loaded + + eval { require $file }; + next if $@ =~ /Can't locate $file in \@INC/; + eval { $module->import() } unless $@; + return __PACKAGE__->error("Error loading $name as $module : $@") if $@ && $@ !~ /"SQL::Translator::Producer" is not exported/; - return $module; # Module loaded ok - } + return $module; # Module loaded ok + } - return __PACKAGE__->error("Can't find module $name. Path:".join(",",@path)); + return __PACKAGE__->error("Can't find module $name. Path:" . join(",", @path)); } # ---------------------------------------------------------------------- @@ -603,30 +614,30 @@ sub load { # (\&code, $sub) = load_sub( 'MySQL::produce', @path ); # ---------------------------------------------------------------------- sub _load_sub { - my ($tool, @path) = @_; + my ($tool, @path) = @_; - my (undef,$module,$func_name) = $tool =~ m/((.*)::)?(\w+)$/; - if ( my $module = load($module => @path) ) { - my $sub = "$module\::$func_name"; - return wantarray ? ( \&{ $sub }, $sub ) : \&$sub; - } - return undef; + my (undef, $module, $func_name) = $tool =~ m/((.*)::)?(\w+)$/; + if (my $module = load($module => @path)) { + my $sub = "$module\::$func_name"; + return wantarray ? (\&{$sub}, $sub) : \&$sub; + } + return undef; } sub format_table_name { - return shift->_format_name('_format_table_name', @_); + return shift->_format_name('_format_table_name', @_); } sub format_package_name { - return shift->_format_name('_format_package_name', @_); + return shift->_format_name('_format_package_name', @_); } sub format_fk_name { - return shift->_format_name('_format_fk_name', @_); + return shift->_format_name('_format_fk_name', @_); } sub format_pk_name { - return shift->_format_name('_format_pk_name', @_); + return shift->_format_name('_format_pk_name', @_); } # ---------------------------------------------------------------------- @@ -636,28 +647,27 @@ sub format_pk_name { # it to the rest of the arguments (if any). # ---------------------------------------------------------------------- sub _format_name { - my $self = shift; - my $field = shift; - my @args = @_; - - if (ref($args[0]) eq 'CODE') { - $self->{$field} = shift @args; - } - elsif (! exists $self->{$field}) { - $self->{$field} = sub { return shift }; - } + my $self = shift; + my $field = shift; + my @args = @_; + + if (ref($args[0]) eq 'CODE') { + $self->{$field} = shift @args; + } elsif (!exists $self->{$field}) { + $self->{$field} = sub { return shift }; + } - return @args ? $self->{$field}->(@args) : $self->{$field}; + return @args ? $self->{$field}->(@args) : $self->{$field}; } sub isa($$) { - my ($ref, $type) = @_; - return UNIVERSAL::isa($ref, $type); + my ($ref, $type) = @_; + return UNIVERSAL::isa($ref, $type); } sub version { - my $self = shift; - return $VERSION; + my $self = shift; + return $VERSION; } # Must come after all 'has' declarations diff --git a/lib/SQL/Translator/Diff.pm b/lib/SQL/Translator/Diff.pm index 334418858..e3d8b0f86 100644 --- a/lib/SQL/Translator/Diff.pm +++ b/lib/SQL/Translator/Diff.pm @@ -1,6 +1,5 @@ package SQL::Translator::Diff; - ## SQLT schema diffing code use strict; use warnings; @@ -11,311 +10,294 @@ use SQL::Translator::Schema::Constants; use Sub::Quote qw(quote_sub); use Moo; -has ignore_index_names => ( - is => 'rw', -); -has ignore_constraint_names => ( - is => 'rw', -); -has ignore_view_sql => ( - is => 'rw', -); -has ignore_proc_sql => ( - is => 'rw', -); -has output_db => ( - is => 'rw', -); -has source_schema => ( - is => 'rw', -); -has target_schema => ( - is => 'rw', -); -has case_insensitive => ( - is => 'rw', -); -has no_batch_alters => ( - is => 'rw', -); -has ignore_missing_methods => ( - is => 'rw', -); +has ignore_index_names => (is => 'rw',); +has ignore_constraint_names => (is => 'rw',); +has ignore_view_sql => (is => 'rw',); +has ignore_proc_sql => (is => 'rw',); +has output_db => (is => 'rw',); +has source_schema => (is => 'rw',); +has target_schema => (is => 'rw',); +has case_insensitive => (is => 'rw',); +has no_batch_alters => (is => 'rw',); +has ignore_missing_methods => (is => 'rw',); has sqlt_args => ( - is => 'rw', - lazy => 1, + is => 'rw', + lazy => 1, default => quote_sub '{}', ); has tables_to_drop => ( - is => 'rw', - lazy => 1, + is => 'rw', + lazy => 1, default => quote_sub '[]', ); has tables_to_create => ( - is => 'rw', - lazy => 1, + is => 'rw', + lazy => 1, default => quote_sub '[]', ); has table_diff_hash => ( - is => 'rw', - lazy => 1, + is => 'rw', + lazy => 1, default => quote_sub '{}', ); my @diff_arrays = qw/ - tables_to_drop - tables_to_create -/; + tables_to_drop + tables_to_create + /; my @diff_hash_keys = qw/ - constraints_to_create - constraints_to_drop - indexes_to_create - indexes_to_drop - fields_to_create - fields_to_alter - fields_to_rename - fields_to_drop - table_options - table_renamed_from -/; + constraints_to_create + constraints_to_drop + indexes_to_create + indexes_to_drop + fields_to_create + fields_to_alter + fields_to_rename + fields_to_drop + table_options + table_renamed_from + /; sub schema_diff { - # use Data::Dumper; - ## we are getting instructions on how to turn the source into the target - ## source == original, target == new (hmm, if I need to comment this, should I rename the vars again ??) - ## _schema isa SQL::Translator::Schema - ## _db is the name of the producer/db it came out of/into - ## results are formatted to the source preferences - - my ($source_schema, $source_db, $target_schema, $output_db, $options) = @_; - $options ||= {}; - - my $obj = SQL::Translator::Diff->new( { - %$options, - source_schema => $source_schema, - target_schema => $target_schema, - output_db => $output_db - } ); - - $obj->compute_differences->produce_diff_sql; + + # use Data::Dumper; + ## we are getting instructions on how to turn the source into the target + ## source == original, target == new (hmm, if I need to comment this, should I rename the vars again ??) + ## _schema isa SQL::Translator::Schema + ## _db is the name of the producer/db it came out of/into + ## results are formatted to the source preferences + + my ($source_schema, $source_db, $target_schema, $output_db, $options) = @_; + $options ||= {}; + + my $obj = SQL::Translator::Diff->new({ + %$options, + source_schema => $source_schema, + target_schema => $target_schema, + output_db => $output_db + }); + + $obj->compute_differences->produce_diff_sql; } my $warned_dep; + sub BUILD { my ($self, $args) = @_; for my $deprecated (qw/producer_options producer_args/) { if ($args->{$deprecated}) { - carp "$deprecated is deprecated -- it does not go straight to the producer, it goes to the internal sqlt object. Please use sqlt_args, which reflects how it's used" unless $warned_dep++; - $self->sqlt_args({ - %{$args->{$deprecated}}, - %{$self->sqlt_args} - }); + carp + "$deprecated is deprecated -- it does not go straight to the producer, it goes to the internal sqlt object. Please use sqlt_args, which reflects how it's used" + unless $warned_dep++; + $self->sqlt_args({ %{ $args->{$deprecated} }, %{ $self->sqlt_args } }); } } - if (! $self->output_db) { - $self->output_db($args->{source_db}) + if (!$self->output_db) { + $self->output_db($args->{source_db}); } } sub compute_differences { - my ($self) = @_; + my ($self) = @_; - my $target_schema = $self->target_schema; - my $source_schema = $self->source_schema; + my $target_schema = $self->target_schema; + my $source_schema = $self->source_schema; - my $producer_class = "SQL::Translator::Producer::@{[$self->output_db]}"; - eval "require $producer_class"; - die $@ if $@; + my $producer_class = "SQL::Translator::Producer::@{[$self->output_db]}"; + eval "require $producer_class"; + die $@ if $@; - if (my $preprocess = $producer_class->can('preprocess_schema')) { - $preprocess->($source_schema); - $preprocess->($target_schema); - } + if (my $preprocess = $producer_class->can('preprocess_schema')) { + $preprocess->($source_schema); + $preprocess->($target_schema); + } - my %src_tables_checked = (); - my @tar_tables = sort { $a->name cmp $b->name } $target_schema->get_tables; - ## do original/source tables exist in target? - for my $tar_table ( @tar_tables ) { - my $tar_table_name = $tar_table->name; + my %src_tables_checked = (); + my @tar_tables = sort { $a->name cmp $b->name } $target_schema->get_tables; + ## do original/source tables exist in target? + for my $tar_table (@tar_tables) { + my $tar_table_name = $tar_table->name; - my $src_table; + my $src_table; - $self->table_diff_hash->{$tar_table_name} = { - map {$_ => [] } @diff_hash_keys - }; + $self->table_diff_hash->{$tar_table_name} = { map { $_ => [] } @diff_hash_keys }; - if (my $old_name = $tar_table->extra('renamed_from')) { - $src_table = $source_schema->get_table( $old_name, $self->case_insensitive ); - if ($src_table) { - $self->table_diff_hash->{$tar_table_name}{table_renamed_from} = [ [$src_table, $tar_table] ]; - } else { - delete $tar_table->extra->{renamed_from}; - carp qq#Renamed table can't find old table "$old_name" for renamed table\n#; - } + if (my $old_name = $tar_table->extra('renamed_from')) { + $src_table = $source_schema->get_table($old_name, $self->case_insensitive); + if ($src_table) { + $self->table_diff_hash->{$tar_table_name}{table_renamed_from} = [ [ $src_table, $tar_table ] ]; } else { - $src_table = $source_schema->get_table( $tar_table_name, $self->case_insensitive ); - } - - unless ( $src_table ) { - ## table is new - ## add table(s) later. - push @{$self->tables_to_create}, $tar_table; - next; + delete $tar_table->extra->{renamed_from}; + carp qq#Renamed table can't find old table "$old_name" for renamed table\n#; } + } else { + $src_table = $source_schema->get_table($tar_table_name, $self->case_insensitive); + } - my $src_table_name = $src_table->name; - $src_table_name = lc $src_table_name if $self->case_insensitive; - $src_tables_checked{$src_table_name} = 1; + unless ($src_table) { + ## table is new + ## add table(s) later. + push @{ $self->tables_to_create }, $tar_table; + next; + } + my $src_table_name = $src_table->name; + $src_table_name = lc $src_table_name if $self->case_insensitive; + $src_tables_checked{$src_table_name} = 1; - $self->diff_table_options($src_table, $tar_table); + $self->diff_table_options($src_table, $tar_table); - ## Compare fields, their types, defaults, sizes etc etc - $self->diff_table_fields($src_table, $tar_table); + ## Compare fields, their types, defaults, sizes etc etc + $self->diff_table_fields($src_table, $tar_table); - $self->diff_table_indexes($src_table, $tar_table); - $self->diff_table_constraints($src_table, $tar_table); + $self->diff_table_indexes($src_table, $tar_table); + $self->diff_table_constraints($src_table, $tar_table); - } # end of target_schema->get_tables loop + } # end of target_schema->get_tables loop - for my $src_table ( $source_schema->get_tables ) { - my $src_table_name = $src_table->name; + for my $src_table ($source_schema->get_tables) { + my $src_table_name = $src_table->name; - $src_table_name = lc $src_table_name if $self->case_insensitive; + $src_table_name = lc $src_table_name if $self->case_insensitive; - push @{ $self->tables_to_drop}, $src_table + push @{ $self->tables_to_drop }, $src_table unless $src_tables_checked{$src_table_name}; - } + } - return $self; + return $self; } sub produce_diff_sql { - my ($self) = @_; - - my $target_schema = $self->target_schema; - my $source_schema = $self->source_schema; - my $tar_name = $target_schema->name; - my $src_name = $source_schema->name; - - my $producer_class = "SQL::Translator::Producer::@{[$self->output_db]}"; - eval "require $producer_class"; - die $@ if $@; - - # Map of name we store under => producer method name - my %func_map = ( - constraints_to_create => 'alter_create_constraint', - constraints_to_drop => 'alter_drop_constraint', - indexes_to_create => 'alter_create_index', - indexes_to_drop => 'alter_drop_index', - fields_to_create => 'add_field', - fields_to_alter => 'alter_field', - fields_to_rename => 'rename_field', - fields_to_drop => 'drop_field', - table_options => 'alter_table', - table_renamed_from => 'rename_table', - ); - my @diffs; - - if (!$self->no_batch_alters && - (my $batch_alter = $producer_class->can('batch_alter_table')) ) - { - # Good - Producer supports batch altering of tables. - foreach my $table ( sort keys %{$self->table_diff_hash} ) { - my $tar_table = $target_schema->get_table($table) - || $source_schema->get_table($table); - - push @diffs, $batch_alter->($tar_table, - { map { - $func_map{$_} => $self->table_diff_hash->{$table}{$_} - } keys %func_map - }, - $self->sqlt_args - ); + my ($self) = @_; + + my $target_schema = $self->target_schema; + my $source_schema = $self->source_schema; + my $tar_name = $target_schema->name; + my $src_name = $source_schema->name; + + my $producer_class = "SQL::Translator::Producer::@{[$self->output_db]}"; + eval "require $producer_class"; + die $@ if $@; + + # Map of name we store under => producer method name + my %func_map = ( + constraints_to_create => 'alter_create_constraint', + constraints_to_drop => 'alter_drop_constraint', + indexes_to_create => 'alter_create_index', + indexes_to_drop => 'alter_drop_index', + fields_to_create => 'add_field', + fields_to_alter => 'alter_field', + fields_to_rename => 'rename_field', + fields_to_drop => 'drop_field', + table_options => 'alter_table', + table_renamed_from => 'rename_table', + ); + my @diffs; + + if (!$self->no_batch_alters + && (my $batch_alter = $producer_class->can('batch_alter_table'))) { + # Good - Producer supports batch altering of tables. + foreach my $table (sort keys %{ $self->table_diff_hash }) { + my $tar_table = $target_schema->get_table($table) + || $source_schema->get_table($table); + + push @diffs, + $batch_alter->( + $tar_table, + { + map { $func_map{$_} => $self->table_diff_hash->{$table}{$_} } keys %func_map + }, + $self->sqlt_args + ); + } + } else { + + # If we have any table renames we need to do those first; + my %flattened_diffs; + foreach my $table (sort keys %{ $self->table_diff_hash }) { + my $table_diff = $self->table_diff_hash->{$table}; + for (@diff_hash_keys) { + push(@{ $flattened_diffs{ $func_map{$_} } ||= [] }, @{ $table_diff->{$_} }); } - } else { + } - # If we have any table renames we need to do those first; - my %flattened_diffs; - foreach my $table ( sort keys %{$self->table_diff_hash} ) { - my $table_diff = $self->table_diff_hash->{$table}; - for (@diff_hash_keys) { - push( @{ $flattened_diffs{ $func_map{$_} } ||= [] }, @{ $table_diff->{$_} } ); + push @diffs, map({ + if (@{ $flattened_diffs{$_} || [] }) { + my $meth = $producer_class->can($_); + + $meth + ? map { + map { $_ ? "$_" : () } $meth->((ref $_ eq 'ARRAY' ? @$_ : $_), $self->sqlt_args); + } @{ $flattened_diffs{$_} } + : $self->ignore_missing_methods ? "-- $producer_class cant $_" + : die "$producer_class cant $_"; + } else { + () } - } - push @diffs, map( { - if (@{ $flattened_diffs{$_} || [] }) { - my $meth = $producer_class->can($_); - - $meth ? map { - map { $_ ? "$_" : () } $meth->( (ref $_ eq 'ARRAY' ? @$_ : $_), $self->sqlt_args ); - } @{ $flattened_diffs{$_} } - : $self->ignore_missing_methods - ? "-- $producer_class cant $_" - : die "$producer_class cant $_"; - } else { () } - - } qw/rename_table - alter_drop_constraint - alter_drop_index - drop_field - add_field - alter_field - rename_field - alter_create_index - alter_create_constraint - alter_table/), - } + } qw/rename_table + alter_drop_constraint + alter_drop_index + drop_field + add_field + alter_field + rename_field + alter_create_index + alter_create_constraint + alter_table/), + ; + } - if (my @tables = @{ $self->tables_to_create } ) { - my $translator = SQL::Translator->new( - producer_type => $self->output_db, - add_drop_table => 0, - no_comments => 1, - # TODO: sort out options - %{ $self->sqlt_args } - ); - $translator->producer_args->{no_transaction} = 1; - my $schema = $translator->schema; + if (my @tables = @{ $self->tables_to_create }) { + my $translator = SQL::Translator->new( + producer_type => $self->output_db, + add_drop_table => 0, + no_comments => 1, + + # TODO: sort out options + %{ $self->sqlt_args } + ); + $translator->producer_args->{no_transaction} = 1; + my $schema = $translator->schema; - $schema->add_table($_) for @tables; + $schema->add_table($_) for @tables; + + unshift @diffs, - unshift @diffs, # Remove begin/commit here, since we wrap everything in one. - grep { $_ !~ /^(?:COMMIT|START(?: TRANSACTION)?|BEGIN(?: TRANSACTION)?)/ } $producer_class->can('produce')->($translator); - } + grep { $_ !~ /^(?:COMMIT|START(?: TRANSACTION)?|BEGIN(?: TRANSACTION)?)/ } + $producer_class->can('produce')->($translator); + } - if (my @tables_to_drop = @{ $self->{tables_to_drop} || []} ) { - my $meth = $producer_class->can('drop_table'); + if (my @tables_to_drop = @{ $self->{tables_to_drop} || [] }) { + my $meth = $producer_class->can('drop_table'); - push @diffs, $meth ? ( map { $meth->($_, $self->sqlt_args) } @tables_to_drop) - : $self->ignore_missing_methods - ? "-- $producer_class cant drop_table" - : die "$producer_class cant drop_table"; - } + push @diffs, + $meth ? (map { $meth->($_, $self->sqlt_args) } @tables_to_drop) + : $self->ignore_missing_methods ? "-- $producer_class cant drop_table" + : die "$producer_class cant drop_table"; + } - if (@diffs) { - unshift @diffs, "BEGIN"; - push @diffs, "\nCOMMIT"; - } else { - @diffs = ("-- No differences found"); - } + if (@diffs) { + unshift @diffs, "BEGIN"; + push @diffs, "\nCOMMIT"; + } else { + @diffs = ("-- No differences found"); + } - if ( @diffs ) { - if ( $self->output_db !~ /^(?:MySQL|SQLite|PostgreSQL)$/ ) { - unshift(@diffs, "-- Output database @{[$self->output_db]} is untested/unsupported!!!"); - } + if (@diffs) { + if ($self->output_db !~ /^(?:MySQL|SQLite|PostgreSQL)$/) { + unshift(@diffs, "-- Output database @{[$self->output_db]} is untested/unsupported!!!"); + } - my @return = - map { $_ ? ( $_ =~ /;\s*\z/xms ? $_ : "$_;\n\n" ) : "\n" } + my @return = map { $_ ? ($_ =~ /;\s*\z/xms ? $_ : "$_;\n\n") : "\n" } ("-- Convert schema '$src_name' to '$tar_name':", @diffs); - return wantarray ? @return : join('', @return); - } - return undef; + return wantarray ? @return : join('', @return); + } + return undef; } @@ -323,40 +305,40 @@ sub diff_table_indexes { my ($self, $src_table, $tar_table) = @_; my (%checked_indices); - INDEX_CREATE: - for my $i_tar ( $tar_table->get_indices ) { - for my $i_src ( $src_table->get_indices ) { - if ( $i_tar->equals($i_src, $self->case_insensitive, $self->ignore_index_names) ) { +INDEX_CREATE: + for my $i_tar ($tar_table->get_indices) { + for my $i_src ($src_table->get_indices) { + if ($i_tar->equals($i_src, $self->case_insensitive, $self->ignore_index_names)) { $checked_indices{$i_src} = 1; next INDEX_CREATE; } } - push @{$self->table_diff_hash->{$tar_table}{indexes_to_create}}, $i_tar; + push @{ $self->table_diff_hash->{$tar_table}{indexes_to_create} }, $i_tar; } - INDEX_DROP: - for my $i_src ( $src_table->get_indices ) { +INDEX_DROP: + for my $i_src ($src_table->get_indices) { next if !$self->ignore_index_names && $checked_indices{$i_src}; - for my $i_tar ( $tar_table->get_indices ) { - next INDEX_DROP if $i_src->equals($i_tar, $self->case_insensitive, $self->ignore_index_names); + for my $i_tar ($tar_table->get_indices) { + next INDEX_DROP + if $i_src->equals($i_tar, $self->case_insensitive, $self->ignore_index_names); } - push @{$self->table_diff_hash->{$tar_table}{indexes_to_drop}}, $i_src; + push @{ $self->table_diff_hash->{$tar_table}{indexes_to_drop} }, $i_src; } } - sub diff_table_constraints { my ($self, $src_table, $tar_table) = @_; - my(%checked_constraints); - CONSTRAINT_CREATE: - for my $c_tar ( $tar_table->get_constraints ) { - for my $c_src ( $src_table->get_constraints ) { + my (%checked_constraints); +CONSTRAINT_CREATE: + for my $c_tar ($tar_table->get_constraints) { + for my $c_src ($src_table->get_constraints) { # This is a bit of a hack - needed for renaming tables to work local $c_src->{table} = $tar_table; - if ( $c_tar->equals($c_src, $self->case_insensitive, $self->ignore_constraint_names) ) { + if ($c_tar->equals($c_src, $self->case_insensitive, $self->ignore_constraint_names)) { $checked_constraints{$c_src} = 1; next CONSTRAINT_CREATE; } @@ -364,16 +346,16 @@ sub diff_table_constraints { push @{ $self->table_diff_hash->{$tar_table}{constraints_to_create} }, $c_tar; } - - CONSTRAINT_DROP: - for my $c_src ( $src_table->get_constraints ) { +CONSTRAINT_DROP: + for my $c_src ($src_table->get_constraints) { # This is a bit of a hack - needed for renaming tables to work local $c_src->{table} = $tar_table; next if !$self->ignore_constraint_names && $checked_constraints{$c_src}; - for my $c_tar ( $tar_table->get_constraints ) { - next CONSTRAINT_DROP if $c_src->equals($c_tar, $self->case_insensitive, $self->ignore_constraint_names); + for my $c_tar ($tar_table->get_constraints) { + next CONSTRAINT_DROP + if $c_src->equals($c_tar, $self->case_insensitive, $self->ignore_constraint_names); } push @{ $self->table_diff_hash->{$tar_table}{constraints_to_drop} }, $c_src; @@ -387,52 +369,51 @@ sub diff_table_fields { # List of ones we've renamed from so we don't drop them my %renamed_source_fields; - for my $tar_table_field ( $tar_table->get_fields ) { - my $f_tar_name = $tar_table_field->name; + for my $tar_table_field ($tar_table->get_fields) { + my $f_tar_name = $tar_table_field->name; if (my $old_name = $tar_table_field->extra->{renamed_from}) { - my $src_table_field = $src_table->get_field( $old_name, $self->case_insensitive ); + my $src_table_field = $src_table->get_field($old_name, $self->case_insensitive); unless ($src_table_field) { carp qq#Renamed column can't find old column "@{[$src_table->name]}.$old_name" for renamed column\n#; delete $tar_table_field->extra->{renamed_from}; } else { - push @{$self->table_diff_hash->{$tar_table}{fields_to_rename} }, [ $src_table_field, $tar_table_field ]; + push @{ $self->table_diff_hash->{$tar_table}{fields_to_rename} }, [ $src_table_field, $tar_table_field ]; $renamed_source_fields{$old_name} = 1; next; } } - my $src_table_field = $src_table->get_field( $f_tar_name, $self->case_insensitive ); + my $src_table_field = $src_table->get_field($f_tar_name, $self->case_insensitive); - unless ( $src_table_field ) { - push @{$self->table_diff_hash->{$tar_table}{fields_to_create}}, $tar_table_field; + unless ($src_table_field) { + push @{ $self->table_diff_hash->{$tar_table}{fields_to_create} }, $tar_table_field; next; } # field exists, something changed. This is a bit complex. Parsers can # normalize types, but only some of them do, so compare the normalized and # parsed types for each field to each other - if ( !$tar_table_field->equals($src_table_field, $self->case_insensitive) && - !$tar_table_field->equals($src_table_field->parsed_field, $self->case_insensitive) && - !$tar_table_field->parsed_field->equals($src_table_field, $self->case_insensitive) && - !$tar_table_field->parsed_field->equals($src_table_field->parsed_field, $self->case_insensitive) ) { + if ( !$tar_table_field->equals($src_table_field, $self->case_insensitive) + && !$tar_table_field->equals($src_table_field->parsed_field, $self->case_insensitive) + && !$tar_table_field->parsed_field->equals($src_table_field, $self->case_insensitive) + && !$tar_table_field->parsed_field->equals($src_table_field->parsed_field, $self->case_insensitive)) { # Some producers might need src field to diff against - push @{$self->table_diff_hash->{$tar_table}{fields_to_alter}}, [ $src_table_field, $tar_table_field ]; + push @{ $self->table_diff_hash->{$tar_table}{fields_to_alter} }, [ $src_table_field, $tar_table_field ]; next; } } - # Now check to see if any fields from src_table need to be dropped - for my $src_table_field ( $src_table->get_fields ) { - my $f_src_name = $src_table_field->name; + for my $src_table_field ($src_table->get_fields) { + my $f_src_name = $src_table_field->name; next if $renamed_source_fields{$f_src_name}; - my $tar_table_field = $tar_table->get_field( $f_src_name, $self->case_insensitive ); + my $tar_table_field = $tar_table->get_field($f_src_name, $self->case_insensitive); - unless ( $tar_table_field ) { - push @{$self->table_diff_hash->{$tar_table}{fields_to_drop}}, $src_table_field; + unless ($tar_table_field) { + push @{ $self->table_diff_hash->{$tar_table}{fields_to_drop} }, $src_table_field; next; } } @@ -442,32 +423,32 @@ sub diff_table_options { my ($self, $src_table, $tar_table) = @_; my $cmp = sub { - my ($a_name, undef, $b_name, undef) = ( %$a, %$b ); + my ($a_name, undef, $b_name, undef) = (%$a, %$b); $a_name cmp $b_name; }; + # Need to sort the options so we don't get spurious diffs. my (@src_opts, @tar_opts); @src_opts = sort $cmp $src_table->options; @tar_opts = sort $cmp $tar_table->options; - # If there's a difference, just re-set all the options push @{ $self->table_diff_hash->{$tar_table}{table_options} }, $tar_table - unless $src_table->_compare_objects( \@src_opts, \@tar_opts ); + unless $src_table->_compare_objects(\@src_opts, \@tar_opts); } # support producer_options as an alias for sqlt_args for legacy code. sub producer_options { my $self = shift; - return $self->sqlt_args( @_ ); + return $self->sqlt_args(@_); } # support producer_args as an alias for sqlt_args for legacy code. sub producer_args { my $self = shift; - return $self->sqlt_args( @_ ); + return $self->sqlt_args(@_); } 1; diff --git a/lib/SQL/Translator/Filter/DefaultExtra.pm b/lib/SQL/Translator/Filter/DefaultExtra.pm index b1eb3b8bf..37efaafe5 100644 --- a/lib/SQL/Translator/Filter/DefaultExtra.pm +++ b/lib/SQL/Translator/Filter/DefaultExtra.pm @@ -36,24 +36,24 @@ use warnings; our $VERSION = '1.64'; sub filter { - my $schema = shift; - my %args = { +shift }; + my $schema = shift; + my %args = { +shift }; - # Tables - foreach ( $schema->get_tables ) { - my %extra = $_->extra; + # Tables + foreach ($schema->get_tables) { + my %extra = $_->extra; - $extra{label} ||= ucfirst($_->name); - $_->extra( %extra ); - } + $extra{label} ||= ucfirst($_->name); + $_->extra(%extra); + } - # Fields - foreach ( map { $_->get_fields } $schema->get_tables ) { - my %extra = $_->extra; + # Fields + foreach (map { $_->get_fields } $schema->get_tables) { + my %extra = $_->extra; - $extra{label} ||= ucfirst($_->name); - $_->extra( %extra ); - } + $extra{label} ||= ucfirst($_->name); + $_->extra(%extra); + } } 1; diff --git a/lib/SQL/Translator/Filter/Globals.pm b/lib/SQL/Translator/Filter/Globals.pm index b74123f53..120cd3254 100644 --- a/lib/SQL/Translator/Filter/Globals.pm +++ b/lib/SQL/Translator/Filter/Globals.pm @@ -41,86 +41,91 @@ use warnings; our $VERSION = '1.64'; sub filter { - my $schema = shift; - my %args = @_; - my $global_table = $args{global_table} ||= '_GLOBAL_'; - - my (@global_fields, @global_indices, @global_constraints); - push @global_fields, @{ $args{fields} } if $args{fields}; - push @global_indices, @{ $args{indices} } if $args{indices}; - push @global_constraints, @{ $args{constraints} } if $args{constraints}; - - # Pull fields and indices off global table and then remove it. - if ( my $gtbl = $schema->get_table( $global_table ) ) { - - foreach ( $gtbl->get_fields ) { - # We don't copy the order attrib so the added fields should get - # pushed on the end of each table. - push @global_fields, { - name => $_->name, - comments => "".$_->comments, - data_type => $_->data_type, - default_value => $_->default_value, - size => [$_->size], - extra => scalar($_->extra), - foreign_key_reference => $_->foreign_key_reference, - is_auto_increment => $_->is_auto_increment, - is_foreign_key => $_->is_foreign_key, - is_nullable => $_->is_nullable, - is_primary_key => $_->is_primary_key, - is_unique => $_->is_unique, - is_valid => $_->is_valid, - }; - } - - foreach ( $gtbl->get_indices ) { - push @global_indices, { - name => $_->name, - type => $_->type, - fields => [$_->fields], - options => [$_->options], - extra => scalar($_->extra), - }; - } - - foreach ( $gtbl->get_constraints ) { - push @global_constraints, { - name => $_->name, - fields => [$_->fields], - deferrable => $_->deferrable, - expression => $_->expression, - match_type => $_->match_type, - options => [$_->options], - on_delete => $_->on_delete, - on_update => $_->on_update, - reference_fields => [$_->reference_fields], - reference_table => $_->reference_table, - table => $_->table, - type => $_->type, - extra => scalar($_->extra), - }; - } - - $schema->drop_table($gtbl); + my $schema = shift; + my %args = @_; + my $global_table = $args{global_table} ||= '_GLOBAL_'; + + my (@global_fields, @global_indices, @global_constraints); + push @global_fields, @{ $args{fields} } if $args{fields}; + push @global_indices, @{ $args{indices} } if $args{indices}; + push @global_constraints, @{ $args{constraints} } if $args{constraints}; + + # Pull fields and indices off global table and then remove it. + if (my $gtbl = $schema->get_table($global_table)) { + + foreach ($gtbl->get_fields) { + + # We don't copy the order attrib so the added fields should get + # pushed on the end of each table. + push @global_fields, + { + name => $_->name, + comments => "" . $_->comments, + data_type => $_->data_type, + default_value => $_->default_value, + size => [ $_->size ], + extra => scalar($_->extra), + foreign_key_reference => $_->foreign_key_reference, + is_auto_increment => $_->is_auto_increment, + is_foreign_key => $_->is_foreign_key, + is_nullable => $_->is_nullable, + is_primary_key => $_->is_primary_key, + is_unique => $_->is_unique, + is_valid => $_->is_valid, + }; } - # Add globals to tables - foreach my $tbl ( $schema->get_tables ) { + foreach ($gtbl->get_indices) { + push @global_indices, + { + name => $_->name, + type => $_->type, + fields => [ $_->fields ], + options => [ $_->options ], + extra => scalar($_->extra), + }; + } + + foreach ($gtbl->get_constraints) { + push @global_constraints, + { + name => $_->name, + fields => [ $_->fields ], + deferrable => $_->deferrable, + expression => $_->expression, + match_type => $_->match_type, + options => [ $_->options ], + on_delete => $_->on_delete, + on_update => $_->on_update, + reference_fields => [ $_->reference_fields ], + reference_table => $_->reference_table, + table => $_->table, + type => $_->type, + extra => scalar($_->extra), + }; + } + + $schema->drop_table($gtbl); + } - foreach my $new_fld ( @global_fields ) { - # Don't add if field already there - next if $tbl->get_field( $new_fld->{name} ); - $tbl->add_field( %$new_fld ); - } + # Add globals to tables + foreach my $tbl ($schema->get_tables) { - foreach my $new_index ( @global_indices ) { - $tbl->add_index( %$new_index ); - } + foreach my $new_fld (@global_fields) { + + # Don't add if field already there + next if $tbl->get_field($new_fld->{name}); + $tbl->add_field(%$new_fld); + } + + foreach my $new_index (@global_indices) { + $tbl->add_index(%$new_index); + } - foreach my $new_constraint ( @global_constraints ) { - $tbl->add_constraint( %$new_constraint ); - } + foreach my $new_constraint (@global_constraints) { + $tbl->add_constraint(%$new_constraint); } + } } 1; diff --git a/lib/SQL/Translator/Filter/Names.pm b/lib/SQL/Translator/Filter/Names.pm index 2ae16e51a..798bc4797 100644 --- a/lib/SQL/Translator/Filter/Names.pm +++ b/lib/SQL/Translator/Filter/Names.pm @@ -32,26 +32,25 @@ use warnings; our $VERSION = '1.64'; sub filter { - my $schema = shift; - my %args = %{$_[0]}; - - # Tables - #if ( my $func = $args{tables} ) { - # _filtername($_,$func) foreach ( $schema->get_tables ); - #} - # , - foreach my $type ( qw/tables procedures triggers views/ ) { - if ( my $func = $args{$type} ) { - my $meth = "get_$type"; - _filtername($_,$func) foreach $schema->$meth; - } + my $schema = shift; + my %args = %{ $_[0] }; + + # Tables + #if ( my $func = $args{tables} ) { + # _filtername($_,$func) foreach ( $schema->get_tables ); + #} + # , + foreach my $type (qw/tables procedures triggers views/) { + if (my $func = $args{$type}) { + my $meth = "get_$type"; + _filtername($_, $func) foreach $schema->$meth; } + } - # Fields - if ( my $func = $args{fields} ) { - _filtername($_,$func) - foreach map { $_->get_fields } $schema->get_tables ; - } + # Fields + if (my $func = $args{fields}) { + _filtername($_, $func) foreach map { $_->get_fields } $schema->get_tables; + } } @@ -60,36 +59,34 @@ sub filter { # Objects with no name are skipped. # Returns true if the name was changed. Dies if there is an error running func. sub _filtername { - my ($obj,$func) = @_; - return unless my $name = $obj->name; - $func = _getfunc($func); - my $newname = eval { $func->($name) }; - die "$@" if $@; # TODO - Better message! - return if $name eq $newname; - $_->name($newname); + my ($obj, $func) = @_; + return unless my $name = $obj->name; + $func = _getfunc($func); + my $newname = eval { $func->($name) }; + die "$@" if $@; # TODO - Better message! + return if $name eq $newname; + $_->name($newname); } # _getfunc( NAME ) - Returns code ref to func NAME or dies. sub _getfunc { - my ($name) = @_; - no strict 'refs'; - my $func = "SQL::Translator::Filter::Names::$name"; - die "Table name filter - unknown function '$name'\n" unless exists &$func; - \&$func; + my ($name) = @_; + no strict 'refs'; + my $func = "SQL::Translator::Filter::Names::$name"; + die "Table name filter - unknown function '$name'\n" unless exists &$func; + \&$func; } - - # The name munging functions #============================================================================= # Get called with name to munge as first arg and return the new name. Die on # errors. -sub lc { lc shift; } -sub uc { uc shift; } +sub lc { lc shift; } +sub uc { uc shift; } sub ucfirst { ucfirst shift; } -1; #========================================================================== +1; #========================================================================== __END__ diff --git a/lib/SQL/Translator/Generator/DDL/MySQL.pm b/lib/SQL/Translator/Generator/DDL/MySQL.pm index b4e0b18f5..49fee6f34 100644 --- a/lib/SQL/Translator/Generator/DDL/MySQL.pm +++ b/lib/SQL/Translator/Generator/DDL/MySQL.pm @@ -13,10 +13,10 @@ I use Moo; -has quote_chars => ( is => 'ro', default => sub { +[qw(` `)] } ); +has quote_chars => (is => 'ro', default => sub { +[qw(` `)] }); with 'SQL::Translator::Generator::Role::Quote'; -sub name_sep { q(.) } +sub name_sep {q(.)} 1; diff --git a/lib/SQL/Translator/Generator/DDL/PostgreSQL.pm b/lib/SQL/Translator/Generator/DDL/PostgreSQL.pm index 109eb3cf9..337c2f6e1 100644 --- a/lib/SQL/Translator/Generator/DDL/PostgreSQL.pm +++ b/lib/SQL/Translator/Generator/DDL/PostgreSQL.pm @@ -14,14 +14,14 @@ I use Moo; has quote_chars => ( - is => 'rw', + is => 'rw', default => sub { +[qw(" ")] }, trigger => sub { $_[0]->clear_escape_char }, ); with 'SQL::Translator::Generator::Role::Quote'; -sub name_sep { q(.) } +sub name_sep {q(.)} 1; diff --git a/lib/SQL/Translator/Generator/DDL/SQLServer.pm b/lib/SQL/Translator/Generator/DDL/SQLServer.pm index 72212295b..c738e26ff 100644 --- a/lib/SQL/Translator/Generator/DDL/SQLServer.pm +++ b/lib/SQL/Translator/Generator/DDL/SQLServer.pm @@ -18,225 +18,218 @@ with 'SQL::Translator::Generator::Role::Quote'; with 'SQL::Translator::Generator::Role::DDL'; sub quote_chars { [qw([ ])] } -sub name_sep { q(.) } +sub name_sep {q(.)} sub _build_numeric_types { - +{ - int => 1, - } + +{ int => 1, }; } sub _build_unquoted_defaults { - +{ - NULL => 1, - } + +{ NULL => 1, }; } sub _build_type_map { - +{ - date => 'datetime', - 'time' => 'datetime', - } + +{ + date => 'datetime', + 'time' => 'datetime', + }; } sub _build_sizeless_types { - +{ map { $_ => 1 } - qw( tinyint smallint int integer bigint text bit image datetime ) } + +{ map { $_ => 1 } qw( tinyint smallint int integer bigint text bit image datetime ) }; } sub field { - my ($self, $field) = @_; + my ($self, $field) = @_; - return join ' ', $self->field_name($field), ($self->field_type($field)||die 'type is required'), + return join ' ', $self->field_name($field), + ($self->field_type($field) || die 'type is required'), $self->field_autoinc($field), $self->field_nullable($field), - $self->field_default($field), + $self->field_default($field),; } -sub field_autoinc { ( $_[1]->is_auto_increment ? 'IDENTITY' : () ) } +sub field_autoinc { ($_[1]->is_auto_increment ? 'IDENTITY' : ()) } sub primary_key_constraint { - 'CONSTRAINT ' . - $_[0]->quote($_[1]->name || $_[1]->table->name . '_pk') . - ' PRIMARY KEY (' . - join( ', ', map $_[0]->quote($_), $_[1]->fields ) . - ')' + 'CONSTRAINT ' + . $_[0]->quote($_[1]->name || $_[1]->table->name . '_pk') + . ' PRIMARY KEY (' + . join(', ', map $_[0]->quote($_), $_[1]->fields) . ')'; } sub index { - 'CREATE INDEX ' . - $_[0]->quote($_[1]->name || $_[1]->table->name . '_idx') . - ' ON ' . $_[0]->quote($_[1]->table->name) . - ' (' . join( ', ', map $_[0]->quote($_), $_[1]->fields ) . ');' + 'CREATE INDEX ' + . $_[0]->quote($_[1]->name || $_[1]->table->name . '_idx') . ' ON ' + . $_[0]->quote($_[1]->table->name) . ' (' + . join(', ', map $_[0]->quote($_), $_[1]->fields) . ');'; } sub unique_constraint_single { my ($self, $constraint) = @_; - 'CONSTRAINT ' . - $self->unique_constraint_name($constraint) . - ' UNIQUE (' . join( ', ', map $self->quote($_), $constraint->fields ) . ')' + 'CONSTRAINT ' + . $self->unique_constraint_name($constraint) + . ' UNIQUE (' + . join(', ', map $self->quote($_), $constraint->fields) . ')'; } sub unique_constraint_name { my ($self, $constraint) = @_; - $self->quote($constraint->name || $constraint->table->name . '_uc' ) + $self->quote($constraint->name || $constraint->table->name . '_uc'); } sub unique_constraint_multiple { my ($self, $constraint) = @_; - 'CREATE UNIQUE NONCLUSTERED INDEX ' . - $self->unique_constraint_name($constraint) . - ' ON ' . $self->quote($constraint->table->name) . ' (' . - join( ', ', map $self->quote($_), $constraint->fields ) . ')' . - ' WHERE ' . join( ' AND ', - map $self->quote($_->name) . ' IS NOT NULL', - grep { $_->is_nullable } $constraint->fields ) . ';' + 'CREATE UNIQUE NONCLUSTERED INDEX ' + . $self->unique_constraint_name($constraint) . ' ON ' + . $self->quote($constraint->table->name) . ' (' + . join(', ', map $self->quote($_), $constraint->fields) . ')' + . ' WHERE ' + . join(' AND ', map $self->quote($_->name) . ' IS NOT NULL', grep { $_->is_nullable } $constraint->fields) . ';'; } sub foreign_key_constraint { my ($self, $constraint) = @_; - my $on_delete = uc ($constraint->on_delete || ''); - my $on_update = uc ($constraint->on_update || ''); + my $on_delete = uc($constraint->on_delete || ''); + my $on_update = uc($constraint->on_update || ''); # The default implicit constraint action in MSSQL is RESTRICT # but you can not specify it explicitly. Go figure :) for (map uc $_ || '', $on_delete, $on_update) { - undef $_ if $_ eq 'RESTRICT' + undef $_ if $_ eq 'RESTRICT'; } - 'ALTER TABLE ' . $self->quote($constraint->table->name) . - ' ADD CONSTRAINT ' . - $self->quote($constraint->name || $constraint->table->name . '_fk') . - ' FOREIGN KEY' . - ' (' . join( ', ', map $self->quote($_), $constraint->fields ) . ') REFERENCES '. - $self->quote($constraint->reference_table) . - ' (' . join( ', ', map $self->quote($_), $constraint->reference_fields ) . ')' - . ( - $on_delete && $on_delete ne "NO ACTION" - ? ' ON DELETE ' . $on_delete - : '' - ) . ( - $on_update && $on_update ne "NO ACTION" - ? ' ON UPDATE ' . $on_update - : '' - ) . ';'; + 'ALTER TABLE ' + . $self->quote($constraint->table->name) + . ' ADD CONSTRAINT ' + . $self->quote($constraint->name || $constraint->table->name . '_fk') + . ' FOREIGN KEY' . ' (' + . join(', ', map $self->quote($_), $constraint->fields) + . ') REFERENCES ' + . $self->quote($constraint->reference_table) . ' (' + . join(', ', map $self->quote($_), $constraint->reference_fields) . ')' + . ( + $on_delete && $on_delete ne "NO ACTION" ? ' ON DELETE ' . $on_delete + : '' + ) + . ( + $on_update && $on_update ne "NO ACTION" ? ' ON UPDATE ' . $on_update + : '' + ) . ';'; } sub enum_constraint_name { my ($self, $field_name) = @_; - $self->quote($field_name . '_chk' ) + $self->quote($field_name . '_chk'); } sub enum_constraint { - my ( $self, $field_name, $vals ) = @_; + my ($self, $field_name, $vals) = @_; - return ( - 'CONSTRAINT ' . $self->enum_constraint_name($field_name) . - ' CHECK (' . $self->quote($field_name) . - ' IN (' . join( ',', map $self->quote_string($_), @$vals ) . '))' - ) + return ('CONSTRAINT ' + . $self->enum_constraint_name($field_name) + . ' CHECK (' + . $self->quote($field_name) . ' IN (' + . join(',', map $self->quote_string($_), @$vals) + . '))'); } sub constraints { my ($self, $table) = @_; - (map $self->enum_constraint($_->name, { $_->extra }->{list} || []), - grep { 'enum' eq lc $_->data_type } $table->get_fields), + ( + map $self->enum_constraint($_->name, { $_->extra }->{list} || []), + grep { 'enum' eq lc $_->data_type } $table->get_fields + ), - (map $self->primary_key_constraint($_), - grep { $_->type eq PRIMARY_KEY } $table->get_constraints), + (map $self->primary_key_constraint($_), grep { $_->type eq PRIMARY_KEY } $table->get_constraints), - (map $self->unique_constraint_single($_), - grep { - $_->type eq UNIQUE && - !grep { $_->is_nullable } $_->fields - } $table->get_constraints), + ( + map $self->unique_constraint_single($_), + grep { + $_->type eq UNIQUE + && !grep { $_->is_nullable } + $_->fields + } $table->get_constraints + ), + ; } sub table { - my ($self, $table) = @_; - join ( "\n", $self->table_comments($table), '' ) . - join ( "\n\n", - 'CREATE TABLE ' . $self->quote($table->name) . " (\n". - join( ",\n", - map { " $_" } - $self->fields($table), - $self->constraints($table), - ) . - "\n);", - $self->unique_constraints_multiple($table), - $self->indices($table), - ) + my ($self, $table) = @_; + join("\n", $self->table_comments($table), '') + . join("\n\n", + 'CREATE TABLE ' + . $self->quote($table->name) . " (\n" + . join(",\n", map {" $_"} $self->fields($table), $self->constraints($table),) . "\n);", + $self->unique_constraints_multiple($table), $self->indices($table),); } sub unique_constraints_multiple { my ($self, $table) = @_; - (map $self->unique_constraint_multiple($_), - grep { - $_->type eq UNIQUE && - grep { $_->is_nullable } $_->fields - } $table->get_constraints) + ( + map $self->unique_constraint_multiple($_), + grep { + $_->type eq UNIQUE + && grep { $_->is_nullable } + $_->fields + } $table->get_constraints + ); } sub drop_table { - my ($self, $table) = @_; - my $name = $table->name; - my $q_name = $self->quote($name); - "IF EXISTS (SELECT name FROM sysobjects WHERE name = '$name' AND type = 'U')" . - " DROP TABLE $q_name;" + my ($self, $table) = @_; + my $name = $table->name; + my $q_name = $self->quote($name); + "IF EXISTS (SELECT name FROM sysobjects WHERE name = '$name' AND type = 'U')" . " DROP TABLE $q_name;"; } sub remove_table_constraints { - my ($self, $table) = @_; - my $name = $table->name; - my $q_name = $self->quote($name); - "IF EXISTS (SELECT name FROM sysobjects WHERE name = '$name' AND type = 'U')" . - " ALTER TABLE $q_name NOCHECK CONSTRAINT all;" + my ($self, $table) = @_; + my $name = $table->name; + my $q_name = $self->quote($name); + "IF EXISTS (SELECT name FROM sysobjects WHERE name = '$name' AND type = 'U')" + . " ALTER TABLE $q_name NOCHECK CONSTRAINT all;"; } sub drop_tables { - my ($self, $schema) = @_; - - if ($self->add_drop_table) { - my @tables = sort { $b->order <=> $a->order } $schema->get_tables; - return join "\n", ( - ( $self->add_comments ? ( - '--', - '-- Turn off constraints', - '--', - '', - ) : () ), - (map $self->remove_table_constraints($_), @tables), - ( $self->add_comments ? ( - '--', - '-- Drop tables', - '--', - '', - ) : () ), - (map $self->drop_table($_), @tables), - ) - } - return ''; + my ($self, $schema) = @_; + + if ($self->add_drop_table) { + my @tables = sort { $b->order <=> $a->order } $schema->get_tables; + return join "\n", + ( + ( + $self->add_comments + ? ('--', '-- Turn off constraints', '--', '',) + : () + ), + (map $self->remove_table_constraints($_), @tables), + ($self->add_comments ? ('--', '-- Drop tables', '--', '',) : ()), + (map $self->drop_table($_), @tables), + ); + } + return ''; } sub foreign_key_constraints { - my ($self, $schema) = @_; - ( map $self->foreign_key_constraint($_), - grep { $_->type eq FOREIGN_KEY } - map $_->get_constraints, - $schema->get_tables ) + my ($self, $schema) = @_; + ( + map $self->foreign_key_constraint($_), grep { $_->type eq FOREIGN_KEY } + map $_->get_constraints, $schema->get_tables + ); } sub schema { - my ($self, $schema) = @_; + my ($self, $schema) = @_; - $self->header_comments . - $self->drop_tables($schema) . - join("\n\n", map $self->table($_), grep { $_->name } $schema->get_tables) . - "\n" . join "\n", $self->foreign_key_constraints($schema) + $self->header_comments + . $self->drop_tables($schema) + . join("\n\n", map $self->table($_), grep { $_->name } $schema->get_tables) . "\n" + . join "\n", $self->foreign_key_constraints($schema); } 1; diff --git a/lib/SQL/Translator/Generator/DDL/SQLite.pm b/lib/SQL/Translator/Generator/DDL/SQLite.pm index afce4b3ab..86f2e3948 100644 --- a/lib/SQL/Translator/Generator/DDL/SQLite.pm +++ b/lib/SQL/Translator/Generator/DDL/SQLite.pm @@ -13,103 +13,103 @@ I use Moo; -has quote_chars => (is=>'ro', default=>sub { +[qw(" ")] } ); +has quote_chars => (is => 'ro', default => sub { +[qw(" ")] }); with 'SQL::Translator::Generator::Role::Quote'; with 'SQL::Translator::Generator::Role::DDL'; -sub name_sep { q(.) } +sub name_sep {q(.)} sub _build_type_map { - +{ - set => 'varchar', - bytea => 'blob', - } + +{ + set => 'varchar', + bytea => 'blob', + }; } sub _build_sizeless_types { - +{ - text => 1, - blob => 1, - } + +{ + text => 1, + blob => 1, + }; } + sub _build_numeric_types { - +{ - int => 1, - integer => 1, - tinyint => 1, - smallint => 1, - mediumint => 1, - bigint => 1, - 'unsigned big int' => 1, - int2 => 1, - int8 => 1, - numeric => 1, - decimal => 1, - boolean => 1, - real => 1, - double => 1, - 'double precision' => 1, - float => 1, - } + +{ + int => 1, + integer => 1, + tinyint => 1, + smallint => 1, + mediumint => 1, + bigint => 1, + 'unsigned big int' => 1, + int2 => 1, + int8 => 1, + numeric => 1, + decimal => 1, + boolean => 1, + real => 1, + double => 1, + 'double precision' => 1, + float => 1, + }; } sub _build_unquoted_defaults { - +{ - NULL => 1, - 'now()' => 1, - CURRENT_TIMESTAMP => 1, - } + +{ + NULL => 1, + 'now()' => 1, + CURRENT_TIMESTAMP => 1, + }; } sub nullable { () } sub _ipk { - my ($self, $field) = @_; + my ($self, $field) = @_; - my $pk = $field->table->primary_key; - my @pk_fields = $pk ? $pk->fields : (); + my $pk = $field->table->primary_key; + my @pk_fields = $pk ? $pk->fields : (); - $field->is_primary_key && scalar @pk_fields == 1 && - ( $field->data_type =~ /int(eger)?$/i - || - ( $field->data_type =~ /^number?$/i && $field->size !~ /,/ ) ) + $field->is_primary_key + && scalar @pk_fields == 1 + && ($field->data_type =~ /int(eger)?$/i + || ($field->data_type =~ /^number?$/i && $field->size !~ /,/)); } sub field_autoinc { - my ($self, $field) = @_; - - return ( - ( - ($field->extra->{auto_increment_type}||'') eq 'monotonic' - and - $self->_ipk($field) - and - $field->is_auto_increment - ) - ? 'AUTOINCREMENT' - : '' - ); + my ($self, $field) = @_; + + return ( + ( + ($field->extra->{auto_increment_type} || '') eq 'monotonic' + and $self->_ipk($field) + and $field->is_auto_increment + ) + ? 'AUTOINCREMENT' + : '' + ); } sub field { - my ($self, $field) = @_; + my ($self, $field) = @_; - - return join ' ', - $self->field_comments($field), - $self->field_name($field), - ( $self->_ipk($field) - ? ( 'INTEGER PRIMARY KEY' ) - : ( $self->field_type($field) ) + return join ' ', $self->field_comments($field), $self->field_name($field), + ( + $self->_ipk($field) + ? ('INTEGER PRIMARY KEY') + : ($self->field_type($field)) + ), + ($self->field_autoinc($field) || ()), $self->field_nullable($field), + $self->field_default( + $field, + { + NULL => 1, + 'now()' => 1, + 'CURRENT_TIMESTAMP' => 1, + } ), - ( $self->field_autoinc($field) || () ), - $self->field_nullable($field), - $self->field_default($field, { - NULL => 1, - 'now()' => 1, - 'CURRENT_TIMESTAMP' => 1, - }), + ; } 1; diff --git a/lib/SQL/Translator/Generator/Role/DDL.pm b/lib/SQL/Translator/Generator/Role/DDL.pm index 83c8647ce..86d171cfb 100644 --- a/lib/SQL/Translator/Generator/Role/DDL.pm +++ b/lib/SQL/Translator/Generator/Role/DDL.pm @@ -22,54 +22,36 @@ requires '_build_sizeless_types'; requires 'quote'; requires 'quote_string'; -has type_map => ( - is => 'lazy', -); +has type_map => (is => 'lazy',); -has numeric_types => ( - is => 'lazy', -); +has numeric_types => (is => 'lazy',); -has sizeless_types => ( - is => 'lazy', -); +has sizeless_types => (is => 'lazy',); -has unquoted_defaults => ( - is => 'lazy', -); +has unquoted_defaults => (is => 'lazy',); -has add_comments => ( - is => 'ro', -); +has add_comments => (is => 'ro',); -has add_drop_table => ( - is => 'ro', -); +has add_drop_table => (is => 'ro',); # would also be handy to have a required size set if there is such a thing sub field_name { $_[0]->quote($_[1]->name) } sub field_comments { - ( $_[1]->comments ? ('-- ' . $_[1]->comments . "\n ") : () ) + ($_[1]->comments ? ('-- ' . $_[1]->comments . "\n ") : ()) } sub table_comments { - my ($self, $table) = @_; - if ($self->add_comments) { - return ( - "", - "--", - "-- Table: " . $self->quote($table->name) . "", - "--", - map "-- $_", $table->comments - ) - } else { - return () - } + my ($self, $table) = @_; + if ($self->add_comments) { + return ("", "--", "-- Table: " . $self->quote($table->name) . "", "--", map "-- $_", $table->comments); + } else { + return (); + } } -sub field_nullable { ($_[1]->is_nullable ? $_[0]->nullable : 'NOT NULL' ) } +sub field_nullable { ($_[1]->is_nullable ? $_[0]->nullable : 'NOT NULL') } sub field_default { my ($self, $field, $exceptions) = @_; @@ -78,42 +60,45 @@ sub field_default { return () if !defined $default; $default = \"$default" - if $exceptions and !ref $default and $exceptions->{$default}; + if $exceptions + and !ref $default + and $exceptions->{$default}; if (ref $default) { - $default = $$default; - } elsif (!($self->numeric_types->{lc($field->data_type)} && Scalar::Util::looks_like_number ($default))) { - $default = $self->quote_string($default); + $default = $$default; + } elsif (!($self->numeric_types->{ lc($field->data_type) } && Scalar::Util::looks_like_number($default))) { + $default = $self->quote_string($default); } - return ( "DEFAULT $default" ) + return ("DEFAULT $default"); } sub field_type { - my ($self, $field) = @_; + my ($self, $field) = @_; - my $field_type = $field->data_type; - ($self->type_map->{$field_type} || $field_type).$self->field_type_size($field) + my $field_type = $field->data_type; + ($self->type_map->{$field_type} || $field_type) . $self->field_type_size($field); } sub field_type_size { - my ($self, $field) = @_; + my ($self, $field) = @_; - ($field->size && !$self->sizeless_types->{$field->data_type} - ? '(' . $field->size . ')' - : '' - ) + ( + $field->size && !$self->sizeless_types->{ $field->data_type } + ? '(' . $field->size . ')' + : '' + ); } sub fields { my ($self, $table) = @_; - ( map $self->field($_), $table->get_fields ) + (map $self->field($_), $table->get_fields); } sub indices { my ($self, $table) = @_; - (map $self->index($_), $table->get_indices) + (map $self->index($_), $table->get_indices); } -sub nullable { 'NULL' } +sub nullable {'NULL'} sub header_comments { header_comment() . "\n" if $_[0]->add_comments } diff --git a/lib/SQL/Translator/Generator/Role/Quote.pm b/lib/SQL/Translator/Generator/Role/Quote.pm index 43c54b35b..37d4c6a79 100644 --- a/lib/SQL/Translator/Generator/Role/Quote.pm +++ b/lib/SQL/Translator/Generator/Role/Quote.pm @@ -16,8 +16,8 @@ I requires qw(quote_chars name_sep); has escape_char => ( - is => 'ro', - lazy => 1, + is => 'ro', + lazy => 1, clearer => 1, default => sub { $_[0]->quote_chars->[-1] }, ); @@ -28,7 +28,7 @@ sub quote { return '' unless defined $label; return $$label if ref($label) eq 'SCALAR'; - my @quote_chars = @{$self->quote_chars}; + my @quote_chars = @{ $self->quote_chars }; return $label unless scalar @quote_chars; my ($l, $r); @@ -44,15 +44,15 @@ sub quote { my $esc = $self->escape_char; # parts containing * are naturally unquoted - join $sep, map { (my $n = $_) =~ s/\Q$r/$esc$r/g; "$l$n$r" } ( $sep ? split (/\Q$sep\E/, $label ) : $label ) + join $sep, map { (my $n = $_) =~ s/\Q$r/$esc$r/g; "$l$n$r" } ($sep ? split(/\Q$sep\E/, $label) : $label); } sub quote_string { - my ($self, $string) = @_; + my ($self, $string) = @_; - return $string unless defined $string; - $string =~ s/'/''/g; - return qq{'$string'}; + return $string unless defined $string; + $string =~ s/'/''/g; + return qq{'$string'}; } 1; diff --git a/lib/SQL/Translator/Parser.pm b/lib/SQL/Translator/Parser.pm index e3644b29e..187a11e4a 100644 --- a/lib/SQL/Translator/Parser.pm +++ b/lib/SQL/Translator/Parser.pm @@ -4,7 +4,7 @@ use strict; use warnings; our $VERSION = '1.64'; -sub parse { "" } +sub parse {""} 1; diff --git a/lib/SQL/Translator/Parser/Access.pm b/lib/SQL/Translator/Parser/Access.pm index 86a7e8dc0..9e11567bb 100644 --- a/lib/SQL/Translator/Parser/Access.pm +++ b/lib/SQL/Translator/Parser/Access.pm @@ -378,66 +378,64 @@ VALUE : /[-+]?\.?\d+(?:[eE]\d+)?/ END_OF_GRAMMAR sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error - local $::RD_WARN = 1 unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. - local $::RD_HINT = 1 unless defined $::RD_HINT; # Give out hints to help fix problems. - - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('Access'); - - my $result = $parser->startrule($data); - return $translator->error( "Parse failed." ) unless defined $result; - warn Dumper( $result ) if $DEBUG; - - my $schema = $translator->schema; - my @tables = sort { - $result->{ $a }->{'order'} <=> $result->{ $b }->{'order'} - } keys %{ $result }; - - for my $table_name ( @tables ) { - my $tdata = $result->{ $table_name }; - my $table = $schema->add_table( - name => $tdata->{'table_name'}, - ) or die $schema->error; - - $table->comments( $tdata->{'comments'} ); - - my @fields = sort { - $tdata->{'fields'}->{$a}->{'order'} - <=> - $tdata->{'fields'}->{$b}->{'order'} - } keys %{ $tdata->{'fields'} }; - - for my $fname ( @fields ) { - my $fdata = $tdata->{'fields'}{ $fname }; - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, - is_nullable => $fdata->{'null'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata->{'is_primary_key'}; - } + my ($translator, $data) = @_; + + # Enable warnings within the Parse::RecDescent module. + local $::RD_ERRORS = 1 + unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error + local $::RD_WARN = 1 + unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. + local $::RD_HINT = 1 + unless defined $::RD_HINT; # Give out hints to help fix problems. + + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; + + my $parser = ddl_parser_instance('Access'); + + my $result = $parser->startrule($data); + return $translator->error("Parse failed.") unless defined $result; + warn Dumper($result) if $DEBUG; + + my $schema = $translator->schema; + my @tables = sort { $result->{$a}->{'order'} <=> $result->{$b}->{'order'} } + keys %{$result}; + + for my $table_name (@tables) { + my $tdata = $result->{$table_name}; + my $table = $schema->add_table(name => $tdata->{'table_name'},) + or die $schema->error; + + $table->comments($tdata->{'comments'}); + + my @fields = sort { $tdata->{'fields'}->{$a}->{'order'} <=> $tdata->{'fields'}->{$b}->{'order'} } + keys %{ $tdata->{'fields'} }; + + for my $fname (@fields) { + my $fdata = $tdata->{'fields'}{$fname}; + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_inc'}, + is_nullable => $fdata->{'null'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + + $table->primary_key($field->name) if $fdata->{'is_primary_key'}; + } - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc $idata->{'type'}, - fields => $idata->{'fields'}, - ) or die $table->error; - } + for my $idata (@{ $tdata->{'indices'} || [] }) { + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc $idata->{'type'}, + fields => $idata->{'fields'}, + ) or die $table->error; } + } - return 1; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DB2.pm b/lib/SQL/Translator/Parser/DB2.pm index 3070be616..f3f333883 100644 --- a/lib/SQL/Translator/Parser/DB2.pm +++ b/lib/SQL/Translator/Parser/DB2.pm @@ -664,101 +664,104 @@ quantified_p: expression1 /(=|<>|<|>|<=|=>|\^=|\^<|\^>|\!=)/ /SOME|ANY|ALL/i '(' END_OF_GRAMMAR sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error - local $::RD_WARN = 1 unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. - local $::RD_HINT = 1 unless defined $::RD_HINT; # Give out hints to help fix problems. - - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('DB2'); - - my $result = $parser->startrule($data); - return $translator->error( "Parse failed." ) unless defined $result; - warn Dumper( $result ) if $DEBUG; - - my $schema = $translator->schema; - my @tables = - map { $_->[1] } - sort { $a->[0] <=> $b->[0] } - map { [ $result->{'tables'}{ $_ }->{'order'}, $_ ] } - keys %{ $result->{'tables'} }; - - for my $table_name ( @tables ) { - my $tdata = $result->{'tables'}{ $table_name }; - my $table = $schema->add_table( - name => $tdata->{'name'}, - ) or die $schema->error; - - $table->comments( $tdata->{'comments'} ); - - for my $fdata ( @{ $tdata->{'fields'} } ) { - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, - is_nullable => $fdata->{'is_nullable'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata->{'is_primary_key'}; - - for my $cdata ( @{ $fdata->{'constraints'} } ) { - next unless $cdata->{'type'} eq 'foreign_key'; - $cdata->{'fields'} ||= [ $field->name ]; - push @{ $tdata->{'constraints'} }, $cdata; - } - } - - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc $idata->{'type'}, - fields => $idata->{'fields'}, - ) or die $table->error; - } - - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - my $constraint = $table->add_constraint( - name => $cdata->{'name'}, - type => $cdata->{'type'}, - fields => $cdata->{'fields'}, - reference_table => $cdata->{'reference_table'}, - reference_fields => $cdata->{'reference_fields'}, - match_type => $cdata->{'match_type'} || '', - on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, - on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, - ) or die $table->error; - } + my ($translator, $data) = @_; + + # Enable warnings within the Parse::RecDescent module. + local $::RD_ERRORS = 1 + unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error + local $::RD_WARN = 1 + unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. + local $::RD_HINT = 1 + unless defined $::RD_HINT; # Give out hints to help fix problems. + + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; + + my $parser = ddl_parser_instance('DB2'); + + my $result = $parser->startrule($data); + return $translator->error("Parse failed.") unless defined $result; + warn Dumper($result) if $DEBUG; + + my $schema = $translator->schema; + my @tables = map { $_->[1] } + sort { $a->[0] <=> $b->[0] } + map { [ $result->{'tables'}{$_}->{'order'}, $_ ] } + keys %{ $result->{'tables'} }; + + for my $table_name (@tables) { + my $tdata = $result->{'tables'}{$table_name}; + my $table = $schema->add_table(name => $tdata->{'name'},) + or die $schema->error; + + $table->comments($tdata->{'comments'}); + + for my $fdata (@{ $tdata->{'fields'} }) { + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_inc'}, + is_nullable => $fdata->{'is_nullable'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + + $table->primary_key($field->name) if $fdata->{'is_primary_key'}; + + for my $cdata (@{ $fdata->{'constraints'} }) { + next unless $cdata->{'type'} eq 'foreign_key'; + $cdata->{'fields'} ||= [ $field->name ]; + push @{ $tdata->{'constraints'} }, $cdata; + } } - for my $def ( @{ $result->{'views'} || [] } ) { - my $view = $schema->add_view( - name => $def->{'name'}, - sql => $def->{'sql'}, - ); + for my $idata (@{ $tdata->{'indices'} || [] }) { + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc $idata->{'type'}, + fields => $idata->{'fields'}, + ) or die $table->error; } - for my $def ( @{ $result->{'triggers'} || [] } ) { - my $trig = $schema->add_trigger( - name => $def->{'name'}, - perform_action_when => $def->{'when'}, - database_event => $def->{'db_event'}, - action => $def->{'action'}, - fields => $def->{'fields'}, - on_table => $def->{'table'} - ); - $trig->extra( reference => $def->{'reference'}, - condition => $def->{'condition'}, - granularity => $def->{'granularity'} ); + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + my $constraint = $table->add_constraint( + name => $cdata->{'name'}, + type => $cdata->{'type'}, + fields => $cdata->{'fields'}, + reference_table => $cdata->{'reference_table'}, + reference_fields => $cdata->{'reference_fields'}, + match_type => $cdata->{'match_type'} || '', + on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, + on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, + ) or die $table->error; } - - return 1; + } + + for my $def (@{ $result->{'views'} || [] }) { + my $view = $schema->add_view( + name => $def->{'name'}, + sql => $def->{'sql'}, + ); + } + + for my $def (@{ $result->{'triggers'} || [] }) { + my $trig = $schema->add_trigger( + name => $def->{'name'}, + perform_action_when => $def->{'when'}, + database_event => $def->{'db_event'}, + action => $def->{'action'}, + fields => $def->{'fields'}, + on_table => $def->{'table'} + ); + $trig->extra( + reference => $def->{'reference'}, + condition => $def->{'condition'}, + granularity => $def->{'granularity'} + ); + } + + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DB2/Grammar.pm b/lib/SQL/Translator/Parser/DB2/Grammar.pm index c7c6c2a09..dcbe1bfbe 100644 --- a/lib/SQL/Translator/Parser/DB2/Grammar.pm +++ b/lib/SQL/Translator/Parser/DB2/Grammar.pm @@ -1,43647 +1,42458 @@ package SQL::Translator::Parser::DB2::Grammar; use Parse::RecDescent; -{ my $ERRORS; +{ + my $ERRORS; + + package Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar; + use strict; + use vars qw($skip $AUTOLOAD ); + $skip = '\s*'; + + my (%tables, $table_order, @table_comments, @views, @triggers); + + { + local $SIG{__WARN__} = sub {0}; + + # PRETEND TO BE IN Parse::RecDescent NAMESPACE + *Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::AUTOLOAD = sub { + no strict 'refs'; + $AUTOLOAD =~ s/^Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar/Parse::RecDescent/; + goto &{$AUTOLOAD}; + } + } + + push @Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ISA, 'Parse::RecDescent'; + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_17_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_17_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_17_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/DECIMAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_17_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_17_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/DECIMAL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DECIMAL)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DECIMAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } -package Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar; -use strict; -use vars qw($skip $AUTOLOAD ); -$skip = '\s*'; + while (!$_matched && !$commit) { - my ( %tables, $table_order, @table_comments, @views, @triggers ); -; + Parse::RecDescent::_trace( + q{Trying production: [/DEC/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_17_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_17_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DEC/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); -{ -local $SIG{__WARN__} = sub {0}; -# PRETEND TO BE IN Parse::RecDescent NAMESPACE -*Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::AUTOLOAD = sub -{ - no strict 'refs'; - $AUTOLOAD =~ s/^Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar/Parse::RecDescent/; - goto &{$AUTOLOAD}; -} -} + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DEC)//i) { -push @Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ISA, 'Parse::RecDescent'; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_17_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_17_of_rule_sysibm_function"}; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_17_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/DEC/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_17_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::triggered_action { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"triggered_action"}; + + Parse::RecDescent::_trace( + q{Trying rule: [triggered_action]}, + Parse::RecDescent::_tracefirst($_[1]), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [when_clause SQL_procedure_statement]}, + Parse::RecDescent::_tracefirst($_[1]), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{triggered_action}); + %item = (__RULE__ => q{triggered_action}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [when_clause]}, + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::when_clause, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [when_clause]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{when_clause(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying subrule: [SQL_procedure_statement]}, + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{SQL_procedure_statement})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SQL_procedure_statement( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [SQL_procedure_statement]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{SQL_procedure_statement}} = $_tok; + push @item, $_tok; + } - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_trace( + q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + + $_tok = ($_noactions) ? 0 : do { + $return = { + 'condition' => $item[1][0], + 'statement' => $item{'SQL_procedure_statement'} + }; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [when_clause SQL_procedure_statement]<<}, + Parse::RecDescent::_tracefirst($text), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{triggered_action}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{triggered_action}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{triggered_action}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{triggered_action}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_search_condition + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_2_of_rule_search_condition"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_2_of_rule_search_condition]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [predicate /SELECTIVITY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_2_of_rule_search_condition}); + %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_search_condition}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [predicate]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::predicate( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [predicate]<< (return value: [} . $_tok . q{]}, - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{predicate}} = $_tok; + push @item, $_tok; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + } + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/SELECTIVITY/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{/SELECTIVITY/i})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition(?)}} + = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [predicate /SELECTIVITY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['(' search_condition ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_2_of_rule_search_condition}); + %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_search_condition}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [search_condition]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{search_condition})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [search_condition]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{search_condition}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/DECIMAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_17_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_17_of_rule_sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - Parse::RecDescent::_trace(q{Trying terminal: [/DECIMAL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' search_condition ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_2_of_rule_search_condition}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::name1 { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"name1"}; + + Parse::RecDescent::_trace(q{Trying rule: [name1]}, Parse::RecDescent::_tracefirst($_[1]), q{name1}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{name1}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{name1}); + %item = (__RULE__ => q{name1}); + my $repcount = 0; + + Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, Parse::RecDescent::_tracefirst($text), q{name1}, $tracelevel) + if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{name1}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DECIMAL)//i) - { + Parse::RecDescent::_tracefirst($text), + q{name1}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{name1}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{name1}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{name1}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{name1}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{name1}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cond { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_cond"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_2_of_production_1_of_rule_cond]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [predicate /SELECTIVITY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_cond}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_cond}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [predicate]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::predicate( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [predicate]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{predicate}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/DECIMAL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/SELECTIVITY/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{/SELECTIVITY/i})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [predicate /SELECTIVITY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['(' search_condition ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_cond}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_cond}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [search_condition]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{search_condition})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [search_condition]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{search_condition}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/DEC/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_17_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_17_of_rule_sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - Parse::RecDescent::_trace(q{Trying terminal: [/DEC/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' search_condition ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_2_of_production_1_of_rule_cond}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['+', or '-' function, or '(', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: ['+', or '-']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is( + q{function, or '(', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference} + )->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DEC)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace( + q{>>Matched production: ['+', or '-' function, or '(', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_expression}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"SCHEMA"}; + + Parse::RecDescent::_trace(q{Trying rule: [SCHEMA]}, Parse::RecDescent::_tracefirst($_[1]), q{SCHEMA}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/\\w+/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{SCHEMA}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{SCHEMA}); + %item = (__RULE__ => q{SCHEMA}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/\\w+/]}, + Parse::RecDescent::_tracefirst($text), + q{SCHEMA}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:\w+)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/\\w+/]<<}, + Parse::RecDescent::_tracefirst($text), + q{SCHEMA}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/DEC/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/\\w\{1,128\}/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{SCHEMA}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{SCHEMA}); + %item = (__RULE__ => q{SCHEMA}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/\\w\{1,128\}/]}, + Parse::RecDescent::_tracefirst($text), + q{SCHEMA}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:\w{1,128})//) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_17_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::triggered_action -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"triggered_action"}; - - Parse::RecDescent::_trace(q{Trying rule: [triggered_action]}, - Parse::RecDescent::_tracefirst($_[1]), - q{triggered_action}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/\\w\{1,128\}/]<<}, + Parse::RecDescent::_tracefirst($text), + q{SCHEMA}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{SCHEMA}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{SCHEMA}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{SCHEMA}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{SCHEMA}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_87_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_87_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_87_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/VARIANCE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_87_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_87_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/VARIANCE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:VARIANCE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/VARIANCE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/VAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_87_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_87_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/VAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:VAR)//i) { - Parse::RecDescent::_trace(q{Trying production: [when_clause SQL_procedure_statement]}, - Parse::RecDescent::_tracefirst($_[1]), - q{triggered_action}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{triggered_action}); - %item = (__RULE__ => q{triggered_action}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying repeated subrule: [when_clause]}, - Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/VAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_87_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"} + {"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['+']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['+']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\+//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $expectation->is(q{})->at($text); + push @item, $item{__STRING1__} = $&; - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::when_clause, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: ['+']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [when_clause]<< (} - . @$_tok . q{ times)}, - Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['-']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['-']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\-//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $item{q{when_clause(?)}} = $_tok; - push @item, $_tok; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['-']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::get_bracketed { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"get_bracketed"}; + + Parse::RecDescent::_trace( + q{Trying rule: [get_bracketed]}, + Parse::RecDescent::_tracefirst($_[1]), + q{get_bracketed}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: []}, + Parse::RecDescent::_tracefirst($_[1]), + q{get_bracketed}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{get_bracketed}); + %item = (__RULE__ => q{get_bracketed}); + my $repcount = 0; + + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{get_bracketed}, $tracelevel) + if defined $::RD_TRACE; + + $_tok = ($_noactions) ? 0 : do { + extract_bracketed($text, '('); + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: []<<}, + Parse::RecDescent::_tracefirst($text), + q{get_bracketed}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{get_bracketed}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{get_bracketed}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{get_bracketed}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{get_bracketed}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::labeled_duration { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"labeled_duration"}; + + Parse::RecDescent::_trace( + q{Trying rule: [labeled_duration]}, + Parse::RecDescent::_tracefirst($_[1]), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [ld_type ld_duration]}, + Parse::RecDescent::_tracefirst($_[1]), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{labeled_duration}); + %item = (__RULE__ => q{labeled_duration}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [ld_type]}, + Parse::RecDescent::_tracefirst($text), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_type( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [ld_type]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{labeled_duration}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{ld_type}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying subrule: [ld_duration]}, + Parse::RecDescent::_tracefirst($text), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{ld_duration})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_duration( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [ld_duration]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [SQL_procedure_statement]}, Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{SQL_procedure_statement})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SQL_procedure_statement($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{labeled_duration}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{ld_duration}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [SQL_procedure_statement]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{SQL_procedure_statement}} = $_tok; - push @item, $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [ld_type ld_duration]<<}, + Parse::RecDescent::_tracefirst($text), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{labeled_duration}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{labeled_duration}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{labeled_duration}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{labeled_duration}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_end { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"group_end"}; + + Parse::RecDescent::_trace( + q{Trying rule: [group_end]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{group_end}); + %item = (__RULE__ => q{group_end}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [unsigned_constant /FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{group_end}); + %item = (__RULE__ => q{group_end}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [unsigned_constant]}, + Parse::RecDescent::_tracefirst($text), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [unsigned_constant]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{group_end}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{unsigned_constant}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{Trying terminal: [/FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/FOLLOWING/i})->at($text); - $_tok = ($_noactions) ? 0 : do { $return = { 'condition' => $item[1][0], - 'statement' => $item{'SQL_procedure_statement'} }; -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FOLLOWING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [unsigned_constant /FOLLOWING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_end}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{group_end}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{group_end}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{group_end}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::statement { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"statement"}; + + Parse::RecDescent::_trace( + q{Trying rule: [statement]}, + Parse::RecDescent::_tracefirst($_[1]), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [comment]}, + Parse::RecDescent::_tracefirst($_[1]), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{statement}); + %item = (__RULE__ => q{statement}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [comment]}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::comment( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [comment]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{statement}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{comment}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{>>Matched production: [when_clause SQL_procedure_statement]<<}, - Parse::RecDescent::_tracefirst($text), - q{triggered_action}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + } + Parse::RecDescent::_trace( + q{>>Matched production: [comment]<<}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [create]}, + Parse::RecDescent::_tracefirst($_[1]), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{statement}); + %item = (__RULE__ => q{statement}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [create]}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::create( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [create]<< (return value: [} . $_tok . q{]}, - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_tracefirst($text), + q{statement}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{create}} = $_tok; + push @item, $_tok; + } - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{triggered_action}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{triggered_action}, - $tracelevel) + Parse::RecDescent::_trace( + q{>>Matched production: [create]<<}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched) { + + Parse::RecDescent::_trace( + q{Trying production: []}, + Parse::RecDescent::_tracefirst($_[1]), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + + my $_savetext; + @item = (q{statement}); + %item = (__RULE__ => q{statement}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying directive: []}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + $_tok = do { + if (1) { + do { + my $rule = $item[0]; + $rule =~ s/_/ /g; + +#WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); + push @{ $thisparser->{errors} }, [ "Invalid $rule: " . $expectation->message(), $thisline ]; + } unless $_noactions; + undef; + } else { + 0; + } + }; + if (defined($_tok)) { + Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + } else { + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{triggered_action}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + } + + last unless defined $_tok; + push @item, $item{__DIRECTIVE1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: []<<}, + Parse::RecDescent::_tracefirst($text), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{statement}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{statement}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{statement}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{statement}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"} + {"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [result_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [result_expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - , q{triggered_action}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [result_expression]<< (return value: [} . $_tok . q{]}, -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_search_condition -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_2_of_rule_search_condition"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_2_of_rule_search_condition]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{result_expression}} = $_tok; + push @item, $_tok; + } - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_trace( + q{>>Matched production: [result_expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/NULL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/NULL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULL)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NULL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_case_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_case_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_2_of_production_1_of_rule_case_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ELSE\\s+NULL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_case_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_case_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/ELSE\\s+NULL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ELSE\s+NULL)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{>>Matched production: [/ELSE\\s+NULL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ELSE/i result_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_case_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_case_expression}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/ELSE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ELSE)//i) { - Parse::RecDescent::_trace(q{Trying production: [predicate /SELECTIVITY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_2_of_rule_search_condition}); - %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_search_condition}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [result_expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{result_expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [result_expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [predicate]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::predicate($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [predicate]<< (return value: [} - . $_tok . q{]}, + q{_alternation_2_of_production_1_of_rule_case_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{result_expression}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{predicate}} = $_tok; - push @item, $_tok; + } - } + Parse::RecDescent::_trace( + q{>>Matched production: [/ELSE/i result_expression]<<}, Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_2_of_production_1_of_rule_case_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subject_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"subject_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [subject_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subject_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subject_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{subject_expression}); + %item = (__RULE__ => q{subject_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{subject_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{subject_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying repeated subrule: [/SELECTIVITY/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) + q{subject_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace( + q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{subject_expression}, $tracelevel + ) if defined $::RD_TRACE; + + $_tok + = ($_noactions) + ? 0 + : do { # with static result type that is a used-defined struct type + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{subject_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{subject_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{subject_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{subject_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{subject_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_desc_option { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_desc_option"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_desc_option]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/NULLS\\s+FIRST/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_desc_option}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_desc_option}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/NULLS\\s+FIRST/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULLS\s+FIRST)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $expectation->is(q{/SELECTIVITY/i})->at($text); + push @item, $item{__PATTERN1__} = $&; - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/NULLS\\s+FIRST/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition]<< (} - . @$_tok . q{ times)}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition(?)}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_desc_option}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_desc_option}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULLS\s+LAST)//i) { - Parse::RecDescent::_trace(q{>>Matched production: [predicate /SELECTIVITY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NULLS\\s+LAST/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_desc_option}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::view_name { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"view_name"}; + + Parse::RecDescent::_trace( + q{Trying rule: [view_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [SCHEMA '.' NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{view_name}); + %item = (__RULE__ => q{view_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [SCHEMA]}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [SCHEMA]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{view_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{SCHEMA}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: ['(' search_condition ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_2_of_rule_search_condition}); - %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_search_condition}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{Trying terminal: ['.']}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'.'})->at($text); - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\.//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{NAME})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{view_name}, $tracelevel) + if defined $::RD_TRACE; + $_tok + = ($_noactions) + ? 0 + : do { $return = { schema => $item[1], name => $item[3] } }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [SCHEMA '.' NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{view_name}); + %item = (__RULE__ => q{view_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [search_condition]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) + q{view_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{view_name}, $tracelevel) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{search_condition})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + $_tok = ($_noactions) ? 0 : do { $return = { name => $item[1] } }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{view_name}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{view_name}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{view_name}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{view_name}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cond { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_cond"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_cond]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/AND/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_cond}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cond}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/AND/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AND)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/AND/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [search_condition]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{search_condition}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/OR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_cond}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cond}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/OR/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:OR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/OR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_cond}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numbering_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"numbering_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [numbering_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ROW_NUMBER|ROWNUMBER/i '()' /OVER/i '(' window_partition_clause window_order_clause /RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause ')']}, + Parse::RecDescent::_tracefirst($_[1]), q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{numbering_function}); + %item = (__RULE__ => q{numbering_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/ROW_NUMBER|ROWNUMBER/i]}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ROW_NUMBER|ROWNUMBER)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: ['()']}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'()'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(\)//) { - Parse::RecDescent::_trace(q{>>Matched production: ['(' search_condition ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/OVER/i]}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/OVER/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:OVER)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::name1 -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"name1"}; - - Parse::RecDescent::_trace(q{Trying rule: [name1]}, - Parse::RecDescent::_tracefirst($_[1]), - q{name1}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); - my $err_at = @{$thisparser->{errors}}; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [window_partition_clause]}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{window_partition_clause})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_partition_clause, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [window_partition_clause]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{window_partition_clause(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [window_order_clause]}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{window_order_clause})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_numbering_function, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_numbering_function]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_numbering_function(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($text), q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is( + q{/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause} + )->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_numbering_function, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_2_of_production_1_of_rule_numbering_function]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_2_of_production_1_of_rule_numbering_function(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING3__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ROW_NUMBER|ROWNUMBER/i '()' /OVER/i '(' window_partition_clause window_order_clause /RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause ')']<<}, + Parse::RecDescent::_tracefirst($text), q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{numbering_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{numbering_function}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{numbering_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_aggregation_group_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_window_aggregation_group_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ROWS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/ROWS/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ROWS)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ROWS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/RANGE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/RANGE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RANGE)//i) { - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{name1}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{name1}); - %item = (__RULE__ => q{name1}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/RANGE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound1 { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"group_bound1"}; + + Parse::RecDescent::_trace( + q{Trying rule: [group_bound1]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound1}); + %item = (__RULE__ => q{group_bound1}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [unsigned_constant /PRECEDING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound1}); + %item = (__RULE__ => q{group_bound1}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [unsigned_constant]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [unsigned_constant]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, Parse::RecDescent::_tracefirst($text), - q{name1}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{name1}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, + q{group_bound1}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{unsigned_constant}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_tracefirst($text), - q{name1}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; + } - } + Parse::RecDescent::_trace( + q{Trying terminal: [/PRECEDING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/PRECEDING/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:PRECEDING)//i) { - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{name1}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [unsigned_constant /PRECEDING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [unsigned_constant /FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound1}); + %item = (__RULE__ => q{group_bound1}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [unsigned_constant]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [unsigned_constant]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{unsigned_constant}} = $_tok; + push @item, $_tok; - unless ( $_matched || defined($return) || defined($score) ) - { + } + Parse::RecDescent::_trace( + q{Trying terminal: [/FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/FOLLOWING/i})->at($text); - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{name1}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{name1}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FOLLOWING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{name1}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{name1}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cond -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_cond"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_2_of_production_1_of_rule_cond]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [unsigned_constant /FOLLOWING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/CURRENT\\s+ROW/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound1}); + %item = (__RULE__ => q{group_bound1}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/CURRENT\\s+ROW/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CURRENT\s+ROW)//i) { - Parse::RecDescent::_trace(q{Trying production: [predicate /SELECTIVITY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_cond}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_cond}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/CURRENT\\s+ROW/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound1}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{group_bound1}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{group_bound1}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{group_bound1}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::OLAP_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"OLAP_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [OLAP_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [ranking_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{OLAP_function}); + %item = (__RULE__ => q{OLAP_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [ranking_function]}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ranking_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [ranking_function]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [predicate]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::predicate($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{OLAP_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{ranking_function}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [predicate]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{predicate}} = $_tok; - push @item, $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [ranking_function]<<}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [numbering_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{OLAP_function}); + %item = (__RULE__ => q{OLAP_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [numbering_function]}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numbering_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [numbering_function]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{numbering_function}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace( + q{>>Matched production: [numbering_function]<<}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [aggregation_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{OLAP_function}); + %item = (__RULE__ => q{OLAP_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [aggregation_function]}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::aggregation_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [aggregation_function]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying repeated subrule: [/SELECTIVITY/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) + q{OLAP_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{aggregation_function}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace( + q{>>Matched production: [aggregation_function]<<}, + Parse::RecDescent::_tracefirst($text), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{OLAP_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{OLAP_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{OLAP_function}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{OLAP_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_30_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_30_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_30_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/DOUBLE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_30_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_30_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/DOUBLE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DOUBLE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $expectation->is(q{/SELECTIVITY/i})->at($text); + push @item, $item{__PATTERN1__} = $&; - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/DOUBLE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond]<< (} - . @$_tok . q{ times)}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond(?)}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DOUBLE_PRECISION/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_30_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_30_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DOUBLE_PRECISION/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DOUBLE_PRECISION)//i) { - Parse::RecDescent::_trace(q{>>Matched production: [predicate /SELECTIVITY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/DOUBLE_PRECISION/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_30_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::FULL { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"FULL"}; + + Parse::RecDescent::_trace(q{Trying rule: [FULL]}, Parse::RecDescent::_tracefirst($_[1]), q{FULL}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/full/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{FULL}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{FULL}); + %item = (__RULE__ => q{FULL}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/full/i]}, + Parse::RecDescent::_tracefirst($text), + q{FULL}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:full)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/full/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{FULL}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{FULL}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{FULL}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{FULL}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{FULL}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cast_specification + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_cast_specification"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_2_of_production_1_of_rule_cast_specification]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/SCOPE/ typed_table_name, or typed_view_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_cast_specification}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_cast_specification}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/SCOPE/]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SCOPE)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{typed_table_name, or typed_view_name}) + ->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}} + = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: ['(' search_condition ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_cond}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_cond}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{>>Matched production: [/SCOPE/ typed_table_name, or typed_view_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_2_of_production_1_of_rule_cast_specification}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::case_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"case_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [case_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CASE/i searched_when_clause, or simple_when_clause /ELSE\\s+NULL/i, or /ELSE/i /END/i]}, + Parse::RecDescent::_tracefirst($_[1]), q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{case_expression}); + %item = (__RULE__ => q{case_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/CASE/i]}, + Parse::RecDescent::_tracefirst($text), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CASE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_case_expression]}, + Parse::RecDescent::_tracefirst($text), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{searched_when_clause, or simple_when_clause}) + ->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_case_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_case_expression]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{case_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_case_expression}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + } + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/ELSE\\s+NULL/i, or /ELSE/i]}, + Parse::RecDescent::_tracefirst($text), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{/ELSE\\s+NULL/i, or /ELSE/i})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_case_expression, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_2_of_production_1_of_rule_case_expression]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{case_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_2_of_production_1_of_rule_case_expression(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying terminal: [/END/i]}, + Parse::RecDescent::_tracefirst($text), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/END/i})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:END)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/CASE/i searched_when_clause, or simple_when_clause /ELSE\\s+NULL/i, or /ELSE/i /END/i]<<}, + Parse::RecDescent::_tracefirst($text), q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{case_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{case_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{case_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{case_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::operator { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"operator"}; + + Parse::RecDescent::_trace( + q{Trying rule: [operator]}, + Parse::RecDescent::_tracefirst($_[1]), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CONCAT/i, or '||']}, + Parse::RecDescent::_tracefirst($_[1]), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{operator}); + %item = (__RULE__ => q{operator}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_operator]}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_operator( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_operator]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{operator}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_operator}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/CONCAT/i, or '||']<<}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying subrule: [search_condition]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying production: ['/']}, + Parse::RecDescent::_tracefirst($_[1]), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{operator}); + %item = (__RULE__ => q{operator}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['/']}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\///) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{search_condition})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__STRING1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: ['/']<<}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [search_condition]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{search_condition}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: ['*']}, + Parse::RecDescent::_tracefirst($_[1]), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{operator}); + %item = (__RULE__ => q{operator}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: ['*']}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\*//) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: ['*']<<}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: ['+']}, + Parse::RecDescent::_tracefirst($_[1]), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{operator}); + %item = (__RULE__ => q{operator}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: ['(' search_condition ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying terminal: ['+']}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\+//) { - unless ( $_matched || defined($return) || defined($score) ) - { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: ['+']<<}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + while (!$_matched && !$commit) { -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying production: ['-']}, + Parse::RecDescent::_tracefirst($_[1]), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{operator}); + %item = (__RULE__ => q{operator}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: ['-']}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - my $err_at = @{$thisparser->{errors}}; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\-//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['-']<<}, + Parse::RecDescent::_tracefirst($text), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{operator}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{operator}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{operator}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{operator}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_type { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_2_of_rule_type"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_2_of_rule_type]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/INSERT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_2_of_rule_type}); + %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_type}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/INSERT/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:INSERT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{>>Matched production: [/INSERT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DELETE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_2_of_rule_type}); + %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_type}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DELETE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DELETE)//i) { - Parse::RecDescent::_trace(q{Trying production: ['+', or '-' function, or '(', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying repeated subrule: ['+', or '-']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $expectation->is(q{})->at($text); + push @item, $item{__PATTERN1__} = $&; - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/DELETE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]<< (} - . @$_tok . q{ times)}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression(?)}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/UPDATE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_2_of_rule_type}); + %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_type}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/UPDATE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UPDATE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/UPDATE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_2_of_rule_type}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_2_of_rule_type}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_8_of_rule_sysibm_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_8_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_8_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CONCAT/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_8_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_8_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/CONCAT/]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CONCAT)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{function, or '(', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/CONCAT/]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: ['||']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_8_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_8_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: ['||']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: ['+', or '-' function, or '(', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\|\|//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['||']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_8_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_reference { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"sequence_reference"}; + + Parse::RecDescent::_trace( + q{Trying rule: [sequence_reference]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [nextval_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{sequence_reference}); + %item = (__RULE__ => q{sequence_reference}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [nextval_expression]}, + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::nextval_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [nextval_expression]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{nextval_expression}} = $_tok; + push @item, $_tok; - unless ( $_matched || defined($return) || defined($score) ) - { + } + Parse::RecDescent::_trace( + q{>>Matched production: [nextval_expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [prevval_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{sequence_reference}); + %item = (__RULE__ => q{sequence_reference}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [prevval_expression]}, + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::prevval_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [prevval_expression]<< (return value: [} . $_tok . q{]}, - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{prevval_expression}} = $_tok; + push @item, $_tok; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"SCHEMA"}; + } - Parse::RecDescent::_trace(q{Trying rule: [SCHEMA]}, - Parse::RecDescent::_tracefirst($_[1]), - q{SCHEMA}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [prevval_expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{sequence_reference}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{sequence_reference}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{sequence_reference}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{sequence_reference}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysibm_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ABS/i, or /ABSVAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - my $err_at = @{$thisparser->{errors}}; + } - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{>>Matched production: [/ABS/i, or /ABSVAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/AVG/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/AVG/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AVG)//i) { - Parse::RecDescent::_trace(q{Trying production: [/\\w+/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{SCHEMA}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{SCHEMA}); - %item = (__RULE__ => q{SCHEMA}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying terminal: [/\\w+/]}, Parse::RecDescent::_tracefirst($text), - q{SCHEMA}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{>>Matched production: [/AVG/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\w+)//) - { + Parse::RecDescent::_trace( + q{Trying production: [/BIGINT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace( + q{Trying terminal: [/BIGINT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:BIGINT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/BIGINT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/BLOB/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/\\w+/]<<}, - Parse::RecDescent::_tracefirst($text), - q{SCHEMA}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/BLOB/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:BLOB)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/BLOB/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/\\w\{1,128\}/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{SCHEMA}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{SCHEMA}); - %item = (__RULE__ => q{SCHEMA}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/CHAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/\\w\{1,128\}/]}, Parse::RecDescent::_tracefirst($text), - q{SCHEMA}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/CHAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CHAR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\w{1,128})//) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/CHAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/CLOB/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[5]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/\\w\{1,128\}/]<<}, - Parse::RecDescent::_tracefirst($text), - q{SCHEMA}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/CLOB/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CLOB)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/CLOB/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{SCHEMA}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{SCHEMA}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{SCHEMA}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{SCHEMA}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + Parse::RecDescent::_trace( + q{Trying production: [/COALESCE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[6]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_87_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_87_of_rule_sysibm_function"}; + Parse::RecDescent::_trace( + q{Trying terminal: [/COALESCE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_87_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:COALESCE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/COALESCE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CONCAT/, or '||']}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[7]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_8_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_8_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_8_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_8_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{>>Matched production: [/CONCAT/, or '||']<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CORRELATION/i, or /CORR/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[8]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_9_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_9_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_9_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_9_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/CORRELATION/i, or /CORR/]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/VARIANCE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_87_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_87_of_rule_sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/COUNT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[9]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/VARIANCE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/COUNT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:COUNT)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:VARIANCE)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/COUNT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/VARIANCE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/COUNT_BIG/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[10]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: [/VAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_87_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_87_of_rule_sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/COUNT_BIG/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:COUNT_BIG)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/VAR/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/COUNT_BIG/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/COVARIANCE/i, or /COVAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[11]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_12_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_12_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_12_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:VAR)//i) - { + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_12_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [/COVARIANCE/i, or /COVAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DATE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[12]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/VAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/DATE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - unless ( $_matched || defined($return) || defined($score) ) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DATE)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_87_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + push @item, $item{__PATTERN1__} = $&; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression"}; + Parse::RecDescent::_trace( + q{>>Matched production: [/DATE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/DAY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[13]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DAY/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - my $err_at = @{$thisparser->{errors}}; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DAY)//i) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DAY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/DAYS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[14]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: ['+']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DAYS/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DAYS)//i) { - Parse::RecDescent::_trace(q{Trying terminal: ['+']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\+//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/DAYS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DBCLOB/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[15]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: ['+']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/DBCLOB/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DBCLOB)//i) { - Parse::RecDescent::_trace(q{Trying production: ['-']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying terminal: ['-']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/DBCLOB/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/DECIMAL/i, or /DEC/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[16]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_17_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_17_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_17_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_17_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\-//) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/DECIMAL/i, or /DEC/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: ['-']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/DECRYPT_BIN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[17]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DECRYPT_BIN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - unless ( $_matched || defined($return) || defined($score) ) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DECRYPT_BIN)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + push @item, $item{__PATTERN1__} = $&; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::get_bracketed -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"get_bracketed"}; + Parse::RecDescent::_trace( + q{>>Matched production: [/DECRYPT_BIN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying rule: [get_bracketed]}, - Parse::RecDescent::_tracefirst($_[1]), - q{get_bracketed}, - $tracelevel) - if defined $::RD_TRACE; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DECRYPT_CHAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[18]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_trace( + q{Trying terminal: [/DECRYPT_CHAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DECRYPT_CHAR)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DECRYPT_CHAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/DEREF/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[19]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: []}, - Parse::RecDescent::_tracefirst($_[1]), - q{get_bracketed}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{get_bracketed}); - %item = (__RULE__ => q{get_bracketed}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DEREF/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DEREF)//i) { - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{get_bracketed}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - - $_tok = ($_noactions) ? 0 : do { - extract_bracketed($text, '('); -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/DEREF/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: []<<}, - Parse::RecDescent::_tracefirst($text), - q{get_bracketed}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/DIGITS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[20]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/DIGITS/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DIGITS)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{get_bracketed}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{get_bracketed}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{get_bracketed}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{get_bracketed}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::labeled_duration -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"labeled_duration"}; - - Parse::RecDescent::_trace(q{Trying rule: [labeled_duration]}, - Parse::RecDescent::_tracefirst($_[1]), - q{labeled_duration}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DIGITS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DLCOMMENT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[21]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DLCOMMENT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLCOMMENT)//i) { - Parse::RecDescent::_trace(q{Trying production: [ld_type ld_duration]}, - Parse::RecDescent::_tracefirst($_[1]), - q{labeled_duration}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{labeled_duration}); - %item = (__RULE__ => q{labeled_duration}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [ld_type]}, - Parse::RecDescent::_tracefirst($text), - q{labeled_duration}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_type($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{labeled_duration}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/DLCOMMENT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [ld_type]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{labeled_duration}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ld_type}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/DLLINKTYPE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[22]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying subrule: [ld_duration]}, - Parse::RecDescent::_tracefirst($text), - q{labeled_duration}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{ld_duration})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_duration($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/DLLINKTYPE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{labeled_duration}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ld_duration]<< (return value: [} - . $_tok . q{]}, + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLLINKTYPE)//i) { - Parse::RecDescent::_tracefirst($text), - q{labeled_duration}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $item{q{ld_duration}} = $_tok; - push @item, $_tok; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DLLINKTYPE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{>>Matched production: [ld_type ld_duration]<<}, - Parse::RecDescent::_tracefirst($text), - q{labeled_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DLURLCOMPLETE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[23]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/DLURLCOMPLETE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLURLCOMPLETE)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{labeled_duration}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{labeled_duration}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{labeled_duration}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{labeled_duration}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_end -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"group_end"}; - - Parse::RecDescent::_trace(q{Trying rule: [group_end]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_end}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DLURLCOMPLETE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; + while (!$_matched && !$commit) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{Trying production: [/DLURLPATH/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[24]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{Trying terminal: [/DLURLPATH/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLURLPATH)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - while (!$_matched && !$commit) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{group_end}); - %item = (__RULE__ => q{group_end}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{>>Matched production: [/DLURLPATH/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying production: [/DLURLPATHONLY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[25]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DLURLPATHONLY/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLURLPATHONLY)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DLURLPATHONLY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/DLURLSCHEME/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[26]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DLURLSCHEME/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLURLSCHEME)//i) { - Parse::RecDescent::_trace(q{Trying production: [unsigned_constant /FOLLOWING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_end}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{group_end}); - %item = (__RULE__ => q{group_end}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [unsigned_constant]}, - Parse::RecDescent::_tracefirst($text), - q{group_end}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/DLURLSCHEME/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [unsigned_constant]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{unsigned_constant}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/DLURLSERVER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[27]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/FOLLOWING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/FOLLOWING/i})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/DLURLSERVER/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLURLSERVER)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FOLLOWING)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DLURLSERVER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [unsigned_constant /FOLLOWING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/DLVALUE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[28]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/DLVALUE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DLVALUE)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_end}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{group_end}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{group_end}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{group_end}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::statement -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"statement"}; - - Parse::RecDescent::_trace(q{Trying rule: [statement]}, - Parse::RecDescent::_tracefirst($_[1]), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/DLVALUE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/DOUBLE/i, or /DOUBLE_PRECISION/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[29]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_30_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_30_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_30_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_30_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - my $err_at = @{$thisparser->{errors}}; + } - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{>>Matched production: [/DOUBLE/i, or /DOUBLE_PRECISION/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ENCRYPT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[30]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/ENCRYPT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ENCRYPT)//i) { - Parse::RecDescent::_trace(q{Trying production: [comment]}, - Parse::RecDescent::_tracefirst($_[1]), - q{statement}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{statement}); - %item = (__RULE__ => q{statement}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [comment]}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::comment($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/ENCRYPT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [comment]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{comment}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/EVENT_MON_STATE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[31]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/EVENT_MON_STATE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [comment]<<}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:EVENT_MON_STATE)//i) { - Parse::RecDescent::_trace(q{Trying production: [create]}, - Parse::RecDescent::_tracefirst($_[1]), - q{statement}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{statement}); - %item = (__RULE__ => q{statement}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [create]}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::create($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/EVENT_MON_STATE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [create]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{create}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/FLOAT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[32]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/FLOAT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [create]<<}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FLOAT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/FLOAT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: []}, - Parse::RecDescent::_tracefirst($_[1]), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; + while (!$_matched && !$commit) { - my $_savetext; - @item = (q{statement}); - %item = (__RULE__ => q{statement}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying production: [/GETHINT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[33]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/GETHINT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:GETHINT)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying directive: []}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - $_tok = do { if (1) { do { - my $rule = $item[0]; - $rule =~ s/_/ /g; - #WAS: Parse::RecDescent::_error("Invalid $rule: " . $expectation->message() ,$thisline); - push @{$thisparser->{errors}}, ["Invalid $rule: " . $expectation->message() ,$thisline]; - } unless $_noactions; undef } else {0} }; - if (defined($_tok)) - { - Parse::RecDescent::_trace(q{>>Matched directive<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - } - else - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/GETHINT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; } - last unless defined $_tok; - push @item, $item{__DIRECTIVE1__}=$_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/GENERATE_UNIQUE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[34]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/GENERATE_UNIQUE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: []<<}, - Parse::RecDescent::_tracefirst($text), - q{statement}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:GENERATE_UNIQUE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/GENERATE_UNIQUE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{statement}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{statement}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{statement}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + Parse::RecDescent::_trace( + q{Trying production: [/GRAPHIC/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[35]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [/GRAPHIC/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:GRAPHIC)//i) { - my $err_at = @{$thisparser->{errors}}; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{>>Matched production: [/GRAPHIC/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/GROUPING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[36]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/GROUPING/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{Trying production: [result_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); - my $repcount = 0; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:GROUPING)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying subrule: [result_expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/GROUPING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [result_expression]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{result_expression}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/HEX/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[37]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/HEX/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [result_expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:HEX)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/HEX/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/NULL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/HOUR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[38]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/NULL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/HOUR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:HOUR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULL)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/HOUR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/NULL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/IDENTITY_VAL_LOCAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[39]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/IDENTITY_VAL_LOCAL/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:IDENTITY_VAL_LOCAL)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_case_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_case_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_2_of_production_1_of_rule_case_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/IDENTITY_VAL_LOCAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/INTEGER/i, or /INT/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[40]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_41_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_41_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_41_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_41_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{>>Matched production: [/INTEGER/i, or /INT/]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/LCASE/i, or /LOWER/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[41]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_42_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_42_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_42_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_42_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/LCASE/i, or /LOWER/]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/ELSE\\s+NULL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_case_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_case_expression}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LENGTH/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[42]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/ELSE\\s+NULL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/LENGTH/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LENGTH)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ELSE\s+NULL)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/LENGTH/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LONG_VARCHAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[43]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/ELSE\\s+NULL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/LONG_VARCHAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LONG_VARCHAR)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/LONG_VARCHAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/ELSE/i result_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_case_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_case_expression}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LONG_VARGRAPHIC/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[44]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/ELSE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/LONG_VARGRAPHIC/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LONG_VARGRAPHIC)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ELSE)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/LONG_VARGRAPHIC/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying subrule: [result_expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{result_expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + Parse::RecDescent::_trace( + q{Trying production: [/LTRIM/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[45]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [result_expression]<< (return value: [} - . $_tok . q{]}, + Parse::RecDescent::_trace( + q{Trying terminal: [/LTRIM/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LTRIM)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $item{q{result_expression}} = $_tok; - push @item, $_tok; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/LTRIM/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{>>Matched production: [/ELSE/i result_expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/MAX/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[46]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/MAX/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MAX)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_2_of_production_1_of_rule_case_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subject_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"subject_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [subject_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subject_expression}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/MAX/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/MICROSECOND/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[47]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/MICROSECOND/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MICROSECOND)//i) { - Parse::RecDescent::_trace(q{Trying production: [expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subject_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{subject_expression}); - %item = (__RULE__ => q{subject_expression}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{subject_expression}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{subject_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/MICROSECOND/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{subject_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/MIN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[48]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{subject_expression}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [/MIN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MIN)//i) { - $_tok = ($_noactions) ? 0 : do { # with static result type that is a used-defined struct type -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/MIN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{>>Matched production: [expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{subject_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/MINUTE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[49]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/MINUTE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MINUTE)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{subject_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{subject_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{subject_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{subject_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_desc_option -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_desc_option"}; - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_desc_option]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/MINUTE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; + while (!$_matched && !$commit) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{Trying production: [/MONTH/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[50]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{Trying terminal: [/MONTH/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MONTH)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - while (!$_matched && !$commit) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying production: [/NULLS\\s+FIRST/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_desc_option}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_desc_option}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{>>Matched production: [/MONTH/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying terminal: [/NULLS\\s+FIRST/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying production: [/MULTIPLY_ACT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[51]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/MULTIPLY_ACT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULLS\s+FIRST)//i) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MULTIPLY_ACT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/MULTIPLY_ACT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/NODENUMBER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[52]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/NULLS\\s+FIRST/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/NODENUMBER/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NODENUMBER)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/NODENUMBER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/NULLS\\s+LAST/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_desc_option}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_desc_option}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/NULLIF/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[53]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/NULLS\\s+LAST/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/NULLIF/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULLIF)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULLS\s+LAST)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/NULLIF/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/PARTITON/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[54]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/NULLS\\s+LAST/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/PARTITON/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:PARTITON)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/PARTITON/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_desc_option}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + Parse::RecDescent::_trace( + q{Trying production: [/POSSTR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[55]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::view_name -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"view_name"}; - - Parse::RecDescent::_trace(q{Trying rule: [view_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [/POSSTR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:POSSTR)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - my $err_at = @{$thisparser->{errors}}; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{>>Matched production: [/POSSTR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/RAISE_ERROR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[56]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/RAISE_ERROR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RAISE_ERROR)//i) { - Parse::RecDescent::_trace(q{Trying production: [SCHEMA '.' NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{view_name}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{view_name}); - %item = (__RULE__ => q{view_name}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [SCHEMA]}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/RAISE_ERROR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [SCHEMA]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{SCHEMA}} = $_tok; - push @item, $_tok; - - } - Parse::RecDescent::_trace(q{Trying terminal: ['.']}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'.'})->at($text); + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[57]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\.//) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/REAL/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REAL)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{NAME})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/REAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/REC2XML/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[58]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [/REC2XML/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REC2XML)//i) { - $_tok = ($_noactions) ? 0 : do { $return = { schema => $item[1], name => $item[3] } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/REC2XML/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REGR_AVGX/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[59]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [SCHEMA '.' NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_AVGX/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_AVGX)//i) { - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{view_name}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{view_name}); - %item = (__RULE__ => q{view_name}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_AVGX/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/REGR_AVGY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[60]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_AVGY/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_AVGY)//i) { - $_tok = ($_noactions) ? 0 : do { $return = { name => $item[1] } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_AVGY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REGR_COUNT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[61]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_COUNT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_COUNT)//i) { - unless ( $_matched || defined($return) || defined($score) ) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_COUNT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/REGR_INTERCEPT/i, or /REGR_ICPT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[62]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_63_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_63_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_63_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{view_name}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{view_name}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{view_name}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_63_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cond -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_cond"}; + } - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_cond]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_INTERCEPT/i, or /REGR_ICPT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_trace( + q{Trying production: [/REGR_R2/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[63]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_R2/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_R2)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_R2/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/AND/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_cond}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cond}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REGR_SLOPE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[64]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/AND/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_SLOPE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_SLOPE)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AND)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_SLOPE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REGR_SXX/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[65]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/AND/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_SXX/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_SXX)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_SXX/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/OR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_cond}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cond}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REGR_SXY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[66]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/OR/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_SXY/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_SXY)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:OR)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_SXY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/OR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/REGR_SYY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[67]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_SYY/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_SYY)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_cond}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numbering_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"numbering_function"}; - Parse::RecDescent::_trace(q{Trying rule: [numbering_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{numbering_function}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_SYY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; + while (!$_matched && !$commit) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{Trying production: [/RTRIM/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[68]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{Trying terminal: [/RTRIM/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RTRIM)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - while (!$_matched && !$commit) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying production: [/ROW_NUMBER|ROWNUMBER/i '()' /OVER/i '(' window_partition_clause window_order_clause /RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{numbering_function}); - %item = (__RULE__ => q{numbering_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{>>Matched production: [/RTRIM/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying terminal: [/ROW_NUMBER|ROWNUMBER/i]}, Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying production: [/SECOND/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[69]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/SECOND/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ROW_NUMBER|ROWNUMBER)//i) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SECOND)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/SECOND/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying terminal: ['()']}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'()'})->at($text); + Parse::RecDescent::_trace( + q{Trying production: [/SMALLINT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[70]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/SMALLINT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(\)//) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SMALLINT)//i) { - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/SMALLINT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying terminal: [/OVER/i]}, Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/OVER/i})->at($text); + Parse::RecDescent::_trace( + q{Trying production: [/STDDEV/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[71]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/STDDEV/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:OVER)//i) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:STDDEV)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/STDDEV/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/SUBSTR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[72]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/SUBSTR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SUBSTR)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying repeated subrule: [window_partition_clause]}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $expectation->is(q{window_partition_clause})->at($text); + push @item, $item{__PATTERN1__} = $&; - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_partition_clause, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/SUBSTR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [window_partition_clause]<< (} - . @$_tok . q{ times)}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{window_partition_clause(?)}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/SUM/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[73]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/SUM/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{Trying repeated subrule: [window_order_clause]}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SUM)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $expectation->is(q{window_order_clause})->at($text); + push @item, $item{__PATTERN1__} = $&; - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_numbering_function, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/SUM/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_numbering_function]<< (} - . @$_tok . q{ times)}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_numbering_function(?)}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/TABLE_NAME/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[74]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/TABLE_NAME/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{Trying repeated subrule: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TABLE_NAME)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $expectation->is(q{/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause})->at($text); + push @item, $item{__PATTERN1__} = $&; - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_numbering_function, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/TABLE_NAME/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_2_of_production_1_of_rule_numbering_function]<< (} - . @$_tok . q{ times)}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_2_of_production_1_of_rule_numbering_function(?)}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/TABLE_SCHEMA/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[75]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/TABLE_SCHEMA/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TABLE_SCHEMA)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/TABLE_SCHEMA/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING3__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/ROW_NUMBER|ROWNUMBER/i '()' /OVER/i '(' window_partition_clause window_order_clause /RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i, or window_aggregation_group_clause ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/TIME/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[76]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/TIME/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TIME)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{numbering_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{numbering_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{numbering_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_aggregation_group_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_window_aggregation_group_clause"}; - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/TIME/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_trace( + q{Trying production: [/TIMESTAMP/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[77]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{Trying terminal: [/TIMESTAMP/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TIMESTAMP)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/TIMESTAMP/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/ROWS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/TRANSLATE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[78]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/ROWS/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/TRANSLATE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TRANSLATE)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ROWS)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/TRANSLATE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/TYPE_ID/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[79]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/ROWS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying terminal: [/TYPE_ID/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TYPE_ID)//i) { - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RANGE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RANGE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RANGE)//i) - { - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/TYPE_ID/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{>>Matched production: [/RANGE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/TYPE_NAME/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[80]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/TYPE_NAME/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TYPE_NAME)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound1 -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"group_bound1"}; - - Parse::RecDescent::_trace(q{Trying rule: [group_bound1]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound1}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/TYPE_NAME/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/TYPE_SCHEMA/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[81]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound1}); - %item = (__RULE__ => q{group_bound1}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/TYPE_SCHEMA/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TYPE_SCHEMA)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/TYPE_SCHEMA/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/UCASE/i, or /UPPER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[82]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_83_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_83_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_83_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) - { + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_83_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [/UCASE/i, or /UPPER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/VALUE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[83]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/VALUE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:VALUE)//i) { - Parse::RecDescent::_trace(q{Trying production: [unsigned_constant /PRECEDING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound1}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound1}); - %item = (__RULE__ => q{group_bound1}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [unsigned_constant]}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/VALUE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [unsigned_constant]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{unsigned_constant}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/VARCHAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[84]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/PRECEDING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/PRECEDING/i})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/VARCHAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:VARCHAR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:PRECEDING)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/VARCHAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/VARGRAPHIC/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[85]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [unsigned_constant /PRECEDING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/VARGRAPHIC/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:VARGRAPHIC)//i) { - Parse::RecDescent::_trace(q{Trying production: [unsigned_constant /FOLLOWING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound1}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound1}); - %item = (__RULE__ => q{group_bound1}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/VARGRAPHIC/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/VARIANCE/i, or /VAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[86]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_87_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_87_of_rule_sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_87_of_rule_sysibm_function]<< (return value: [} + . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [unsigned_constant]}, Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{sysibm_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_87_of_rule_sysibm_function}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + } + + Parse::RecDescent::_trace( + q{>>Matched production: [/VARIANCE/i, or /VAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [unsigned_constant]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{unsigned_constant}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/YEAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[87]; + $text = $_[1]; + my $_savetext; + @item = (q{sysibm_function}); + %item = (__RULE__ => q{sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/FOLLOWING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/FOLLOWING/i})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/YEAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:YEAR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FOLLOWING)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/YEAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{sysibm_function}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_partition_clause { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"window_partition_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [window_partition_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/PARTITION\\s+BY/i ]}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{window_partition_clause}); + %item = (__RULE__ => q{window_partition_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/PARTITION\\s+BY/i]}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:PARTITION\s+BY)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{Trying operator: []}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is( + q{} + )->at($text); + + $_tok = undef; + OPLOOP: while (1) { + $repcount = 0; + my @item; + # MATCH LEFTARG + Parse::RecDescent::_trace( + q{Trying subrule: [partitioning_expression]}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{partitioning_expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::partitioning_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [partitioning_expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: [unsigned_constant /FOLLOWING/i]<<}, Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{window_partition_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{partitioning_expression}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + $repcount++; - Parse::RecDescent::_trace(q{Trying production: [/CURRENT\\s+ROW/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound1}); - %item = (__RULE__ => q{group_bound1}); - my $repcount = 0; + my $savetext = $text; + my $backtrack; + # MATCH (OP RIGHTARG)(s) + while ($repcount < 100000000) { + $backtrack = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/CURRENT\\s+ROW/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/,/]}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/,/})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:,)//) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CURRENT\s+ROW)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + pop @item; + if (defined $1) { + push @item, $item{'partitioning_expression(s)'} = $1; + $backtrack = 1; + } + + Parse::RecDescent::_trace( + q{Trying subrule: [partitioning_expression]}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{partitioning_expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::partitioning_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [partitioning_expression]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{partitioning_expression}} = $_tok; + push @item, $_tok; + + } + + $savetext = $text; + $repcount++; + } + $text = $savetext; + pop @item if $backtrack; + + unless (@item) { undef $_tok; last } + $_tok = [@item]; + last; + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + unless ($repcount >= 1) { + Parse::RecDescent::_trace( + q{<]>>}, + Parse::RecDescent::_tracefirst($text), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched operator: []<< (return value: [} + . qq{@{$_tok||[]}} . q{]}, + Parse::RecDescent::_tracefirst($text), q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + + push @item, $item{'partitioning_expression(s)'} = $_tok || []; + + Parse::RecDescent::_trace( + q{>>Matched production: [/PARTITION\\s+BY/i ]<<}, + Parse::RecDescent::_tracefirst($text), q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_partition_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{window_partition_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{window_partition_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{window_partition_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::WHERE { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"WHERE"}; + + Parse::RecDescent::_trace(q{Trying rule: [WHERE]}, Parse::RecDescent::_tracefirst($_[1]), q{WHERE}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/where/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{WHERE}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{WHERE}); + %item = (__RULE__ => q{WHERE}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/where/i]}, + Parse::RecDescent::_tracefirst($text), + q{WHERE}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:where)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/where/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{WHERE}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{WHERE}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{WHERE}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{WHERE}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{WHERE}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"CREATE"}; + + Parse::RecDescent::_trace(q{Trying rule: [CREATE]}, Parse::RecDescent::_tracefirst($_[1]), q{CREATE}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/create/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{CREATE}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{CREATE}); + %item = (__RULE__ => q{CREATE}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/create/i]}, + Parse::RecDescent::_tracefirst($text), + q{CREATE}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:create)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/create/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{CREATE}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{CREATE}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{CREATE}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{CREATE}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{CREATE}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysfun { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_sysfun"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_sysfun]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ABS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_sysfun}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysfun}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/ABS/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ABS)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/ABS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ABSVAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_sysfun}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/CURRENT\\s+ROW/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/ABSVAL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ABSVAL)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound1}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{group_bound1}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{group_bound1}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{group_bound1}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::OLAP_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"OLAP_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [OLAP_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ABSVAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_sysfun}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/SYSIBM\\.|/i sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/SYSIBM\\.|/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SYSIBM\.|)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [sysibm_function]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{sysibm_function})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysibm_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [sysibm_function]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{sysibm_function}} = $_tok; + push @item, $_tok; - my $err_at = @{$thisparser->{errors}}; + } - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{>>Matched production: [/SYSIBM\\.|/i sysibm_function]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/SYSFUN\\.|/i sysfun_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/SYSFUN\\.|/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SYSFUN\.|)//i) { - Parse::RecDescent::_trace(q{Trying production: [ranking_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{OLAP_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{OLAP_function}); - %item = (__RULE__ => q{OLAP_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [sysfun_function]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{sysfun_function})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysfun_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [sysfun_function]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [ranking_function]}, Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ranking_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [ranking_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{ranking_function}} = $_tok; - push @item, $_tok; - - } - + q{_alternation_1_of_production_1_of_rule_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{sysfun_function}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{>>Matched production: [ranking_function]<<}, - Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + } + Parse::RecDescent::_trace( + q{>>Matched production: [/SYSFUN\\.|/i sysfun_function]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [userdefined_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [userdefined_function]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::userdefined_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [userdefined_function]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{userdefined_function}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [numbering_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{OLAP_function}); - %item = (__RULE__ => q{OLAP_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{>>Matched production: [userdefined_function]<<}, Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::identifier { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"identifier"}; + + Parse::RecDescent::_trace( + q{Trying rule: [identifier]}, + Parse::RecDescent::_tracefirst($_[1]), + q{identifier}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{identifier}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{identifier}); + %item = (__RULE__ => q{identifier}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{identifier}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{identifier}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [numbering_function]}, Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numbering_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{identifier}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [numbering_function]<< (return value: [} - . $_tok . q{]}, + } + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{identifier}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{identifier}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{identifier}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{identifier}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{identifier}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"} + {"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [asc_option]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [asc_option]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::asc_option( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{numbering_function}} = $_tok; - push @item, $_tok; + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [asc_option]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{asc_option}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [numbering_function]<<}, + Parse::RecDescent::_trace( + q{>>Matched production: [asc_option]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [desc_option]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [desc_option]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::desc_option( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [desc_option]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{desc_option}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [aggregation_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{OLAP_function}); - %item = (__RULE__ => q{OLAP_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{>>Matched production: [desc_option]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"result_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [result_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{result_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{result_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{result_expression}); + %item = (__RULE__ => q{result_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{result_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{result_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [aggregation_function]}, Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::aggregation_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{result_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [aggregation_function]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{aggregation_function}} = $_tok; - push @item, $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{result_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{result_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{result_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{result_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{result_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scoped_reference_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"scoped_reference_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [scoped_reference_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{scoped_reference_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{scoped_reference_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{scoped_reference_expression}); + %item = (__RULE__ => q{scoped_reference_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{scoped_reference_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{scoped_reference_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{scoped_reference_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [aggregation_function]<<}, - Parse::RecDescent::_tracefirst($text), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{scoped_reference_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_tok = ($_noactions) ? 0 : do { # scoped, reference + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{scoped_reference_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{scoped_reference_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{scoped_reference_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{scoped_reference_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{scoped_reference_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"} + {"_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [typed_table_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [typed_table_name]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::typed_table_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [typed_table_name]<< (return value: [} . $_tok . q{]}, - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{typed_table_name}} = $_tok; + push @item, $_tok; + } - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{OLAP_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{OLAP_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, + Parse::RecDescent::_trace( + q{>>Matched production: [typed_table_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [typed_view_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [typed_view_name]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::typed_view_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - , q{OLAP_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [typed_view_name]<< (return value: [} . $_tok . q{]}, -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_30_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_30_of_rule_sysibm_function"}; + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{typed_view_name}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_30_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) + } + + Parse::RecDescent::_trace( + q{>>Matched production: [typed_view_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::when_clause { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"when_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/WHEN/i '(' search_condition ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{when_clause}); + %item = (__RULE__ => q{when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/WHEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:WHEN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); - my $err_at = @{$thisparser->{errors}}; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [search_condition]}, + Parse::RecDescent::_tracefirst($text), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{search_condition})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [search_condition]<< (return value: [} . $_tok . q{]}, - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_tracefirst($text), + q{when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{search_condition}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - Parse::RecDescent::_trace(q{Trying production: [/DOUBLE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_30_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_30_of_rule_sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{when_clause}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying terminal: [/DOUBLE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { $return = $item[3] }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DOUBLE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/WHEN/i '(' search_condition ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{when_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{when_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{when_clause}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{when_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_asc_option { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_asc_option"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_asc_option]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/NULLS\\s+FIRST/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_asc_option}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_asc_option}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/NULLS\\s+FIRST/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULLS\s+FIRST)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/NULLS\\s+FIRST/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/DOUBLE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_asc_option}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_asc_option}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULLS\s+LAST)//i) { - Parse::RecDescent::_trace(q{Trying production: [/DOUBLE_PRECISION/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_30_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_30_of_rule_sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NULLS\\s+LAST/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_asc_option}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_name { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"sequence_name"}; + + Parse::RecDescent::_trace( + q{Trying rule: [sequence_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sequence_name}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sequence_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{sequence_name}); + %item = (__RULE__ => q{sequence_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{sequence_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sequence_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/DOUBLE_PRECISION/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - + Parse::RecDescent::_tracefirst($text), + q{sequence_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DOUBLE_PRECISION)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{sequence_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{sequence_name}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{sequence_name}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{sequence_name}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{sequence_name}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_duration { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"ld_duration"}; + + Parse::RecDescent::_trace( + q{Trying rule: [ld_duration]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/YEARS?/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_duration}); + %item = (__RULE__ => q{ld_duration}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/YEARS?/i]}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:YEARS?)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/YEARS?/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/DOUBLE_PRECISION/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/MONTHS?/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_duration}); + %item = (__RULE__ => q{ld_duration}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/MONTHS?/i]}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MONTHS?)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_30_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::FULL -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"FULL"}; - Parse::RecDescent::_trace(q{Trying rule: [FULL]}, - Parse::RecDescent::_tracefirst($_[1]), - q{FULL}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/MONTHS?/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/DAYS?/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_duration}); + %item = (__RULE__ => q{ld_duration}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: [/full/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{FULL}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{FULL}); - %item = (__RULE__ => q{FULL}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DAYS?/i]}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DAYS?)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/full/i]}, Parse::RecDescent::_tracefirst($text), - q{FULL}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:full)//i) - { - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DAYS?/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/full/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{FULL}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/HOURS?/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_duration}); + %item = (__RULE__ => q{ld_duration}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/HOURS?/i]}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:HOURS?)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{FULL}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{FULL}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{FULL}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{FULL}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cast_specification -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_cast_specification"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_2_of_production_1_of_rule_cast_specification]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/HOURS?/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/MINUTES?/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_duration}); + %item = (__RULE__ => q{ld_duration}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/MINUTES?/i]}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MINUTES?)//i) { - Parse::RecDescent::_trace(q{Trying production: [/SCOPE/ typed_table_name, or typed_view_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_cast_specification}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_cast_specification}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying terminal: [/SCOPE/]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{>>Matched production: [/MINUTES?/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SCOPE)//) - { + Parse::RecDescent::_trace( + q{Trying production: [/SECONDS?/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[5]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_duration}); + %item = (__RULE__ => q{ld_duration}); + my $repcount = 0; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [/SECONDS?/i]}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SECONDS?)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{typed_table_name, or typed_view_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/SECONDS?/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/MICROSECONDS?/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[6]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_duration}); + %item = (__RULE__ => q{ld_duration}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/MICROSECONDS?/i]}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/SCOPE/ typed_table_name, or typed_view_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MICROSECONDS?)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - unless ( $_matched || defined($return) || defined($score) ) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/MICROSECONDS?/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_duration}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{ld_duration}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{ld_duration}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{ld_duration}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_a { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"reference_a"}; + + Parse::RecDescent::_trace( + q{Trying rule: [reference_a]}, + Parse::RecDescent::_tracefirst($_[1]), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/REFERENCING/i old_new_corr old_new_table]}, + Parse::RecDescent::_tracefirst($_[1]), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{reference_a}); + %item = (__RULE__ => q{reference_a}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/REFERENCING/i]}, + Parse::RecDescent::_tracefirst($text), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REFERENCING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [old_new_corr]}, + Parse::RecDescent::_tracefirst($text), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{old_new_corr})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_corr, + 0, 2, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [old_new_corr]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{reference_a}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{old_new_corr(0..2)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [old_new_table]}, + Parse::RecDescent::_tracefirst($text), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{old_new_table})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_table, + 0, 2, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [old_new_table]<< (} . @$_tok . q{ times)}, + Parse::RecDescent::_tracefirst($text), + q{reference_a}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{old_new_table(0..2)}} = $_tok; + push @item, $_tok; - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{reference_a}, $tracelevel) if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::case_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"case_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [case_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{case_expression}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { + $return = join(' ', $item[1], join(' ', @{ $item[2] }), join(' ', @{ $item[3] })); + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/REFERENCING/i old_new_corr old_new_table]<<}, + Parse::RecDescent::_tracefirst($text), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{reference_a}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{reference_a}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{reference_a}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{reference_a}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cast_specification { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"cast_specification"}; + + Parse::RecDescent::_trace( + q{Trying rule: [cast_specification]}, + Parse::RecDescent::_tracefirst($_[1]), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CAST/i '(' expression, or /NULL/i, or parameter_marker /AS/i data_type /SCOPE/ ')']}, + Parse::RecDescent::_tracefirst($_[1]), q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{cast_specification}); + %item = (__RULE__ => q{cast_specification}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/CAST/i]}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CAST)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); - my $err_at = @{$thisparser->{errors}}; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_cast_specification]}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{expression, or /NULL/i, or parameter_marker}) + ->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cast_specification( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_cast_specification]<< (return value: [} + . $_tok . q{]}, - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_cast_specification}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying terminal: [/AS/i]}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/AS/i})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AS)//i) { - Parse::RecDescent::_trace(q{Trying production: [/CASE/i searched_when_clause, or simple_when_clause /ELSE\\s+NULL/i, or /ELSE/i /END/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{case_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{case_expression}); - %item = (__RULE__ => q{case_expression}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/CASE/i]}, Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [data_type]}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{data_type})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::data_type( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [data_type]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{data_type}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CASE)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/SCOPE/]}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{/SCOPE/})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cast_specification, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_2_of_production_1_of_rule_cast_specification]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_2_of_production_1_of_rule_cast_specification(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/CAST/i '(' expression, or /NULL/i, or parameter_marker /AS/i data_type /SCOPE/ ')']<<}, + Parse::RecDescent::_tracefirst($text), q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{cast_specification}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{cast_specification}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{cast_specification}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"type"}; + + Parse::RecDescent::_trace(q{Trying rule: [type]}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/UPDATE/i /OF/i ]}, + Parse::RecDescent::_tracefirst($_[1]), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{type}); + %item = (__RULE__ => q{type}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/UPDATE/i]}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UPDATE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{Trying terminal: [/OF/i]}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/OF/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:OF)//i) { - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_case_expression]}, - Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{searched_when_clause, or simple_when_clause})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_case_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN2__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_case_expression]<< (return value: [} - . $_tok . q{]}, + Parse::RecDescent::_trace( + q{Trying operator: []}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{}) + ->at($text); - Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_case_expression}} = $_tok; - push @item, $_tok; + $_tok = undef; + OPLOOP: while (1) { + $repcount = 0; + my @item; - } + # MATCH LEFTARG - Parse::RecDescent::_trace(q{Trying repeated subrule: [/ELSE\\s+NULL/i, or /ELSE/i]}, + Parse::RecDescent::_trace( + q{Trying subrule: [column_name]}, Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{/ELSE\\s+NULL/i, or /ELSE/i})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_case_expression, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, + q{type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{column_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_2_of_production_1_of_rule_case_expression]<< (} - . @$_tok . q{ times)}, + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_name]<< (return value: [} . $_tok . q{]}, Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_2_of_production_1_of_rule_case_expression(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [/END/i]}, Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/END/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:END)//i) - { + q{type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_name}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; + $repcount++; + my $savetext = $text; + my $backtrack; + # MATCH (OP RIGHTARG)(s) + while ($repcount < 100000000) { + $backtrack = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/CASE/i searched_when_clause, or simple_when_clause /ELSE\\s+NULL/i, or /ELSE/i /END/i]<<}, + Parse::RecDescent::_trace( + q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/,/})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:,)//) { - unless ( $_matched || defined($return) || defined($score) ) - { - + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{case_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{case_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN3__} = $&; + + pop @item; + if (defined $1) { + push @item, $item{'column_name(s)'} = $1; + $backtrack = 1; + } + + Parse::RecDescent::_trace( + q{Trying subrule: [column_name]}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{column_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_name]<< (return value: [} . $_tok . q{]}, -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::operator -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"operator"}; - - Parse::RecDescent::_trace(q{Trying rule: [operator]}, - Parse::RecDescent::_tracefirst($_[1]), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_name}} = $_tok; + push @item, $_tok; + + } + + $savetext = $text; + $repcount++; + } + $text = $savetext; + pop @item if $backtrack; + + unless (@item) { undef $_tok; last } + $_tok = [@item]; + last; + } + unless ($repcount >= 1) { + Parse::RecDescent::_trace( + q{<]>>}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched operator: []<< (return value: [} . qq{@{$_tok||[]}} . q{]}, + Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel + ) if defined $::RD_TRACE; - my $err_at = @{$thisparser->{errors}}; + push @item, $item{'column_name(s)'} = $_tok || []; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) + if defined $::RD_TRACE; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + $_tok = ($_noactions) ? 0 : do { + $return = { + event => 'update_on', + fields => $item[3] + }; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/UPDATE/i /OF/i ]<<}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/INSERT/i, or /DELETE/i, or /UPDATE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{type}); + %item = (__RULE__ => q{type}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_2_of_rule_type]}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_type( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_2_of_rule_type]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_2_of_rule_type}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{type}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying production: [/CONCAT/i, or '||']}, - Parse::RecDescent::_tracefirst($_[1]), - q{operator}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { $return = { event => $item[1] } }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{operator}); - %item = (__RULE__ => q{operator}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_operator]}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/INSERT/i, or /DELETE/i, or /UPDATE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{type}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{type}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{type}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{type}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_12_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_12_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_12_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/COVARIANCE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_12_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_12_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/COVARIANCE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:COVARIANCE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_operator($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/COVARIANCE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_operator]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_operator}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/COVAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_12_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_12_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/COVAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/CONCAT/i, or '||']<<}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:COVAR)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - while (!$_matched && !$commit) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/COVAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_12_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scalar_fullselect { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"scalar_fullselect"}; + + Parse::RecDescent::_trace( + q{Trying rule: [scalar_fullselect]}, + Parse::RecDescent::_tracefirst($_[1]), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['(' fullselect ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{scalar_fullselect}); + %item = (__RULE__ => q{scalar_fullselect}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [fullselect]}, + Parse::RecDescent::_tracefirst($text), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{fullselect})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::fullselect( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [fullselect]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: ['/']}, - Parse::RecDescent::_tracefirst($_[1]), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{operator}); - %item = (__RULE__ => q{operator}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{scalar_fullselect}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{fullselect}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{Trying terminal: ['/']}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\///) - { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' fullselect ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{scalar_fullselect}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{scalar_fullselect}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{scalar_fullselect}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{scalar_fullselect}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_options { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_options"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_options]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CASCADED/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_options}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_options}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/CASCADED/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CASCADED)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [/CASCADED/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: ['/']<<}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/LOCAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_options}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_options}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/LOCAL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LOCAL)//i) { - Parse::RecDescent::_trace(q{Trying production: ['*']}, - Parse::RecDescent::_tracefirst($_[1]), - q{operator}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{operator}); - %item = (__RULE__ => q{operator}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/LOCAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_options}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_options}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::func_args { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"func_args"}; + + Parse::RecDescent::_trace( + q{Trying rule: [func_args]}, + Parse::RecDescent::_tracefirst($_[1]), + q{func_args}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{func_args}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{func_args}); + %item = (__RULE__ => q{func_args}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{func_args}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{func_args}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: ['*']}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{func_args}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\*//) - { + Parse::RecDescent::_trace( + q{>>Matched production: [expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{func_args}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{func_args}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{func_args}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{func_args}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{func_args}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::trigger_name { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"trigger_name"}; + + Parse::RecDescent::_trace( + q{Trying rule: [trigger_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [SCHEMA '.' NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{trigger_name}); + %item = (__RULE__ => q{trigger_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [SCHEMA]}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [SCHEMA]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{SCHEMA}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying terminal: ['.']}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'.'})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: ['*']<<}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\.//) { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{NAME})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: ['+']}, - Parse::RecDescent::_tracefirst($_[1]), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{operator}); - %item = (__RULE__ => q{operator}); - my $repcount = 0; + } + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{trigger_name}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying terminal: ['+']}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) + $_tok + = ($_noactions) + ? 0 + : do { $return = { schema => $item[1], name => $item[3] } }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [SCHEMA '.' NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{trigger_name}); + %item = (__RULE__ => q{trigger_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\+//) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{trigger_name}, $tracelevel) + if defined $::RD_TRACE; + $_tok = ($_noactions) ? 0 : do { $return = { name => $item[1] } }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{trigger_name}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{trigger_name}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{trigger_name}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{trigger_name}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_numbering_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_numbering_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_2_of_production_1_of_rule_numbering_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_numbering_function}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_numbering_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RANGE\s+BETWEEN\s+UNBOUNDED\s+PRECEDING\s+AND\s+UNBBOUNDED\s+FOLLOWING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_numbering_function}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_numbering_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_aggregation_group_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [window_aggregation_group_clause]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{window_aggregation_group_clause}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{>>Matched production: ['+']<<}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + } + Parse::RecDescent::_trace( + q{>>Matched production: [window_aggregation_group_clause]<<}, Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_2_of_production_1_of_rule_numbering_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_name { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"method_name"}; + + Parse::RecDescent::_trace( + q{Trying rule: [method_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{method_name}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{method_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{method_name}); + %item = (__RULE__ => q{method_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{method_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{method_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{method_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: ['-']}, - Parse::RecDescent::_tracefirst($_[1]), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{operator}); - %item = (__RULE__ => q{operator}); - my $repcount = 0; + } + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{method_name}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying terminal: ['-']}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { # must be a method of subject_expression + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{method_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{method_name}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{method_name}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{method_name}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{method_name}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::quantified_p { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"quantified_p"}; + + Parse::RecDescent::_trace( + q{Trying rule: [quantified_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression1 /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ /SOME|ANY|ALL/i '(' fullselect ')']}, + Parse::RecDescent::_tracefirst($_[1]), q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{quantified_p}); + %item = (__RULE__ => q{quantified_p}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression1]}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression1( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression1]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\-//) - { + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression1}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + } + Parse::RecDescent::_trace( + q{Trying terminal: [/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/]}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/}) + ->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:(=|<>|<|>|<=|=>|\^=|\^<|\^>|\!=))//) { - Parse::RecDescent::_trace(q{>>Matched production: ['-']<<}, - Parse::RecDescent::_tracefirst($text), - q{operator}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/SOME|ANY|ALL/i]}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/SOME|ANY|ALL/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SOME|ANY|ALL)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{operator}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{operator}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{operator}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{operator}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_type -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_2_of_rule_type"}; - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_2_of_rule_type]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); - my $err_at = @{$thisparser->{errors}}; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [fullselect]}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{fullselect})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::fullselect( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [fullselect]<< (return value: [} . $_tok . q{]}, - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{fullselect}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - Parse::RecDescent::_trace(q{Trying production: [/INSERT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_2_of_rule_type}); - %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_type}); - my $repcount = 0; - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [expression1 /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ /SOME|ANY|ALL/i '(' fullselect ')']<<}, + Parse::RecDescent::_tracefirst($text), q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{quantified_p}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{quantified_p}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{quantified_p}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{quantified_p}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::common_table_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"common_table_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [common_table_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [table_name column_list /AS/i get_bracketed]}, + Parse::RecDescent::_tracefirst($_[1]), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{common_table_expression}); + %item = (__RULE__ => q{common_table_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [table_name]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [table_name]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/INSERT/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{table_name}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:INSERT)//i) - { + Parse::RecDescent::_trace( + q{Trying subrule: [column_list]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{column_list})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_list]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_list}} = $_tok; + push @item, $_tok; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + } + Parse::RecDescent::_trace( + q{Trying terminal: [/AS/i]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/AS/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AS)//i) { - Parse::RecDescent::_trace(q{>>Matched production: [/INSERT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [get_bracketed]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{get_bracketed})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::get_bracketed( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [get_bracketed]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{get_bracketed}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/DELETE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_2_of_rule_type}); - %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_type}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + + $_tok = ($_noactions) ? 0 : do { + $return = { + name => $item{table_name}{name}, + query => $item[4] + }; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [table_name column_list /AS/i get_bracketed]<<}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [table_name column_list /AS/i '(' fullselect ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{common_table_expression}); + %item = (__RULE__ => q{common_table_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [table_name]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [table_name]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/DELETE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{table_name}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DELETE)//i) - { + Parse::RecDescent::_trace( + q{Trying subrule: [column_list]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{column_list})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_list]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_list}} = $_tok; + push @item, $_tok; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + } + Parse::RecDescent::_trace( + q{Trying terminal: [/AS/i]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/AS/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AS)//i) { - Parse::RecDescent::_trace(q{>>Matched production: [/DELETE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } - - while (!$_matched && !$commit) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying production: [/UPDATE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_2_of_rule_type}); - %item = (__RULE__ => q{_alternation_1_of_production_2_of_rule_type}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - Parse::RecDescent::_trace(q{Trying terminal: [/UPDATE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [fullselect]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{fullselect})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::fullselect( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [fullselect]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{fullselect}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UPDATE)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [table_name column_list /AS/i '(' fullselect ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{common_table_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{common_table_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{common_table_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{common_table_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::after { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"after"}; + + Parse::RecDescent::_trace(q{Trying rule: [after]}, Parse::RecDescent::_tracefirst($_[1]), q{after}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/AFTER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{after}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{after}); + %item = (__RULE__ => q{after}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/AFTER/i]}, + Parse::RecDescent::_tracefirst($text), + q{after}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AFTER)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/AFTER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{after}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{after}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{after}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{after}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{after}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::predicate { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"predicate"}; + + Parse::RecDescent::_trace( + q{Trying rule: [predicate]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [basic_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [basic_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::basic_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [basic_p]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{basic_p}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{>>Matched production: [/UPDATE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + } + Parse::RecDescent::_trace( + q{>>Matched production: [basic_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [quantified_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [quantified_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::quantified_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [quantified_p]<< (return value: [} . $_tok . q{]}, - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{quantified_p}} = $_tok; + push @item, $_tok; + } - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_2_of_rule_type}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + Parse::RecDescent::_trace( + q{>>Matched production: [quantified_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [between_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [between_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::between_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [between_p]<< (return value: [} . $_tok . q{]}, -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_8_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_8_of_rule_sysibm_function"}; + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{between_p}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_8_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [between_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [exists_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [exists_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::exists_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [exists_p]<< (return value: [} . $_tok . q{]}, - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{exists_p}} = $_tok; + push @item, $_tok; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{>>Matched production: [exists_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [in_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [in_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::in_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [in_p]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{in_p}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [in_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [like_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[5]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [like_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::like_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [like_p]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: [/CONCAT/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_8_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_8_of_rule_sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{like_p}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{Trying terminal: [/CONCAT/]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{>>Matched production: [like_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [null_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[6]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [null_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::null_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [null_p]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{null_p}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CONCAT)//) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{>>Matched production: [null_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [type_p]}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[7]; + $text = $_[1]; + my $_savetext; + @item = (q{predicate}); + %item = (__RULE__ => q{predicate}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [type_p]}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type_p( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [type_p]<< (return value: [} . $_tok . q{]}, - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_tracefirst($text), + q{predicate}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{type_p}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{>>Matched production: [type_p]<<}, + Parse::RecDescent::_tracefirst($text), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{predicate}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{predicate}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{predicate}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{predicate}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"column_name"}; + + Parse::RecDescent::_trace( + q{Trying rule: [column_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{column_name}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{column_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{column_name}); + %item = (__RULE__ => q{column_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{column_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{column_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: [/CONCAT/]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_tracefirst($text), + q{column_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{column_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{column_name}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{column_name}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{column_name}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{column_name}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_invocation { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"method_invocation"}; + + Parse::RecDescent::_trace( + q{Trying rule: [method_invocation]}, + Parse::RecDescent::_tracefirst($_[1]), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [subject_expression '..' method_name '(']}, + Parse::RecDescent::_tracefirst($_[1]), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{method_invocation}); + %item = (__RULE__ => q{method_invocation}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [subject_expression]}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subject_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [subject_expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: ['||']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_8_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_8_of_rule_sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{subject_expression}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{Trying terminal: ['||']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: ['..']}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'..'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\.\.//) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\|\|//) - { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [method_name]}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{method_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [method_name]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{method_name}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying repeated subrule: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{'('})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_method_invocation, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_method_invocation]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_method_invocation(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [subject_expression '..' method_name '(']<<}, + Parse::RecDescent::_tracefirst($text), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{method_invocation}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{method_invocation}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{method_invocation}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_dereference_operation + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_dereference_operation"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_dereference_operation]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['(' expression ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_dereference_operation}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_dereference_operation}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{expression})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression, + 1, 100000000, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [expression]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression(s)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' expression ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_dereference_operation}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_searched_when_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_searched_when_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_searched_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_searched_when_clause}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_searched_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/WHEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:WHEN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [search_condition]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{search_condition})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [search_condition]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: ['||']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{search_condition}} = $_tok; + push @item, $_tok; + } - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/THEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/THEN/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:THEN)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_8_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_reference -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"sequence_reference"}; - - Parse::RecDescent::_trace(q{Trying rule: [sequence_reference]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{result_expression, or /NULL/i})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}} + = $_tok; + push @item, $_tok; - my $err_at = @{$thisparser->{errors}}; + } - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{>>Matched production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_searched_when_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound2 { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"group_bound2"}; + + Parse::RecDescent::_trace( + q{Trying rule: [group_bound2]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound2}); + %item = (__RULE__ => q{group_bound2}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [unsigned_constant /PRECEDING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound2}); + %item = (__RULE__ => q{group_bound2}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [unsigned_constant]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [unsigned_constant]<< (return value: [} . $_tok . q{]}, - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{unsigned_constant}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying terminal: [/PRECEDING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/PRECEDING/i})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:PRECEDING)//i) { - Parse::RecDescent::_trace(q{Trying production: [nextval_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sequence_reference}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{sequence_reference}); - %item = (__RULE__ => q{sequence_reference}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [unsigned_constant /PRECEDING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [unsigned_constant /FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound2}); + %item = (__RULE__ => q{group_bound2}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [unsigned_constant]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [unsigned_constant]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [nextval_expression]}, Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::nextval_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{group_bound2}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{unsigned_constant}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [nextval_expression]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/FOLLOWING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/FOLLOWING/i})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FOLLOWING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $item{q{nextval_expression}} = $_tok; - push @item, $_tok; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [unsigned_constant /FOLLOWING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; } + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [nextval_expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/CURRENT\\s+ROW/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{group_bound2}); + %item = (__RULE__ => q{group_bound2}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/CURRENT\\s+ROW/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CURRENT\s+ROW)//i) { - Parse::RecDescent::_trace(q{Trying production: [prevval_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sequence_reference}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{sequence_reference}); - %item = (__RULE__ => q{sequence_reference}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [prevval_expression]}, + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/CURRENT\\s+ROW/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_bound2}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{group_bound2}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{group_bound2}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{group_bound2}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::searched_when_clause { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"searched_when_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [searched_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/WHEN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{searched_when_clause}); + %item = (__RULE__ => q{searched_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/WHEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_searched_when_clause, + 1, + 100000000, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::prevval_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_searched_when_clause]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_searched_when_clause(s)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/WHEN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{searched_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{searched_when_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{searched_when_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{searched_when_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::basic_p { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"basic_p"}; + + Parse::RecDescent::_trace(q{Trying rule: [basic_p]}, Parse::RecDescent::_tracefirst($_[1]), q{basic_p}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{basic_p}); + %item = (__RULE__ => q{basic_p}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [prevval_expression]<< (return value: [} - . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{basic_p}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{prevval_expression}} = $_tok; - push @item, $_tok; + } - } + Parse::RecDescent::_trace( + q{Trying terminal: [/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/]}, + Parse::RecDescent::_tracefirst($text), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/}) + ->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:(=|<>|<|>|<=|=>|\^=|\^<|\^>|\!=))//) { - Parse::RecDescent::_trace(q{>>Matched production: [prevval_expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{sequence_reference}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_tracefirst($text), + q{basic_p}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; + } - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{sequence_reference}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{sequence_reference}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{sequence_reference}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{>>Matched production: [expression /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{basic_p}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{basic_p}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{basic_p}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{basic_p}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::asc_option { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"asc_option"}; + + Parse::RecDescent::_trace( + q{Trying rule: [asc_option]}, + Parse::RecDescent::_tracefirst($_[1]), + q{asc_option}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ASC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{asc_option}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{asc_option}); + %item = (__RULE__ => q{asc_option}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/ASC/i]}, + Parse::RecDescent::_tracefirst($text), + q{asc_option}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ASC)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($text), + q{asc_option}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i}) + ->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_asc_option, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{asc_option}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_asc_option]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{asc_option}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_asc_option(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ASC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{asc_option}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{asc_option}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{asc_option}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{asc_option}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{asc_option}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"search_condition"}; + + Parse::RecDescent::_trace( + q{Trying rule: [search_condition]}, + Parse::RecDescent::_tracefirst($_[1]), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/[^)]+/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{search_condition}); + %item = (__RULE__ => q{search_condition}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/[^)]+/]}, + Parse::RecDescent::_tracefirst($text), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:[^)]+)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/[^)]+/]<<}, + Parse::RecDescent::_tracefirst($text), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - my $err_at = @{$thisparser->{errors}}; + while (!$_matched && !$commit) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_trace( + q{Trying production: [/NOT|/i predicate, or '(' cond]}, + Parse::RecDescent::_tracefirst($_[1]), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{search_condition}); + %item = (__RULE__ => q{search_condition}); + my $repcount = 0; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{Trying terminal: [/NOT|/i]}, + Parse::RecDescent::_tracefirst($text), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NOT|)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - while (!$_matched && !$commit) - { + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_2_of_rule_search_condition]}, + Parse::RecDescent::_tracefirst($text), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{predicate, or '('})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_search_condition( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_2_of_rule_search_condition]<< (return value: [} + . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: [/ABS/i, or /ABSVAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_2_of_rule_search_condition}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_sysibm_function]}, + Parse::RecDescent::_trace( + q{Trying repeated subrule: [cond]}, + Parse::RecDescent::_tracefirst($text), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{cond})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cond, + 0, 100000000, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [cond]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{cond(s?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NOT|/i predicate, or '(' cond]<<}, + Parse::RecDescent::_tracefirst($text), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{search_condition}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{search_condition}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{search_condition}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{search_condition}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_operator { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_operator"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_operator]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CONCAT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_operator}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_operator}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/CONCAT/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CONCAT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/CONCAT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: ['||']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_operator}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_operator}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: ['||']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/ABS/i, or /ABSVAL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\|\|//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['||']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_operator}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::simple_when_clause { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"simple_when_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [simple_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression /WHEN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{simple_when_clause}); + %item = (__RULE__ => q{simple_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/WHEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{/WHEN/i})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_simple_when_clause, + 1, + 100000000, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_simple_when_clause]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_simple_when_clause(s)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [expression /WHEN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{simple_when_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{simple_when_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{simple_when_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::INNER { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"INNER"}; + + Parse::RecDescent::_trace(q{Trying rule: [INNER]}, Parse::RecDescent::_tracefirst($_[1]), q{INNER}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/inner/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{INNER}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{INNER}); + %item = (__RULE__ => q{INNER}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/inner/i]}, + Parse::RecDescent::_tracefirst($text), + q{INNER}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:inner)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/inner/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{INNER}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{INNER}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{INNER}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{INNER}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{INNER}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::eofile { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"eofile"}; + + Parse::RecDescent::_trace(q{Trying rule: [eofile]}, Parse::RecDescent::_tracefirst($_[1]), q{eofile}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/^\\Z/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{eofile}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{eofile}); + %item = (__RULE__ => q{eofile}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/^\\Z/]}, + Parse::RecDescent::_tracefirst($text), + q{eofile}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:^\Z)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/^\\Z/]<<}, + Parse::RecDescent::_tracefirst($text), + q{eofile}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{eofile}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{eofile}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{eofile}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{eofile}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cond { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"cond"}; + + Parse::RecDescent::_trace(q{Trying rule: [cond]}, Parse::RecDescent::_tracefirst($_[1]), q{cond}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/AND/i, or /OR/i /NOT|/i predicate, or '(']}, + Parse::RecDescent::_tracefirst($_[1]), + q{cond}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{cond}); + %item = (__RULE__ => q{cond}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_cond]}, + Parse::RecDescent::_tracefirst($text), + q{cond}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cond( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{cond}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_cond]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: [/AVG/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{cond}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_cond}} = $_tok; + push @item, $_tok; + + } + Parse::RecDescent::_trace( + q{Trying terminal: [/NOT|/i]}, + Parse::RecDescent::_tracefirst($text), + q{cond}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/NOT|/i})->at($text); - Parse::RecDescent::_trace(q{Trying terminal: [/AVG/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NOT|)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_2_of_production_1_of_rule_cond]}, + Parse::RecDescent::_tracefirst($text), + q{cond}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{predicate, or '('})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cond( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{cond}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_2_of_production_1_of_rule_cond]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AVG)//i) - { + Parse::RecDescent::_tracefirst($text), + q{cond}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_2_of_production_1_of_rule_cond}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{>>Matched production: [/AND/i, or /OR/i /NOT|/i predicate, or '(']<<}, + Parse::RecDescent::_tracefirst($text), + q{cond}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{cond}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{cond}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{cond}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{cond}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_type { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"ld_type"}; + + Parse::RecDescent::_trace(q{Trying rule: [ld_type]}, Parse::RecDescent::_tracefirst($_[1]), q{ld_type}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_type}); + %item = (__RULE__ => q{ld_type}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [function]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [function]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{function}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/AVG/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{>>Matched production: [function]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: ['(' expression ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_type}); + %item = (__RULE__ => q{ld_type}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: [/BIGINT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - Parse::RecDescent::_trace(q{Trying terminal: [/BIGINT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:BIGINT)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' expression ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [constant]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_type}); + %item = (__RULE__ => q{ld_type}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [constant]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [constant]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{constant}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{>>Matched production: [/BIGINT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + } + Parse::RecDescent::_trace( + q{>>Matched production: [constant]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [column_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_type}); + %item = (__RULE__ => q{ld_type}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [column_name]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_name]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{ld_type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_name}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/BLOB/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{>>Matched production: [column_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [host_variable]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{ld_type}); + %item = (__RULE__ => q{ld_type}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [host_variable]}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::host_variable( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [host_variable]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/BLOB/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{ld_type}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{host_variable}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:BLOB)//i) - { + Parse::RecDescent::_trace( + q{>>Matched production: [host_variable]<<}, + Parse::RecDescent::_tracefirst($text), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{ld_type}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{ld_type}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{ld_type}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{ld_type}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::RIGHT { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"RIGHT"}; + + Parse::RecDescent::_trace(q{Trying rule: [RIGHT]}, Parse::RecDescent::_tracefirst($_[1]), q{RIGHT}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/right/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{RIGHT}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{RIGHT}); + %item = (__RULE__ => q{RIGHT}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/right/i]}, + Parse::RecDescent::_tracefirst($text), + q{RIGHT}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:right)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/right/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{RIGHT}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{RIGHT}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{RIGHT}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{RIGHT}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{RIGHT}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_method_invocation + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_method_invocation"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_method_invocation]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['(' expression ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_method_invocation}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_method_invocation}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{expression})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression, + 1, 100000000, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [expression]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_method_invocation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression(s)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' expression ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_method_invocation}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::LEFT { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"LEFT"}; + + Parse::RecDescent::_trace(q{Trying rule: [LEFT]}, Parse::RecDescent::_tracefirst($_[1]), q{LEFT}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/left/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{LEFT}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{LEFT}); + %item = (__RULE__ => q{LEFT}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/left/i]}, + Parse::RecDescent::_tracefirst($text), + q{LEFT}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:left)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/left/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{LEFT}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{LEFT}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{LEFT}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{LEFT}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{LEFT}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"table_name"}; + + Parse::RecDescent::_trace( + q{Trying rule: [table_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [SCHEMA '.' NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{table_name}); + %item = (__RULE__ => q{table_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [SCHEMA]}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [SCHEMA]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{table_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{SCHEMA}} = $_tok; + push @item, $_tok; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + } + Parse::RecDescent::_trace( + q{Trying terminal: ['.']}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'.'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\.//) { - Parse::RecDescent::_trace(q{>>Matched production: [/BLOB/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{NAME})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{table_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/CHAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{table_name}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying terminal: [/CHAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $_tok + = ($_noactions) + ? 0 + : do { $return = { schema => $item[1], name => $item[3] } }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [SCHEMA '.' NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{table_name}); + %item = (__RULE__ => q{table_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CHAR)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{table_name}, $tracelevel) if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) + $_tok = ($_noactions) ? 0 : do { $return = { name => $item[1] } }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{table_name}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{table_name}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{table_name}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{table_name}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_53_of_rule_sysfun { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_53_of_rule_sysfun"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_53_of_rule_sysfun]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/TRUNCATE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_53_of_rule_sysfun}); + %item = (__RULE__ => q{_alternation_1_of_production_53_of_rule_sysfun}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/TRUNCATE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TRUNCATE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/TRUNCATE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/CHAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/TRUNC/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_53_of_rule_sysfun}); + %item = (__RULE__ => q{_alternation_1_of_production_53_of_rule_sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/TRUNC/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TRUNC)//i) { - Parse::RecDescent::_trace(q{Trying production: [/CLOB/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[5]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/TRUNC/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_53_of_rule_sysfun}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::options { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"options"}; + + Parse::RecDescent::_trace(q{Trying rule: [options]}, Parse::RecDescent::_tracefirst($_[1]), q{options}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/WITH/i /CASCADED/i, or /LOCAL/i /CHECK\\s+OPTION/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{options}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{options}); + %item = (__RULE__ => q{options}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/WITH/i]}, + Parse::RecDescent::_tracefirst($text), + q{options}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:WITH)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_options]}, + Parse::RecDescent::_tracefirst($text), + q{options}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{/CASCADED/i, or /LOCAL/i})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_options( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{options}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_options]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/CLOB/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{options}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_options}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CLOB)//i) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/CHECK\\s+OPTION/i]}, + Parse::RecDescent::_tracefirst($text), + q{options}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/CHECK\\s+OPTION/i})->at($text); - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CHECK\s+OPTION)//i) { - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/WITH/i /CASCADED/i, or /LOCAL/i /CHECK\\s+OPTION/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{options}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{options}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{options}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{options}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{options}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/SYSIBM\\.|/i, or /SYSFUN\\.|/i, or userdefined_function '(' ')']}, + Parse::RecDescent::_tracefirst($_[1]), q{function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{function}); + %item = (__RULE__ => q{function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_function]}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_function]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_function}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{>>Matched production: [/CLOB/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + } + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - Parse::RecDescent::_trace(q{Trying production: [/COALESCE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[6]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + Parse::RecDescent::_trace( + q{Trying operator: []}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{Trying terminal: [/COALESCE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + $_tok = undef; + OPLOOP: while (1) { + $repcount = 0; + my @item; + # MATCH LEFTARG - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:COALESCE)//i) - { + Parse::RecDescent::_trace( + q{Trying subrule: [func_args]}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{func_args})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::func_args( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [func_args]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{func_args}} = $_tok; + push @item, $_tok; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + } + $repcount++; + my $savetext = $text; + my $backtrack; - Parse::RecDescent::_trace(q{>>Matched production: [/COALESCE/i]<<}, + # MATCH (OP RIGHTARG)(s) + while ($repcount < 100000000) { + $backtrack = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/,/})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:,)//) { - while (!$_matched && !$commit) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying production: [/CONCAT/, or '||']}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[7]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + pop @item; + if (defined $1) { + push @item, $item{'func_args(s)'} = $1; + $backtrack = 1; + } + + Parse::RecDescent::_trace( + q{Trying subrule: [func_args]}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{func_args})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::func_args( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [func_args]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{func_args}} = $_tok; + push @item, $_tok; + + } + + $savetext = $text; + $repcount++; + } + $text = $savetext; + pop @item if $backtrack; + + unless (@item) { undef $_tok; last } + $_tok = [@item]; + last; + } - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_8_of_rule_sysibm_function]}, + unless ($repcount >= 1) { + Parse::RecDescent::_trace( + q{<]>>}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched operator: []<< (return value: [} . qq{@{$_tok||[]}} . q{]}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + + push @item, $item{'func_args(s)'} = $_tok || []; + + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/SYSIBM\\.|/i, or /SYSFUN\\.|/i, or userdefined_function '(' ')']<<}, + Parse::RecDescent::_tracefirst($text), q{function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{function}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_41_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_41_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_41_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/INTEGER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_41_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_41_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/INTEGER/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:INTEGER)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_8_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/INTEGER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_8_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_8_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/INT/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_41_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_41_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/INT/]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/CONCAT/, or '||']<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:INT)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/INT/]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_41_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_case_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_case_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_case_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [searched_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_case_expression}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_case_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [searched_when_clause]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::searched_when_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [searched_when_clause]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_case_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{searched_when_clause}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/CORRELATION/i, or /CORR/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[8]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{>>Matched production: [searched_when_clause]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [simple_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_case_expression}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_case_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [simple_when_clause]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::simple_when_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [simple_when_clause]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_9_of_rule_sysibm_function]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_9_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{_alternation_1_of_production_1_of_rule_case_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{simple_when_clause}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_9_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_9_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [simple_when_clause]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_case_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_order_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_window_order_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_window_order_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [sort_key_expression asc_option, or desc_option]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_window_order_clause}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_window_order_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [sort_key_expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sort_key_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [sort_key_expression]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{sort_key_expression}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/CORRELATION/i, or /CORR/]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying repeated subrule: [asc_option, or desc_option]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{asc_option, or desc_option})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause(?)}} + = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [sort_key_expression asc_option, or desc_option]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_window_order_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::create { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"create"}; + + Parse::RecDescent::_trace(q{Trying rule: [create]}, Parse::RecDescent::_tracefirst($_[1]), q{create}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [CREATE TRIGGER trigger_name before type /ON/i table_name reference_b /FOR EACH ROW/i 'MODE DB2SQL' triggered_action]}, + Parse::RecDescent::_tracefirst($_[1]), q{create}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{create}); + %item = (__RULE__ => q{create}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [CREATE]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [CREATE]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{CREATE}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/COUNT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[9]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying subrule: [TRIGGER]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{TRIGGER})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::TRIGGER( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [TRIGGER]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{TRIGGER}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying terminal: [/COUNT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + } + Parse::RecDescent::_trace( + q{Trying subrule: [trigger_name]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{trigger_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::trigger_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [trigger_name]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:COUNT)//i) - { + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{trigger_name}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{Trying subrule: [before]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{before})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::before( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [before]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{before}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/COUNT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying subrule: [type]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{type})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [type]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{type}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/COUNT_BIG/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[10]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/ON/i]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/ON/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ON)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/COUNT_BIG/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [table_name]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{table_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [table_name]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:COUNT_BIG)//i) - { + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{table_name}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{Trying repeated subrule: [reference_b]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{reference_b})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_b, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [reference_b]<< (} . @$_tok . q{ times)}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{reference_b(?)}} = $_tok; + push @item, $_tok; + Parse::RecDescent::_trace( + q{Trying terminal: [/FOR EACH ROW/i]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/FOR EACH ROW/i})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/COUNT_BIG/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FOR EACH ROW)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying terminal: ['MODE DB2SQL']}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'MODE DB2SQL'})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\AMODE\ DB2SQL//) { - Parse::RecDescent::_trace(q{Trying production: [/COVARIANCE/i, or /COVAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[11]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [triggered_action]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{triggered_action})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::triggered_action( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [triggered_action]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_12_of_rule_sysibm_function]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_12_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{triggered_action}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_12_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_12_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{create}, $tracelevel) + if defined $::RD_TRACE; + + $_tok = ($_noactions) ? 0 : do { + my $table_name = $item{'table_name'}{'name'}; + $return = { + table => $table_name, + schema => $item{'trigger_name'}{'schema'}, + name => $item{'trigger_name'}{'name'}, + when => 'before', + db_event => $item{'type'}->{'event'}, + fields => $item{'type'}{'fields'}, + condition => $item{'triggered_action'}{'condition'}, + reference => $item{'reference_b'}, + granularity => $item[9], + action => $item{'triggered_action'}{'statement'} + }; + + push @triggers, $return; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [CREATE TRIGGER trigger_name before type /ON/i table_name reference_b /FOR EACH ROW/i 'MODE DB2SQL' triggered_action]<<}, + Parse::RecDescent::_tracefirst($text), q{create}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [CREATE TRIGGER trigger_name after type /ON/i table_name reference_a /FOR EACH ROW|FOR EACH STATEMENT/i 'MODE DB2SQL' triggered_action]}, + Parse::RecDescent::_tracefirst($_[1]), q{create}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{create}); + %item = (__RULE__ => q{create}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [CREATE]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [CREATE]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{CREATE}} = $_tok; + push @item, $_tok; + + } + Parse::RecDescent::_trace( + q{Trying subrule: [TRIGGER]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{TRIGGER})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::TRIGGER( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [TRIGGER]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: [/COVARIANCE/i, or /COVAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{TRIGGER}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying subrule: [trigger_name]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{trigger_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::trigger_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [trigger_name]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: [/DATE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[12]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{trigger_name}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{Trying terminal: [/DATE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying subrule: [after]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{after})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::after( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [after]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{after}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DATE)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying subrule: [type]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{type})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [type]<< (return value: [} . $_tok . q{]}, - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{type}} = $_tok; + push @item, $_tok; + + } + Parse::RecDescent::_trace( + q{Trying terminal: [/ON/i]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/ON/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ON)//i) { - Parse::RecDescent::_trace(q{>>Matched production: [/DATE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [table_name]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{table_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [table_name]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{table_name}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/DAY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[13]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{Trying repeated subrule: [reference_a]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{reference_a})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_a, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [reference_a]<< (} . @$_tok . q{ times)}, - Parse::RecDescent::_trace(q{Trying terminal: [/DAY/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{reference_a(?)}} = $_tok; + push @item, $_tok; + Parse::RecDescent::_trace( + q{Trying terminal: [/FOR EACH ROW|FOR EACH STATEMENT/i]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/FOR EACH ROW|FOR EACH STATEMENT/i})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DAY)//i) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FOR EACH ROW|FOR EACH STATEMENT)//i) { - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + push @item, $item{__PATTERN2__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: ['MODE DB2SQL']}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'MODE DB2SQL'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\AMODE\ DB2SQL//) { - Parse::RecDescent::_trace(q{>>Matched production: [/DAY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [triggered_action]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{triggered_action})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::triggered_action( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [triggered_action]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{triggered_action}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/DAYS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[14]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{create}, $tracelevel) + if defined $::RD_TRACE; + + $_tok = ($_noactions) ? 0 : do { + my $table_name = $item{'table_name'}{'name'}; + $return = { + table => $table_name, + schema => $item{'trigger_name'}{'schema'}, + name => $item{'trigger_name'}{'name'}, + when => 'after', + db_event => $item{'type'}{'event'}, + fields => $item{'type'}{'fields'}, + condition => $item{'triggered_action'}{'condition'}, + reference => $item{'reference_a'}, + granularity => $item[9], + action => $item{'triggered_action'}{'statement'} + }; + + push @triggers, $return; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [CREATE TRIGGER trigger_name after type /ON/i table_name reference_a /FOR EACH ROW|FOR EACH STATEMENT/i 'MODE DB2SQL' triggered_action]<<}, + Parse::RecDescent::_tracefirst($text), q{create}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [CREATE /FEDERATED|/i VIEW view_name column_list /AS/i with_expression SQL_procedure_statement]}, + Parse::RecDescent::_tracefirst($_[1]), q{create}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{create}); + %item = (__RULE__ => q{create}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [CREATE]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [CREATE]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{CREATE}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying terminal: [/DAYS/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + } + Parse::RecDescent::_trace( + q{Trying terminal: [/FEDERATED|/i]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/FEDERATED|/i})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DAYS)//i) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FEDERATED|)//i) { - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [VIEW]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{VIEW})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::VIEW( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [VIEW]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{VIEW}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying subrule: [view_name]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{view_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::view_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [view_name]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: [/DAYS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{view_name}} = $_tok; + push @item, $_tok; + + } + Parse::RecDescent::_trace( + q{Trying repeated subrule: [column_list]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{column_list})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [column_list]<< (} . @$_tok . q{ times)}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_list(?)}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/DBCLOB/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[15]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/AS/i]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/AS/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AS)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/DBCLOB/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [with_expression]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{with_expression})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::with_expression, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [with_expression]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{with_expression(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying subrule: [SQL_procedure_statement]}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{SQL_procedure_statement})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SQL_procedure_statement( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{create}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [SQL_procedure_statement]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{create}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{SQL_procedure_statement}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DBCLOB)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{create}, $tracelevel) if defined $::RD_TRACE; + $_tok = ($_noactions) ? 0 : do { + $return = { + name => $item{view_name}{name}, + sql => $item{SQL_procedure_statement}, + with => $item{'with_expression(?)'}, + fields => $item{'column_list(?)'} + }; + push @views, $return; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [CREATE /FEDERATED|/i VIEW view_name column_list /AS/i with_expression SQL_procedure_statement]<<}, + Parse::RecDescent::_tracefirst($text), q{create}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{create}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{create}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{create}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{create}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysfun { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"sysfun"}; + + Parse::RecDescent::_trace(q{Trying rule: [sysfun]}, Parse::RecDescent::_tracefirst($_[1]), q{sysfun}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ABS/i, or /ABSVAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_sysfun]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysfun( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_sysfun]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{sysfun}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_sysfun}} = $_tok; + push @item, $_tok; + + } + + Parse::RecDescent::_trace( + q{>>Matched production: [/ABS/i, or /ABSVAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ACOS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DBCLOB/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/ACOS/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ACOS)//i) { - Parse::RecDescent::_trace(q{Trying production: [/DECIMAL/i, or /DEC/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[16]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_17_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_17_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/ACOS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_17_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_17_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/ASCII/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/ASCII/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/DECIMAL/i, or /DEC/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ASCII)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/ASCII/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DECRYPT_BIN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[17]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ASIN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DECRYPT_BIN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/ASIN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ASIN)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DECRYPT_BIN)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/ASIN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ATAN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DECRYPT_BIN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/ATAN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ATAN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ATAN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/ATAN2/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[5]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: [/DECRYPT_CHAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[18]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/ATAN2/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ATAN2)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/DECRYPT_CHAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ATAN2/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CEIL/i, or /CEILING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[6]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_7_of_rule_sysfun]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_7_of_rule_sysfun( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_7_of_rule_sysfun]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DECRYPT_CHAR)//i) - { + Parse::RecDescent::_tracefirst($text), + q{sysfun}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_7_of_rule_sysfun}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [/CEIL/i, or /CEILING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/CHAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[7]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DECRYPT_CHAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/CHAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CHAR)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/CHAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DEREF/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[19]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/CHR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[8]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DEREF/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/CHR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CHR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DEREF)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/CHR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/COS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[9]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DEREF/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/COS/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:COS)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/COS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DIGITS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[20]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/COT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[10]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DIGITS/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/COT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:COT)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DIGITS)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/COT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DAYNAME/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[11]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DIGITS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/DAYNAME/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DAYNAME)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/DAYNAME/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DLCOMMENT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[21]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DAYOFWEEK/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[12]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DLCOMMENT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/DAYOFWEEK/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DAYOFWEEK)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLCOMMENT)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DAYOFWEEK/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DAYOFWEEK_ISO/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[13]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DLCOMMENT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/DAYOFWEEK_ISO/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DAYOFWEEK_ISO)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/DAYOFWEEK_ISO/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DLLINKTYPE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[22]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DAYOFYEAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[14]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DLLINKTYPE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/DAYOFYEAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DAYOFYEAR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLLINKTYPE)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DAYOFYEAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DEGREES/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[15]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DLLINKTYPE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/DEGREES/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DEGREES)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/DEGREES/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DLURLCOMPLETE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[23]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DIFFERENCE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[16]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DLURLCOMPLETE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/DIFFERENCE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DIFFERENCE)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLURLCOMPLETE)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/DIFFERENCE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/DLURLCOMPLETE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/DOUBLE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[17]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/DOUBLE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DOUBLE)//i) { - Parse::RecDescent::_trace(q{Trying production: [/DLURLPATH/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[24]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying terminal: [/DLURLPATH/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{>>Matched production: [/DOUBLE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLURLPATH)//i) - { + Parse::RecDescent::_trace( + q{Trying production: [/EXP/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[18]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/EXP/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:EXP)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/EXP/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/FLOOR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[19]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DLURLPATH/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/FLOOR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:FLOOR)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/FLOOR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DLURLPATHONLY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[25]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/GET_ROUTINE_SAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[20]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DLURLPATHONLY/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/GET_ROUTINE_SAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:GET_ROUTINE_SAR)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLURLPATHONLY)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/GET_ROUTINE_SAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/INSERT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[21]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DLURLPATHONLY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/INSERT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:INSERT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/INSERT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DLURLSCHEME/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[26]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/JULIAN_DAY/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[22]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DLURLSCHEME/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/JULIAN_DAY/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:JULIAN_DAY)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLURLSCHEME)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/JULIAN_DAY/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LCASE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[23]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DLURLSCHEME/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/LCASE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LCASE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/LCASE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DLURLSERVER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[27]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LEFT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[24]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DLURLSERVER/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/LEFT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LEFT)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLURLSERVER)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/LEFT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[25]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DLURLSERVER/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/LN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/LN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/DLVALUE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[28]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LOCATE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[26]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/DLVALUE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/LOCATE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LOCATE)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DLVALUE)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/LOCATE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LOG/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[27]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/DLVALUE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/LOG/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LOG)//i) { - Parse::RecDescent::_trace(q{Trying production: [/DOUBLE/i, or /DOUBLE_PRECISION/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[29]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_30_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_30_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/LOG/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_30_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_30_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/LOG10/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[28]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/LOG10/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/DOUBLE/i, or /DOUBLE_PRECISION/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LOG10)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/LOG10/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/ENCRYPT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[30]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/LTRIM/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[29]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/ENCRYPT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/LTRIM/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LTRIM)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ENCRYPT)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/LTRIM/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/MIDNIGHT_SECONDS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[30]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/ENCRYPT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/MIDNIGHT_SECONDS/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MIDNIGHT_SECONDS)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/MIDNIGHT_SECONDS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/EVENT_MON_STATE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[31]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/MOD/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[31]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/EVENT_MON_STATE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/MOD/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MOD)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:EVENT_MON_STATE)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/MOD/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/MONTHNAME/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[32]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/EVENT_MON_STATE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/MONTHNAME/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:MONTHNAME)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/MONTHNAME/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/FLOAT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[32]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/POWER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[33]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/FLOAT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/POWER/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:POWER)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FLOAT)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/POWER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/PUT_ROUTINE_SAR/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[34]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/FLOAT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/PUT_ROUTINE_SAR/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:PUT_ROUTINE_SAR)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/PUT_ROUTINE_SAR/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/GETHINT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[33]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/QUARTER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[35]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/GETHINT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/QUARTER/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:QUARTER)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:GETHINT)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/QUARTER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/RADIANS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[36]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/GETHINT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/RADIANS/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RADIANS)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/RADIANS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/GENERATE_UNIQUE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[34]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/RAND/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[37]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/GENERATE_UNIQUE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/RAND/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RAND)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:GENERATE_UNIQUE)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/RAND/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REPEAT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[38]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/GENERATE_UNIQUE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/REPEAT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REPEAT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/REPEAT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/GRAPHIC/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[35]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REPLACE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[39]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/GRAPHIC/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/REPLACE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REPLACE)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:GRAPHIC)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/REPLACE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/RIGHT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[40]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/GRAPHIC/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/RIGHT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RIGHT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/RIGHT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/GROUPING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[36]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ROUND/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[41]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/GROUPING/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/ROUND/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ROUND)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:GROUPING)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/ROUND/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/GROUPING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/RTRIM/ I]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[42]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/RTRIM/]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RTRIM)//) { - Parse::RecDescent::_trace(q{Trying production: [/HEX/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[37]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying terminal: [/HEX/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace(q{Trying subrule: [I]}, Parse::RecDescent::_tracefirst($text), q{sysfun}, $tracelevel) + if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{I})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::I( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [I]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:HEX)//i) - { + Parse::RecDescent::_tracefirst($text), + q{sysfun}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{I}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [/RTRIM/ I]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/SIGN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[43]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/HEX/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/SIGN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SIGN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/SIGN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/HOUR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[38]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/SIN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[44]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/HOUR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/SIN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SIN)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:HOUR)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/SIN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/SOUNDEX/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[45]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/HOUR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/SOUNDEX/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SOUNDEX)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/SOUNDEX/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/IDENTITY_VAL_LOCAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[39]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/SPACE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[46]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/IDENTITY_VAL_LOCAL/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/SPACE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SPACE)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:IDENTITY_VAL_LOCAL)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/SPACE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/IDENTITY_VAL_LOCAL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/SQLCACHE_SNAPSHOT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[47]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/SQLCACHE_SNAPSHOT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SQLCACHE_SNAPSHOT)//i) { - Parse::RecDescent::_trace(q{Trying production: [/INTEGER/i, or /INT/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[40]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_41_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_41_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/SQLCACHE_SNAPSHOT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_41_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_41_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; - - } + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/INTEGER/i, or /INT/]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/SQRT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[48]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/SQRT/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SQRT)//i) { - Parse::RecDescent::_trace(q{Trying production: [/LCASE/i, or /LOWER/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[41]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_42_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_42_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); + Parse::RecDescent::_trace( + q{>>Matched production: [/SQRT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_42_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_42_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + while (!$_matched && !$commit) { - } + Parse::RecDescent::_trace( + q{Trying production: [/TAN/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[49]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/TAN/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - Parse::RecDescent::_trace(q{>>Matched production: [/LCASE/i, or /LOWER/]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TAN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/TAN/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/LENGTH/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[42]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/TIMESTAMP_ISO/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[50]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/LENGTH/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/TIMESTAMP_ISO/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TIMESTAMP_ISO)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LENGTH)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/TIMESTAMP_ISO/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/TIMESTAMPDIFF/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[51]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/LENGTH/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LONG_VARCHAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[43]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/TIMESTAMPDIFF/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TIMESTAMPDIFF)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/LONG_VARCHAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/TIMESTAMPDIFF/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/TRUNCATE/i, or /TRUNC/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[52]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_53_of_rule_sysfun]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_53_of_rule_sysfun( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_53_of_rule_sysfun]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LONG_VARCHAR)//i) - { + Parse::RecDescent::_tracefirst($text), + q{sysfun}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_53_of_rule_sysfun}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [/TRUNCATE/i, or /TRUNC/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/UCASE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[53]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/LONG_VARCHAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/UCASE/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UCASE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/UCASE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } - Parse::RecDescent::_trace(q{Trying production: [/LONG_VARGRAPHIC/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[44]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/WEEK/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[54]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/LONG_VARGRAPHIC/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/WEEK/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:WEEK)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LONG_VARGRAPHIC)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/WEEK/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/WEEK_ISO/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[55]; + $text = $_[1]; + my $_savetext; + @item = (q{sysfun}); + %item = (__RULE__ => q{sysfun}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/LONG_VARGRAPHIC/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/WEEK_ISO/i]}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:WEEK_ISO)//i) { - Parse::RecDescent::_trace(q{Trying production: [/LTRIM/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[45]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/LTRIM/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/WEEK_ISO/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{sysfun}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{sysfun}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{sysfun}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{sysfun}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule + = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/SELECTIVITY/i numeric_constant]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/SELECTIVITY/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SELECTIVITY)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [numeric_constant]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{numeric_constant})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numeric_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [numeric_constant]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{numeric_constant}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LTRIM)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace( + q{>>Matched production: [/SELECTIVITY/i numeric_constant]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"NAME"}; + + Parse::RecDescent::_trace(q{Trying rule: [NAME]}, Parse::RecDescent::_tracefirst($_[1]), q{NAME}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/\\w+/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NAME}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{NAME}); + %item = (__RULE__ => q{NAME}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/\\w+/]}, + Parse::RecDescent::_tracefirst($text), + q{NAME}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:\w+)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/\\w+/]<<}, + Parse::RecDescent::_tracefirst($text), + q{NAME}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/\\w\{1,18\}/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{NAME}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{NAME}); + %item = (__RULE__ => q{NAME}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/LTRIM/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: [/\\w\{1,18\}/]}, + Parse::RecDescent::_tracefirst($text), + q{NAME}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:\w{1,18})//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/\\w\{1,18\}/]<<}, + Parse::RecDescent::_tracefirst($text), + q{NAME}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{NAME}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{NAME}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{NAME}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{NAME}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::constant { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"constant"}; + + Parse::RecDescent::_trace( + q{Trying rule: [constant]}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [int_const]}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{constant}); + %item = (__RULE__ => q{constant}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [int_const]}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::int_const( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [int_const]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{constant}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{int_const}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/MAX/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[46]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{>>Matched production: [int_const]<<}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [float_const]}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{constant}); + %item = (__RULE__ => q{constant}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [float_const]}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::float_const( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [float_const]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/MAX/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{constant}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{float_const}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MAX)//i) - { + Parse::RecDescent::_trace( + q{>>Matched production: [float_const]<<}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [dec_const]}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{constant}); + %item = (__RULE__ => q{constant}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [dec_const]}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::dec_const( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [dec_const]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{constant}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{dec_const}} = $_tok; + push @item, $_tok; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + } + Parse::RecDescent::_trace( + q{>>Matched production: [dec_const]<<}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [char_const]}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{constant}); + %item = (__RULE__ => q{constant}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [char_const]}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::char_const( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [char_const]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{constant}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{char_const}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{>>Matched production: [/MAX/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + } + Parse::RecDescent::_trace( + q{>>Matched production: [char_const]<<}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [hex_const]}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{constant}); + %item = (__RULE__ => q{constant}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [hex_const]}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::hex_const( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [hex_const]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{constant}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{hex_const}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/MICROSECOND/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[47]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{>>Matched production: [hex_const]<<}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [grastr_const]}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[5]; + $text = $_[1]; + my $_savetext; + @item = (q{constant}); + %item = (__RULE__ => q{constant}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [grastr_const]}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::grastr_const( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [grastr_const]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/MICROSECOND/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{constant}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{grastr_const}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MICROSECOND)//i) - { + Parse::RecDescent::_trace( + q{>>Matched production: [grastr_const]<<}, + Parse::RecDescent::_tracefirst($text), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{constant}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{constant}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{constant}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{constant}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_ranking_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_ranking_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_ranking_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/RANK/ '()']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_ranking_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_ranking_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/RANK/]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:RANK)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying terminal: ['()']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'()'})->at($text); - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(\)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/RANK/ '()']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/DENSE_RANK|DENSERANK/i '()']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_ranking_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_ranking_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/MICROSECOND/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: [/DENSE_RANK|DENSERANK/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DENSE_RANK|DENSERANK)//i) { - Parse::RecDescent::_trace(q{Trying production: [/MIN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[48]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying terminal: ['()']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'()'})->at($text); - Parse::RecDescent::_trace(q{Trying terminal: [/MIN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(\)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/DENSE_RANK|DENSERANK/i '()']<<}, Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_ranking_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_aggregation_group_clause { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"window_aggregation_group_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ROWS/i, or /RANGE/i group_start, or group_between, or group_end]}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{window_aggregation_group_clause}); + %item = (__RULE__ => q{window_aggregation_group_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($text), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_aggregation_group_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_window_aggregation_group_clause]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{window_aggregation_group_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MIN)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_2_of_production_1_of_rule_window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($text), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{group_start, or group_between, or group_end}) + ->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_window_aggregation_group_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_2_of_production_1_of_rule_window_aggregation_group_clause]<< (return value: [} + . $_tok . q{]}, - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_tracefirst($text), + q{window_aggregation_group_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{>>Matched production: [/ROWS/i, or /RANGE/i group_start, or group_between, or group_end]<<}, + Parse::RecDescent::_tracefirst($text), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{window_aggregation_group_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{window_aggregation_group_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{window_aggregation_group_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_window_aggregation_group_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_window_aggregation_group_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_2_of_production_1_of_rule_window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [group_start]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [group_start]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_start( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [group_start]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: [/MIN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{group_start}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [group_start]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [group_between]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [group_between]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_between( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [group_between]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: [/MINUTE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[49]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{group_between}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{Trying terminal: [/MINUTE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{>>Matched production: [group_between]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [group_end]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [group_end]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_end( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [group_end]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{group_end}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MINUTE)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace( + q{>>Matched production: [group_end]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::VIEW { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"VIEW"}; + + Parse::RecDescent::_trace(q{Trying rule: [VIEW]}, Parse::RecDescent::_tracefirst($_[1]), q{VIEW}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/view/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{VIEW}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{VIEW}); + %item = (__RULE__ => q{VIEW}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/view/i]}, + Parse::RecDescent::_tracefirst($text), + q{VIEW}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:view)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/view/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{VIEW}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{VIEW}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{VIEW}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{VIEW}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{VIEW}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::with_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"with_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [with_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/WITH/i ]}, + Parse::RecDescent::_tracefirst($_[1]), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{with_expression}); + %item = (__RULE__ => q{with_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/WITH/i]}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:WITH)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{Trying operator: []}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is( + q{} + )->at($text); + $_tok = undef; + OPLOOP: while (1) { + $repcount = 0; + my @item; + # MATCH LEFTARG + + Parse::RecDescent::_trace( + q{Trying subrule: [common_table_expression]}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{common_table_expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::common_table_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [common_table_expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: [/MINUTE/i]<<}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{with_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{common_table_expression}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + $repcount++; - Parse::RecDescent::_trace(q{Trying production: [/MONTH/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[50]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + my $savetext = $text; + my $backtrack; + # MATCH (OP RIGHTARG)(s) + while ($repcount < 100000000) { + $backtrack = 0; - Parse::RecDescent::_trace(q{Trying terminal: [/MONTH/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/,/]}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/,/})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:,)//) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MONTH)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + pop @item; + if (defined $1) { + push @item, $item{'common_table_expression(s)'} = $1; + $backtrack = 1; + } + + Parse::RecDescent::_trace( + q{Trying subrule: [common_table_expression]}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{common_table_expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::common_table_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [common_table_expression]<< (return value: [} . $_tok . q{]}, - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_tracefirst($text), + q{with_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{common_table_expression}} = $_tok; + push @item, $_tok; + + } + + $savetext = $text; + $repcount++; + } + $text = $savetext; + pop @item if $backtrack; + + unless (@item) { undef $_tok; last } + $_tok = [@item]; + last; + } + unless ($repcount >= 1) { + Parse::RecDescent::_trace( + q{<]>>}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched operator: []<< (return value: [} + . qq{@{$_tok||[]}} . q{]}, + Parse::RecDescent::_tracefirst($text), q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + push @item, $item{'common_table_expression(s)'} = $_tok || []; - Parse::RecDescent::_trace(q{>>Matched production: [/MONTH/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + + $_tok = ($_noactions) ? 0 : do { + $return = $item{'common_table_expression'}; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/WITH/i ]<<}, + Parse::RecDescent::_tracefirst($text), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{with_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{with_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{with_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{with_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numeric_constant { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"numeric_constant"}; + + Parse::RecDescent::_trace( + q{Trying rule: [numeric_constant]}, + Parse::RecDescent::_tracefirst($_[1]), + q{numeric_constant}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/\\d+/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{numeric_constant}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{numeric_constant}); + %item = (__RULE__ => q{numeric_constant}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/\\d+/]}, + Parse::RecDescent::_tracefirst($text), + q{numeric_constant}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:\d+)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/\\d+/]<<}, + Parse::RecDescent::_tracefirst($text), + q{numeric_constant}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{numeric_constant}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{numeric_constant}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{numeric_constant}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{numeric_constant}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_table { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"old_new_table"}; + + Parse::RecDescent::_trace( + q{Trying rule: [old_new_table]}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/OLD_TABLE/i /(AS)?/i identifier]}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{old_new_table}); + %item = (__RULE__ => q{old_new_table}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/OLD_TABLE/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:OLD_TABLE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: [/(AS)?/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(AS)?/i})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:(AS)?)//i) { - Parse::RecDescent::_trace(q{Trying production: [/MULTIPLY_ACT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[51]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [identifier]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{identifier})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::identifier( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [identifier]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/MULTIPLY_ACT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{identifier}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MULTIPLY_ACT)//i) - { + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{old_new_table}, $tracelevel) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[ 1 .. 3 ]) }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [/OLD_TABLE/i /(AS)?/i identifier]<<}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/MULTIPLY_ACT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/NEW_TABLE/i /(AS)?/i identifier]}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{old_new_table}); + %item = (__RULE__ => q{old_new_table}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/NEW_TABLE/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NEW_TABLE)//i) { - Parse::RecDescent::_trace(q{Trying production: [/NODENUMBER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[52]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying terminal: [/(AS)?/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(AS)?/i})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:(AS)?)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/NODENUMBER/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [identifier]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{identifier})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::identifier( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [identifier]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NODENUMBER)//i) - { + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{identifier}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{old_new_table}, $tracelevel) if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[ 1 .. 3 ]) }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NEW_TABLE/i /(AS)?/i identifier]<<}, + Parse::RecDescent::_tracefirst($text), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_table}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{old_new_table}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{old_new_table}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{old_new_table}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_numbering_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_numbering_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_numbering_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [window_order_clause window_aggregation_group_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_numbering_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_numbering_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [window_order_clause]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_order_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [window_order_clause]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{window_order_clause}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/NODENUMBER/i]<<}, + Parse::RecDescent::_trace( + q{Trying repeated subrule: [window_aggregation_group_clause]}, Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{window_aggregation_group_clause})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_aggregation_group_clause, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [window_aggregation_group_clause]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_numbering_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{window_aggregation_group_clause(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [window_order_clause window_aggregation_group_clause]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_numbering_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"} + {"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [result_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [result_expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [result_expression]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{result_expression}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/NULLIF/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[53]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{>>Matched production: [result_expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/NULL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/NULL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULL)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NULL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_corr { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"old_new_corr"}; + + Parse::RecDescent::_trace( + q{Trying rule: [old_new_corr]}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/OLD/i /(AS)?/i correlation_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{old_new_corr}); + %item = (__RULE__ => q{old_new_corr}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/OLD/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:OLD)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying terminal: [/(AS)?/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(AS)?/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:(AS)?)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/NULLIF/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [correlation_name]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{correlation_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::correlation_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [correlation_name]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULLIF)//i) - { + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{correlation_name}} = $_tok; + push @item, $_tok; + + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{old_new_corr}, $tracelevel) if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) + $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[ 1 .. 3 ]) }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [/OLD/i /(AS)?/i correlation_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/NULLIF/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/NEW/i /(AS)?/i correlation_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{old_new_corr}); + %item = (__RULE__ => q{old_new_corr}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/NEW/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NEW)//i) { - Parse::RecDescent::_trace(q{Trying production: [/PARTITON/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[54]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying terminal: [/PARTITON/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: [/(AS)?/i]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(AS)?/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:(AS)?)//i) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:PARTITON)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/PARTITON/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [correlation_name]}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{correlation_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::correlation_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [correlation_name]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{correlation_name}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/POSSTR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[55]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{old_new_corr}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying terminal: [/POSSTR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[ 1 .. 3 ]) }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:POSSTR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NEW/i /(AS)?/i correlation_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{old_new_corr}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{old_new_corr}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{old_new_corr}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{old_new_corr}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_42_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_42_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_42_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/LCASE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_42_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_42_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/LCASE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LCASE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/LCASE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/POSSTR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/LOWER/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_42_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_42_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/LOWER/]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:LOWER)//) { - Parse::RecDescent::_trace(q{Trying production: [/RAISE_ERROR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[56]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/LOWER/]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_42_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subtype_treatment { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"subtype_treatment"}; + + Parse::RecDescent::_trace( + q{Trying rule: [subtype_treatment]}, + Parse::RecDescent::_tracefirst($_[1]), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/TREAT/i '(' expression /AS/i data_type ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{subtype_treatment}); + %item = (__RULE__ => q{subtype_treatment}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/TREAT/i]}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:TREAT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - Parse::RecDescent::_trace(q{Trying terminal: [/RAISE_ERROR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RAISE_ERROR)//i) - { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + } + Parse::RecDescent::_trace( + q{Trying terminal: [/AS/i]}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/AS/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AS)//i) { - Parse::RecDescent::_trace(q{>>Matched production: [/RAISE_ERROR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [data_type]}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{data_type})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::data_type( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [data_type]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{data_type}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/REAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[57]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - Parse::RecDescent::_trace(q{Trying terminal: [/REAL/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/TREAT/i '(' expression /AS/i data_type ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{subtype_treatment}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{subtype_treatment}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{subtype_treatment}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{subtype_treatment}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: []}, + Parse::RecDescent::_tracefirst($_[1]), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{expression}); + %item = (__RULE__ => q{expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying operator: []}, + Parse::RecDescent::_tracefirst($text), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{})->at($text); + + $_tok = undef; + OPLOOP: while (1) { + $repcount = 0; + my @item; + + # MATCH LEFTARG + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_expression]}, + Parse::RecDescent::_tracefirst($text), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{'+', or '-'})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_expression]<< (return value: [} + . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REAL)//i) - { + Parse::RecDescent::_tracefirst($text), + q{expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_expression}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + $repcount++; + my $savetext = $text; + my $backtrack; + # MATCH (OP RIGHTARG)(s) + while ($repcount < 100000000) { + $backtrack = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/REAL/i]<<}, + Parse::RecDescent::_trace( + q{Trying terminal: [/operator/]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/operator/})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:operator)//) { - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REC2XML/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[58]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + pop @item; + if (defined $1) { + push @item, $item{'_alternation_1_of_production_1_of_rule_expression(s)'} = $1; + $backtrack = 1; + } + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_expression]}, + Parse::RecDescent::_tracefirst($text), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{'+', or '-'})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_expression]<< (return value: [} + . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/REC2XML/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_expression}} = $_tok; + push @item, $_tok; + + } + + $savetext = $text; + $repcount++; + } + $text = $savetext; + pop @item if $backtrack; + + unless (@item) { undef $_tok; last } + $_tok = [@item]; + last; + } + unless ($repcount >= 1) { + Parse::RecDescent::_trace( + q{<]>>}, + Parse::RecDescent::_tracefirst($text), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched operator: []<< (return value: [} + . qq{@{$_tok||[]}} . q{]}, + Parse::RecDescent::_tracefirst($text), q{expression}, $tracelevel + ) if defined $::RD_TRACE; + + push @item, $item{'_alternation_1_of_production_1_of_rule_expression(s)'} = $_tok || []; + + Parse::RecDescent::_trace( + q{>>Matched production: []<<}, + Parse::RecDescent::_tracefirst($text), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"} + {"_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [function]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [function]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REC2XML)//i) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{function}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [function]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: ['(' expression ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/REC2XML/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - Parse::RecDescent::_trace(q{Trying production: [/REGR_AVGX/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[59]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{expression})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_AVGX/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_AVGX)//i) - { + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' expression ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [constant]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [constant]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [constant]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{constant}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_AVGX/i]<<}, + Parse::RecDescent::_trace( + q{>>Matched production: [constant]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [column_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[3]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [column_name]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_name]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_name}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/REGR_AVGY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[60]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{>>Matched production: [column_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [host_variable]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[4]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [host_variable]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::host_variable( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [host_variable]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{host_variable}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_AVGY/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + } + Parse::RecDescent::_trace( + q{>>Matched production: [host_variable]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [special_register]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[5]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [special_register]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::special_register( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [special_register]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_AVGY)//i) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{special_register}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } + Parse::RecDescent::_trace( + q{>>Matched production: [special_register]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: ['(' scalar_fullselect ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[6]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_AVGY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [scalar_fullselect]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{scalar_fullselect})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scalar_fullselect( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [scalar_fullselect]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{scalar_fullselect}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/REGR_COUNT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[61]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_COUNT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' scalar_fullselect ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [labeled_duration]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[7]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [labeled_duration]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::labeled_duration( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [labeled_duration]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_COUNT)//i) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{labeled_duration}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + } - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + Parse::RecDescent::_trace( + q{>>Matched production: [labeled_duration]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [case_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[8]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [case_expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::case_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [case_expression]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{case_expression}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_COUNT/i]<<}, + Parse::RecDescent::_trace( + q{>>Matched production: [case_expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [cast_specification]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[9]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [cast_specification]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cast_specification( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [cast_specification]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{cast_specification}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying production: [/REGR_INTERCEPT/i, or /REGR_ICPT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[62]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + } + Parse::RecDescent::_trace( + q{>>Matched production: [cast_specification]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [OLAP_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[10]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [OLAP_function]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::OLAP_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [OLAP_function]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_63_of_rule_sysibm_function]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_63_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{OLAP_function}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_63_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, + } + Parse::RecDescent::_trace( + q{>>Matched production: [OLAP_function]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [method_invocation]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[11]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [method_invocation]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_invocation( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_63_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [method_invocation]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{method_invocation}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_INTERCEPT/i, or /REGR_ICPT/i]<<}, + Parse::RecDescent::_trace( + q{>>Matched production: [method_invocation]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [subtype_treatment]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[12]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [subtype_treatment]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subtype_treatment( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [subtype_treatment]<< (return value: [} . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{subtype_treatment}} = $_tok; + push @item, $_tok; + } - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{>>Matched production: [subtype_treatment]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [sequence_reference]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[13]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [sequence_reference]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_reference( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [sequence_reference]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying production: [/REGR_R2/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[63]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{sequence_reference}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_R2/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{>>Matched production: [sequence_reference]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::startrule { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"startrule"}; + + Parse::RecDescent::_trace( + q{Trying rule: [startrule]}, + Parse::RecDescent::_tracefirst($_[1]), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [statement eofile]}, + Parse::RecDescent::_tracefirst($_[1]), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{startrule}); + %item = (__RULE__ => q{startrule}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [statement]}, + Parse::RecDescent::_tracefirst($text), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::statement, + 1, 100000000, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [statement]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{startrule}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{statement(s)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying subrule: [eofile]}, + Parse::RecDescent::_tracefirst($text), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{eofile})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::eofile( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [eofile]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{startrule}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{eofile}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_R2)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{startrule}, $tracelevel) if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + $_tok = ($_noactions) ? 0 : do { + $return = { + tables => \%tables, + views => \@views, + triggers => \@triggers, + }; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [statement eofile]<<}, + Parse::RecDescent::_tracefirst($text), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{startrule}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{startrule}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{startrule}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{startrule}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cast_specification + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_cast_specification"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_cast_specification]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_cast_specification}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cast_specification}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [expression]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [expression]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{expression}} = $_tok; + push @item, $_tok; + } - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_R2/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{>>Matched production: [expression]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/NULL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_cast_specification}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cast_specification}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: [/REGR_SLOPE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[64]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/NULL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NULL)//i) { - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_SLOPE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NULL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [parameter_marker]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_cast_specification}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cast_specification}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [parameter_marker]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::parameter_marker( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [parameter_marker]<< (return value: [} . $_tok . q{]}, - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_SLOPE)//i) - { + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{parameter_marker}} = $_tok; + push @item, $_tok; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + } + + Parse::RecDescent::_trace( + q{>>Matched production: [parameter_marker]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_cast_specification}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::before { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"before"}; + + Parse::RecDescent::_trace(q{Trying rule: [before]}, Parse::RecDescent::_tracefirst($_[1]), q{before}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/NO CASCADE BEFORE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{before}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{before}); + %item = (__RULE__ => q{before}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/NO CASCADE BEFORE/i]}, + Parse::RecDescent::_tracefirst($text), + q{before}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NO CASCADE BEFORE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/NO CASCADE BEFORE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{before}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{before}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{before}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{before}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{before}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_83_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_83_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_83_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/UCASE/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_83_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_83_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/UCASE/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UCASE)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/UCASE/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_SLOPE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + Parse::RecDescent::_trace( + q{Trying production: [/UPPER/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_83_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_83_of_rule_sysibm_function}); + my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/UPPER/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UPPER)//i) { - Parse::RecDescent::_trace(q{Trying production: [/REGR_SXX/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[65]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/UPPER/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_83_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ranking_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"ranking_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [ranking_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/RANK/, or /DENSE_RANK|DENSERANK/i /OVER/i '(' window_partition_clause window_order_clause ')']}, + Parse::RecDescent::_tracefirst($_[1]), q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{ranking_function}); + %item = (__RULE__ => q{ranking_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_ranking_function]}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_ranking_function( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_ranking_function]<< (return value: [} + . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_SXX/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_ranking_function}} = $_tok; + push @item, $_tok; + } - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_SXX)//i) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/OVER/i]}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/OVER/i})->at($text); - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:OVER)//i) { - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'('})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_SXX/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $_matched = 1; - last; - } - + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [window_partition_clause]}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{window_partition_clause})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_partition_clause, + 0, 1, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [window_partition_clause]<< (} . @$_tok . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{window_partition_clause(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{Trying subrule: [window_order_clause]}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{window_order_clause})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_order_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [window_order_clause]<< (return value: [} . $_tok . q{]}, - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REGR_SXY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[66]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_SXY/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_SXY)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_SXY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REGR_SYY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[67]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_SYY/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_SYY)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_SYY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RTRIM/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[68]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RTRIM/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RTRIM)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/RTRIM/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SECOND/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[69]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SECOND/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SECOND)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SECOND/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SMALLINT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[70]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SMALLINT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SMALLINT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SMALLINT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/STDDEV/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[71]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/STDDEV/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:STDDEV)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/STDDEV/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SUBSTR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[72]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SUBSTR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SUBSTR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SUBSTR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SUM/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[73]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SUM/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SUM)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SUM/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TABLE_NAME/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[74]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TABLE_NAME/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TABLE_NAME)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TABLE_NAME/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TABLE_SCHEMA/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[75]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TABLE_SCHEMA/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TABLE_SCHEMA)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TABLE_SCHEMA/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TIME/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[76]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TIME/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TIME)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TIME/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TIMESTAMP/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[77]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TIMESTAMP/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TIMESTAMP)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TIMESTAMP/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TRANSLATE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[78]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TRANSLATE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TRANSLATE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TRANSLATE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TYPE_ID/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[79]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TYPE_ID/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TYPE_ID)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TYPE_ID/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TYPE_NAME/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[80]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TYPE_NAME/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TYPE_NAME)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TYPE_NAME/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TYPE_SCHEMA/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[81]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TYPE_SCHEMA/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TYPE_SCHEMA)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TYPE_SCHEMA/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/UCASE/i, or /UPPER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[82]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_83_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_83_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_83_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_83_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/UCASE/i, or /UPPER/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/VALUE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[83]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/VALUE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:VALUE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/VALUE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/VARCHAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[84]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/VARCHAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:VARCHAR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/VARCHAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/VARGRAPHIC/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[85]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/VARGRAPHIC/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:VARGRAPHIC)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/VARGRAPHIC/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/VARIANCE/i, or /VAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[86]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_87_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_87_of_rule_sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_87_of_rule_sysibm_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_87_of_rule_sysibm_function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/VARIANCE/i, or /VAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/YEAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[87]; - $text = $_[1]; - my $_savetext; - @item = (q{sysibm_function}); - %item = (__RULE__ => q{sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/YEAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:YEAR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/YEAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_partition_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"window_partition_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [window_partition_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/PARTITION\\s+BY/i ]}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{window_partition_clause}); - %item = (__RULE__ => q{window_partition_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/PARTITION\\s+BY/i]}, Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:PARTITION\s+BY)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying operator: []}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - $_tok = undef; - OPLOOP: while (1) - { - $repcount = 0; - my @item; - - # MATCH LEFTARG - - Parse::RecDescent::_trace(q{Trying subrule: [partitioning_expression]}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{partitioning_expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::partitioning_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [partitioning_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{partitioning_expression}} = $_tok; - push @item, $_tok; - - } - - - $repcount++; - - my $savetext = $text; - my $backtrack; - - # MATCH (OP RIGHTARG)(s) - while ($repcount < 100000000) - { - $backtrack = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/,/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - pop @item; - if (defined $1) {push @item, $item{'partitioning_expression(s)'}=$1; $backtrack=1;} - - Parse::RecDescent::_trace(q{Trying subrule: [partitioning_expression]}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{partitioning_expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::partitioning_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [partitioning_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{partitioning_expression}} = $_tok; - push @item, $_tok; - - } - - $savetext = $text; - $repcount++; - } - $text = $savetext; - pop @item if $backtrack; - - unless (@item) { undef $_tok; last } - $_tok = [ @item ]; - last; - } - - unless ($repcount>=1) - { - Parse::RecDescent::_trace(q{<]>>}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched operator: []<< (return value: [} - . qq{@{$_tok||[]}} . q{]}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - - push @item, $item{'partitioning_expression(s)'}=$_tok||[]; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/PARTITION\\s+BY/i ]<<}, - Parse::RecDescent::_tracefirst($text), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{window_partition_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{window_partition_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{window_partition_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::WHERE -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"WHERE"}; - - Parse::RecDescent::_trace(q{Trying rule: [WHERE]}, - Parse::RecDescent::_tracefirst($_[1]), - q{WHERE}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/where/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{WHERE}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{WHERE}); - %item = (__RULE__ => q{WHERE}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/where/i]}, Parse::RecDescent::_tracefirst($text), - q{WHERE}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:where)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/where/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{WHERE}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{WHERE}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{WHERE}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{WHERE}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{WHERE}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"CREATE"}; - - Parse::RecDescent::_trace(q{Trying rule: [CREATE]}, - Parse::RecDescent::_tracefirst($_[1]), - q{CREATE}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/create/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{CREATE}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{CREATE}); - %item = (__RULE__ => q{CREATE}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/create/i]}, Parse::RecDescent::_tracefirst($text), - q{CREATE}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:create)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/create/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{CREATE}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{CREATE}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{CREATE}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{CREATE}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{CREATE}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysfun -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_sysfun"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_sysfun]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ABS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_sysfun}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ABS/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ABS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ABS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ABSVAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_sysfun}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ABSVAL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ABSVAL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ABSVAL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_sysfun}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SYSIBM\\.|/i sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SYSIBM\\.|/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SYSIBM\.|)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [sysibm_function]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sysibm_function})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysibm_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sysibm_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sysibm_function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/SYSIBM\\.|/i sysibm_function]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SYSFUN\\.|/i sysfun_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SYSFUN\\.|/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SYSFUN\.|)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [sysfun_function]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sysfun_function})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysfun_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sysfun_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sysfun_function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/SYSFUN\\.|/i sysfun_function]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [userdefined_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [userdefined_function]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::userdefined_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [userdefined_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{userdefined_function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [userdefined_function]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::identifier -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"identifier"}; - - Parse::RecDescent::_trace(q{Trying rule: [identifier]}, - Parse::RecDescent::_tracefirst($_[1]), - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{identifier}); - %item = (__RULE__ => q{identifier}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{identifier}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{identifier}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{identifier}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [asc_option]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [asc_option]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::asc_option($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [asc_option]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{asc_option}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [asc_option]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [desc_option]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [desc_option]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::desc_option($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [desc_option]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{desc_option}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [desc_option]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"result_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [result_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{result_expression}); - %item = (__RULE__ => q{result_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{result_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{result_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{result_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scoped_reference_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"scoped_reference_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [scoped_reference_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{scoped_reference_expression}); - %item = (__RULE__ => q{scoped_reference_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { # scoped, reference -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{scoped_reference_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{scoped_reference_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{scoped_reference_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [typed_table_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [typed_table_name]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::typed_table_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [typed_table_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{typed_table_name}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [typed_table_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [typed_view_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [typed_view_name]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::typed_view_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [typed_view_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{typed_view_name}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [typed_view_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::when_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"when_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WHEN/i '(' search_condition ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{when_clause}); - %item = (__RULE__ => q{when_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/WHEN/i]}, Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:WHEN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [search_condition]}, - Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{search_condition})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [search_condition]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{search_condition}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do {$return = $item[3]}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/WHEN/i '(' search_condition ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{when_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{when_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_asc_option -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_asc_option"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_asc_option]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NULLS\\s+FIRST/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_asc_option}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_asc_option}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NULLS\\s+FIRST/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULLS\s+FIRST)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NULLS\\s+FIRST/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NULLS\\s+LAST/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_asc_option}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_asc_option}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NULLS\\s+LAST/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULLS\s+LAST)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NULLS\\s+LAST/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_asc_option}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_name -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"sequence_name"}; - - Parse::RecDescent::_trace(q{Trying rule: [sequence_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{sequence_name}); - %item = (__RULE__ => q{sequence_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{sequence_name}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{sequence_name}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{sequence_name}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_duration -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"ld_duration"}; - - Parse::RecDescent::_trace(q{Trying rule: [ld_duration]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/YEARS?/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_duration}); - %item = (__RULE__ => q{ld_duration}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/YEARS?/i]}, Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:YEARS?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/YEARS?/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/MONTHS?/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_duration}); - %item = (__RULE__ => q{ld_duration}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/MONTHS?/i]}, Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MONTHS?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/MONTHS?/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DAYS?/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_duration}); - %item = (__RULE__ => q{ld_duration}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DAYS?/i]}, Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DAYS?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DAYS?/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/HOURS?/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_duration}); - %item = (__RULE__ => q{ld_duration}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/HOURS?/i]}, Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:HOURS?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/HOURS?/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/MINUTES?/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_duration}); - %item = (__RULE__ => q{ld_duration}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/MINUTES?/i]}, Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MINUTES?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/MINUTES?/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SECONDS?/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[5]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_duration}); - %item = (__RULE__ => q{ld_duration}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SECONDS?/i]}, Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SECONDS?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SECONDS?/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/MICROSECONDS?/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[6]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_duration}); - %item = (__RULE__ => q{ld_duration}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/MICROSECONDS?/i]}, Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MICROSECONDS?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/MICROSECONDS?/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{ld_duration}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{ld_duration}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{ld_duration}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_a -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"reference_a"}; - - Parse::RecDescent::_trace(q{Trying rule: [reference_a]}, - Parse::RecDescent::_tracefirst($_[1]), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REFERENCING/i old_new_corr old_new_table]}, - Parse::RecDescent::_tracefirst($_[1]), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{reference_a}); - %item = (__RULE__ => q{reference_a}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REFERENCING/i]}, Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REFERENCING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [old_new_corr]}, - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{old_new_corr})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_corr, 0, 2, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [old_new_corr]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{old_new_corr(0..2)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [old_new_table]}, - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{old_new_table})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_table, 0, 2, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [old_new_table]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{old_new_table(0..2)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = join(' ', $item[1], join(' ', @{$item[2]}), join(' ', @{$item[3]}) ) }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REFERENCING/i old_new_corr old_new_table]<<}, - Parse::RecDescent::_tracefirst($text), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{reference_a}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{reference_a}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{reference_a}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cast_specification -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"cast_specification"}; - - Parse::RecDescent::_trace(q{Trying rule: [cast_specification]}, - Parse::RecDescent::_tracefirst($_[1]), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CAST/i '(' expression, or /NULL/i, or parameter_marker /AS/i data_type /SCOPE/ ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{cast_specification}); - %item = (__RULE__ => q{cast_specification}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CAST/i]}, Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CAST)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_cast_specification]}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{expression, or /NULL/i, or parameter_marker})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cast_specification($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_cast_specification]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_cast_specification}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/AS/i]}, Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/AS/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [data_type]}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{data_type})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::data_type($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [data_type]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{data_type}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [/SCOPE/]}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{/SCOPE/})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cast_specification, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_2_of_production_1_of_rule_cast_specification]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_2_of_production_1_of_rule_cast_specification(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CAST/i '(' expression, or /NULL/i, or parameter_marker /AS/i data_type /SCOPE/ ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{cast_specification}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{cast_specification}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"type"}; - - Parse::RecDescent::_trace(q{Trying rule: [type]}, - Parse::RecDescent::_tracefirst($_[1]), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/UPDATE/i /OF/i ]}, - Parse::RecDescent::_tracefirst($_[1]), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{type}); - %item = (__RULE__ => q{type}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/UPDATE/i]}, Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UPDATE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/OF/i]}, Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/OF/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:OF)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying operator: []}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - $_tok = undef; - OPLOOP: while (1) - { - $repcount = 0; - my @item; - - # MATCH LEFTARG - - Parse::RecDescent::_trace(q{Trying subrule: [column_name]}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{column_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_name}} = $_tok; - push @item, $_tok; - - } - - - $repcount++; - - my $savetext = $text; - my $backtrack; - - # MATCH (OP RIGHTARG)(s) - while ($repcount < 100000000) - { - $backtrack = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/,/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN3__}=$&; - - - pop @item; - if (defined $1) {push @item, $item{'column_name(s)'}=$1; $backtrack=1;} - - Parse::RecDescent::_trace(q{Trying subrule: [column_name]}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{column_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_name}} = $_tok; - push @item, $_tok; - - } - - $savetext = $text; - $repcount++; - } - $text = $savetext; - pop @item if $backtrack; - - unless (@item) { undef $_tok; last } - $_tok = [ @item ]; - last; - } - - unless ($repcount>=1) - { - Parse::RecDescent::_trace(q{<]>>}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched operator: []<< (return value: [} - . qq{@{$_tok||[]}} . q{]}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - - push @item, $item{'column_name(s)'}=$_tok||[]; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { event => 'update_on', - fields => $item[3] } -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/UPDATE/i /OF/i ]<<}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/INSERT/i, or /DELETE/i, or /UPDATE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{type}); - %item = (__RULE__ => q{type}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_2_of_rule_type]}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_type($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_2_of_rule_type]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_2_of_rule_type}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { event => $item[1] } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/INSERT/i, or /DELETE/i, or /UPDATE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{type}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{type}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{type}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{type}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_12_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_12_of_rule_sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_12_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/COVARIANCE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_12_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_12_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/COVARIANCE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:COVARIANCE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/COVARIANCE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/COVAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_12_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_12_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/COVAR/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:COVAR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/COVAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_12_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scalar_fullselect -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"scalar_fullselect"}; - - Parse::RecDescent::_trace(q{Trying rule: [scalar_fullselect]}, - Parse::RecDescent::_tracefirst($_[1]), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' fullselect ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{scalar_fullselect}); - %item = (__RULE__ => q{scalar_fullselect}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [fullselect]}, - Parse::RecDescent::_tracefirst($text), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{fullselect})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::fullselect($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [fullselect]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{fullselect}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' fullselect ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{scalar_fullselect}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{scalar_fullselect}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{scalar_fullselect}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_options -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_options"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_options]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CASCADED/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_options}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_options}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CASCADED/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CASCADED)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CASCADED/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LOCAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_options}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_options}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LOCAL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LOCAL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LOCAL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_options}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::func_args -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"func_args"}; - - Parse::RecDescent::_trace(q{Trying rule: [func_args]}, - Parse::RecDescent::_tracefirst($_[1]), - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{func_args}); - %item = (__RULE__ => q{func_args}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{func_args}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{func_args}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{func_args}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::trigger_name -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"trigger_name"}; - - Parse::RecDescent::_trace(q{Trying rule: [trigger_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [SCHEMA '.' NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{trigger_name}); - %item = (__RULE__ => q{trigger_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [SCHEMA]}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [SCHEMA]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{SCHEMA}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: ['.']}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'.'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\.//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{NAME})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { schema => $item[1], name => $item[3] } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [SCHEMA '.' NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{trigger_name}); - %item = (__RULE__ => q{trigger_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { name => $item[1] } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{trigger_name}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{trigger_name}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{trigger_name}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_numbering_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_numbering_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_2_of_production_1_of_rule_numbering_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_numbering_function}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_numbering_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RANGE\s+BETWEEN\s+UNBOUNDED\s+PRECEDING\s+AND\s+UNBBOUNDED\s+FOLLOWING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_numbering_function}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_numbering_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_aggregation_group_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [window_aggregation_group_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{window_aggregation_group_clause}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [window_aggregation_group_clause]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_2_of_production_1_of_rule_numbering_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_name -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"method_name"}; - - Parse::RecDescent::_trace(q{Trying rule: [method_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{method_name}); - %item = (__RULE__ => q{method_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { # must be a method of subject_expression -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{method_name}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{method_name}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{method_name}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::quantified_p -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"quantified_p"}; - - Parse::RecDescent::_trace(q{Trying rule: [quantified_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [expression1 /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ /SOME|ANY|ALL/i '(' fullselect ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{quantified_p}); - %item = (__RULE__ => q{quantified_p}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression1]}, - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression1($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression1]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression1}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/]}, Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(=|<>|<|>|<=|=>|\^=|\^<|\^>|\!=))//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SOME|ANY|ALL/i]}, Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/SOME|ANY|ALL/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SOME|ANY|ALL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [fullselect]}, - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{fullselect})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::fullselect($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [fullselect]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{fullselect}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [expression1 /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ /SOME|ANY|ALL/i '(' fullselect ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{quantified_p}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{quantified_p}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{quantified_p}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::common_table_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"common_table_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [common_table_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [table_name column_list /AS/i get_bracketed]}, - Parse::RecDescent::_tracefirst($_[1]), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{common_table_expression}); - %item = (__RULE__ => q{common_table_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [table_name]}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [table_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{table_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [column_list]}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{column_list})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_list]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_list}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/AS/i]}, Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/AS/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [get_bracketed]}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{get_bracketed})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::get_bracketed($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [get_bracketed]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{get_bracketed}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = { name => $item{table_name}{name}, - query => $item[4] - }; -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [table_name column_list /AS/i get_bracketed]<<}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [table_name column_list /AS/i '(' fullselect ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{common_table_expression}); - %item = (__RULE__ => q{common_table_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [table_name]}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [table_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{table_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [column_list]}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{column_list})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_list]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_list}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/AS/i]}, Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/AS/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [fullselect]}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{fullselect})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::fullselect($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [fullselect]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{fullselect}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [table_name column_list /AS/i '(' fullselect ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{common_table_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{common_table_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{common_table_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::after -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"after"}; - - Parse::RecDescent::_trace(q{Trying rule: [after]}, - Parse::RecDescent::_tracefirst($_[1]), - q{after}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/AFTER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{after}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{after}); - %item = (__RULE__ => q{after}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/AFTER/i]}, Parse::RecDescent::_tracefirst($text), - q{after}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AFTER)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/AFTER/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{after}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{after}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{after}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{after}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{after}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::predicate -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"predicate"}; - - Parse::RecDescent::_trace(q{Trying rule: [predicate]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [basic_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [basic_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::basic_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [basic_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{basic_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [basic_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [quantified_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [quantified_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::quantified_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [quantified_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{quantified_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [quantified_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [between_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [between_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::between_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [between_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{between_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [between_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [exists_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [exists_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::exists_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [exists_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{exists_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [exists_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [in_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [in_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::in_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [in_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{in_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [in_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [like_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[5]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [like_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::like_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [like_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{like_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [like_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [null_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[6]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [null_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::null_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [null_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{null_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [null_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [type_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[7]; - $text = $_[1]; - my $_savetext; - @item = (q{predicate}); - %item = (__RULE__ => q{predicate}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [type_p]}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type_p($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [type_p]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{type_p}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [type_p]<<}, - Parse::RecDescent::_tracefirst($text), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{predicate}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{predicate}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{predicate}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"column_name"}; - - Parse::RecDescent::_trace(q{Trying rule: [column_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{column_name}); - %item = (__RULE__ => q{column_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{column_name}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{column_name}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{column_name}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_invocation -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"method_invocation"}; - - Parse::RecDescent::_trace(q{Trying rule: [method_invocation]}, - Parse::RecDescent::_tracefirst($_[1]), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [subject_expression '..' method_name '(']}, - Parse::RecDescent::_tracefirst($_[1]), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{method_invocation}); - %item = (__RULE__ => q{method_invocation}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [subject_expression]}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subject_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [subject_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{subject_expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: ['..']}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'..'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\.\.//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [method_name]}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{method_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [method_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{method_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{'('})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_method_invocation, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_method_invocation]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_method_invocation(?)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [subject_expression '..' method_name '(']<<}, - Parse::RecDescent::_tracefirst($text), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{method_invocation}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{method_invocation}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_dereference_operation -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_dereference_operation"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_dereference_operation]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' expression ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_dereference_operation}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_dereference_operation}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{expression})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [expression]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' expression ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_dereference_operation}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_searched_when_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_searched_when_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_searched_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_searched_when_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_searched_when_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/WHEN/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:WHEN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [search_condition]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{search_condition})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [search_condition]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{search_condition}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/THEN/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/THEN/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:THEN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{result_expression, or /NULL/i})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound2 -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"group_bound2"}; - - Parse::RecDescent::_trace(q{Trying rule: [group_bound2]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound2}); - %item = (__RULE__ => q{group_bound2}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [unsigned_constant /PRECEDING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound2}); - %item = (__RULE__ => q{group_bound2}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [unsigned_constant]}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [unsigned_constant]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{unsigned_constant}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/PRECEDING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/PRECEDING/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:PRECEDING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [unsigned_constant /PRECEDING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [unsigned_constant /FOLLOWING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound2}); - %item = (__RULE__ => q{group_bound2}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [unsigned_constant]}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [unsigned_constant]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{unsigned_constant}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/FOLLOWING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/FOLLOWING/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FOLLOWING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [unsigned_constant /FOLLOWING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CURRENT\\s+ROW/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{group_bound2}); - %item = (__RULE__ => q{group_bound2}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CURRENT\\s+ROW/i]}, Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CURRENT\s+ROW)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CURRENT\\s+ROW/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{group_bound2}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{group_bound2}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{group_bound2}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::searched_when_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"searched_when_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [searched_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WHEN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{searched_when_clause}); - %item = (__RULE__ => q{searched_when_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [/WHEN/i]}, - Parse::RecDescent::_tracefirst($text), - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_searched_when_clause, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_searched_when_clause]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_searched_when_clause(s)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [/WHEN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{searched_when_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{searched_when_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::basic_p -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"basic_p"}; - - Parse::RecDescent::_trace(q{Trying rule: [basic_p]}, - Parse::RecDescent::_tracefirst($_[1]), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [expression /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{basic_p}); - %item = (__RULE__ => q{basic_p}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/]}, Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(=|<>|<|>|<=|=>|\^=|\^<|\^>|\!=))//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [expression /(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)/ expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{basic_p}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{basic_p}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{basic_p}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::asc_option -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"asc_option"}; - - Parse::RecDescent::_trace(q{Trying rule: [asc_option]}, - Parse::RecDescent::_tracefirst($_[1]), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ASC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{asc_option}); - %item = (__RULE__ => q{asc_option}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ASC/i]}, Parse::RecDescent::_tracefirst($text), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ASC)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, - Parse::RecDescent::_tracefirst($text), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_asc_option, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_asc_option]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_asc_option(?)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ASC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{asc_option}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{asc_option}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{asc_option}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"search_condition"}; - - Parse::RecDescent::_trace(q{Trying rule: [search_condition]}, - Parse::RecDescent::_tracefirst($_[1]), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/[^)]+/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{search_condition}); - %item = (__RULE__ => q{search_condition}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/[^)]+/]}, Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:[^)]+)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/[^)]+/]<<}, - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NOT|/i predicate, or '(' cond]}, - Parse::RecDescent::_tracefirst($_[1]), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{search_condition}); - %item = (__RULE__ => q{search_condition}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NOT|/i]}, Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NOT|)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_2_of_rule_search_condition]}, - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{predicate, or '('})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_2_of_rule_search_condition($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_2_of_rule_search_condition]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_2_of_rule_search_condition}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [cond]}, - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{cond})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cond, 0, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [cond]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{cond(s?)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NOT|/i predicate, or '(' cond]<<}, - Parse::RecDescent::_tracefirst($text), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{search_condition}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{search_condition}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_operator -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_operator"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_operator]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CONCAT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_operator}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_operator}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CONCAT/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CONCAT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CONCAT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['||']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_operator}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_operator}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['||']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\|\|//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['||']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_operator}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::simple_when_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"simple_when_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [simple_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [expression /WHEN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{simple_when_clause}); - %item = (__RULE__ => q{simple_when_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [/WHEN/i]}, - Parse::RecDescent::_tracefirst($text), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{/WHEN/i})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_simple_when_clause, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_simple_when_clause]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_simple_when_clause(s)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [expression /WHEN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{simple_when_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{simple_when_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::INNER -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"INNER"}; - - Parse::RecDescent::_trace(q{Trying rule: [INNER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{INNER}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/inner/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{INNER}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{INNER}); - %item = (__RULE__ => q{INNER}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/inner/i]}, Parse::RecDescent::_tracefirst($text), - q{INNER}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:inner)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/inner/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{INNER}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{INNER}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{INNER}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{INNER}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{INNER}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::eofile -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"eofile"}; - - Parse::RecDescent::_trace(q{Trying rule: [eofile]}, - Parse::RecDescent::_tracefirst($_[1]), - q{eofile}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/^\\Z/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{eofile}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{eofile}); - %item = (__RULE__ => q{eofile}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/^\\Z/]}, Parse::RecDescent::_tracefirst($text), - q{eofile}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^\Z)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/^\\Z/]<<}, - Parse::RecDescent::_tracefirst($text), - q{eofile}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{eofile}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{eofile}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{eofile}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{eofile}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cond -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"cond"}; - - Parse::RecDescent::_trace(q{Trying rule: [cond]}, - Parse::RecDescent::_tracefirst($_[1]), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/AND/i, or /OR/i /NOT|/i predicate, or '(']}, - Parse::RecDescent::_tracefirst($_[1]), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{cond}); - %item = (__RULE__ => q{cond}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_cond]}, - Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cond($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_cond]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_cond}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/NOT|/i]}, Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/NOT|/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NOT|)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_2_of_production_1_of_rule_cond]}, - Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{predicate, or '('})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_cond($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_2_of_production_1_of_rule_cond]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_2_of_production_1_of_rule_cond}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/AND/i, or /OR/i /NOT|/i predicate, or '(']<<}, - Parse::RecDescent::_tracefirst($text), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{cond}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{cond}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{cond}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ld_type -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"ld_type"}; - - Parse::RecDescent::_trace(q{Trying rule: [ld_type]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_type}); - %item = (__RULE__ => q{ld_type}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [function]}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [function]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' expression ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_type}); - %item = (__RULE__ => q{ld_type}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' expression ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [constant]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_type}); - %item = (__RULE__ => q{ld_type}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [constant]}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [constant]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{constant}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [constant]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [column_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_type}); - %item = (__RULE__ => q{ld_type}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [column_name]}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_name}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [column_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [host_variable]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{ld_type}); - %item = (__RULE__ => q{ld_type}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [host_variable]}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::host_variable($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [host_variable]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{host_variable}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [host_variable]<<}, - Parse::RecDescent::_tracefirst($text), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{ld_type}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{ld_type}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{ld_type}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::RIGHT -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"RIGHT"}; - - Parse::RecDescent::_trace(q{Trying rule: [RIGHT]}, - Parse::RecDescent::_tracefirst($_[1]), - q{RIGHT}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/right/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{RIGHT}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{RIGHT}); - %item = (__RULE__ => q{RIGHT}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/right/i]}, Parse::RecDescent::_tracefirst($text), - q{RIGHT}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:right)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/right/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{RIGHT}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{RIGHT}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{RIGHT}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{RIGHT}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{RIGHT}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_method_invocation -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_method_invocation"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_method_invocation]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' expression ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_method_invocation}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_method_invocation}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{expression})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [expression]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' expression ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_method_invocation}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::LEFT -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"LEFT"}; - - Parse::RecDescent::_trace(q{Trying rule: [LEFT]}, - Parse::RecDescent::_tracefirst($_[1]), - q{LEFT}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/left/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{LEFT}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{LEFT}); - %item = (__RULE__ => q{LEFT}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/left/i]}, Parse::RecDescent::_tracefirst($text), - q{LEFT}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:left)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/left/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{LEFT}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{LEFT}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{LEFT}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{LEFT}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{LEFT}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"table_name"}; - - Parse::RecDescent::_trace(q{Trying rule: [table_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [SCHEMA '.' NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{table_name}); - %item = (__RULE__ => q{table_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [SCHEMA]}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SCHEMA($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [SCHEMA]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{SCHEMA}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: ['.']}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'.'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\.//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{NAME})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { schema => $item[1], name => $item[3] } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [SCHEMA '.' NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{table_name}); - %item = (__RULE__ => q{table_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = { name => $item[1] } }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{table_name}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{table_name}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{table_name}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_53_of_rule_sysfun -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_53_of_rule_sysfun"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_53_of_rule_sysfun]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TRUNCATE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_53_of_rule_sysfun}); - %item = (__RULE__ => q{_alternation_1_of_production_53_of_rule_sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TRUNCATE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TRUNCATE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TRUNCATE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TRUNC/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_53_of_rule_sysfun}); - %item = (__RULE__ => q{_alternation_1_of_production_53_of_rule_sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TRUNC/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TRUNC)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TRUNC/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_53_of_rule_sysfun}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::options -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"options"}; - - Parse::RecDescent::_trace(q{Trying rule: [options]}, - Parse::RecDescent::_tracefirst($_[1]), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WITH/i /CASCADED/i, or /LOCAL/i /CHECK\\s+OPTION/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{options}); - %item = (__RULE__ => q{options}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/WITH/i]}, Parse::RecDescent::_tracefirst($text), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:WITH)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_options]}, - Parse::RecDescent::_tracefirst($text), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{/CASCADED/i, or /LOCAL/i})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_options($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_options]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_options}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/CHECK\\s+OPTION/i]}, Parse::RecDescent::_tracefirst($text), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/CHECK\\s+OPTION/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CHECK\s+OPTION)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/WITH/i /CASCADED/i, or /LOCAL/i /CHECK\\s+OPTION/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{options}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{options}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{options}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{options}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"function"}; - - Parse::RecDescent::_trace(q{Trying rule: [function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SYSIBM\\.|/i, or /SYSFUN\\.|/i, or userdefined_function '(' ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{function}); - %item = (__RULE__ => q{function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_function]}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_function}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying operator: []}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - $_tok = undef; - OPLOOP: while (1) - { - $repcount = 0; - my @item; - - # MATCH LEFTARG - - Parse::RecDescent::_trace(q{Trying subrule: [func_args]}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{func_args})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::func_args($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [func_args]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{func_args}} = $_tok; - push @item, $_tok; - - } - - - $repcount++; - - my $savetext = $text; - my $backtrack; - - # MATCH (OP RIGHTARG)(s) - while ($repcount < 100000000) - { - $backtrack = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/,/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - pop @item; - if (defined $1) {push @item, $item{'func_args(s)'}=$1; $backtrack=1;} - - Parse::RecDescent::_trace(q{Trying subrule: [func_args]}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{func_args})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::func_args($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [func_args]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{func_args}} = $_tok; - push @item, $_tok; - - } - - $savetext = $text; - $repcount++; - } - $text = $savetext; - pop @item if $backtrack; - - unless (@item) { undef $_tok; last } - $_tok = [ @item ]; - last; - } - - unless ($repcount>=1) - { - Parse::RecDescent::_trace(q{<]>>}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched operator: []<< (return value: [} - . qq{@{$_tok||[]}} . q{]}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - - push @item, $item{'func_args(s)'}=$_tok||[]; - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SYSIBM\\.|/i, or /SYSFUN\\.|/i, or userdefined_function '(' ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_41_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_41_of_rule_sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_41_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/INTEGER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_41_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_41_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/INTEGER/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:INTEGER)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/INTEGER/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/INT/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_41_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_41_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/INT/]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:INT)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/INT/]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_41_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_case_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_case_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_case_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [searched_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_case_expression}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_case_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [searched_when_clause]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::searched_when_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [searched_when_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{searched_when_clause}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [searched_when_clause]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [simple_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_case_expression}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_case_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [simple_when_clause]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::simple_when_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [simple_when_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{simple_when_clause}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [simple_when_clause]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_case_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_order_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_window_order_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_window_order_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [sort_key_expression asc_option, or desc_option]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_window_order_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_window_order_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [sort_key_expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sort_key_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sort_key_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sort_key_expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [asc_option, or desc_option]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{asc_option, or desc_option})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause(?)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [sort_key_expression asc_option, or desc_option]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_window_order_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::create -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"create"}; - - Parse::RecDescent::_trace(q{Trying rule: [create]}, - Parse::RecDescent::_tracefirst($_[1]), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [CREATE TRIGGER trigger_name before type /ON/i table_name reference_b /FOR EACH ROW/i 'MODE DB2SQL' triggered_action]}, - Parse::RecDescent::_tracefirst($_[1]), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{create}); - %item = (__RULE__ => q{create}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [CREATE]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [CREATE]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{CREATE}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [TRIGGER]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{TRIGGER})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::TRIGGER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [TRIGGER]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{TRIGGER}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [trigger_name]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{trigger_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::trigger_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [trigger_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{trigger_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [before]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{before})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::before($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [before]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{before}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [type]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{type})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [type]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{type}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/ON/i]}, Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/ON/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ON)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [table_name]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{table_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [table_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{table_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [reference_b]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{reference_b})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_b, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [reference_b]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{reference_b(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [/FOR EACH ROW/i]}, Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/FOR EACH ROW/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FOR EACH ROW)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['MODE DB2SQL']}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'MODE DB2SQL'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\AMODE\ DB2SQL//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [triggered_action]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{triggered_action})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::triggered_action($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [triggered_action]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{triggered_action}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - my $table_name = $item{'table_name'}{'name'}; - $return = { - table => $table_name, - schema => $item{'trigger_name'}{'schema'}, - name => $item{'trigger_name'}{'name'}, - when => 'before', - db_event => $item{'type'}->{'event'}, - fields => $item{'type'}{'fields'}, - condition => $item{'triggered_action'}{'condition'}, - reference => $item{'reference_b'}, - granularity => $item[9], - action => $item{'triggered_action'}{'statement'} - }; - - push @triggers, $return; -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [CREATE TRIGGER trigger_name before type /ON/i table_name reference_b /FOR EACH ROW/i 'MODE DB2SQL' triggered_action]<<}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [CREATE TRIGGER trigger_name after type /ON/i table_name reference_a /FOR EACH ROW|FOR EACH STATEMENT/i 'MODE DB2SQL' triggered_action]}, - Parse::RecDescent::_tracefirst($_[1]), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{create}); - %item = (__RULE__ => q{create}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [CREATE]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [CREATE]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{CREATE}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [TRIGGER]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{TRIGGER})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::TRIGGER($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [TRIGGER]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{TRIGGER}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [trigger_name]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{trigger_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::trigger_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [trigger_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{trigger_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [after]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{after})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::after($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [after]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{after}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [type]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{type})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::type($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [type]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{type}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/ON/i]}, Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/ON/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ON)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [table_name]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{table_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::table_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [table_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{table_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [reference_a]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{reference_a})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_a, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [reference_a]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{reference_a(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [/FOR EACH ROW|FOR EACH STATEMENT/i]}, Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/FOR EACH ROW|FOR EACH STATEMENT/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FOR EACH ROW|FOR EACH STATEMENT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['MODE DB2SQL']}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'MODE DB2SQL'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\AMODE\ DB2SQL//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [triggered_action]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{triggered_action})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::triggered_action($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [triggered_action]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{triggered_action}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - my $table_name = $item{'table_name'}{'name'}; - $return = { - table => $table_name, - schema => $item{'trigger_name'}{'schema'}, - name => $item{'trigger_name'}{'name'}, - when => 'after', - db_event => $item{'type'}{'event'}, - fields => $item{'type'}{'fields'}, - condition => $item{'triggered_action'}{'condition'}, - reference => $item{'reference_a'}, - granularity => $item[9], - action => $item{'triggered_action'}{'statement'} - }; - - push @triggers, $return; -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [CREATE TRIGGER trigger_name after type /ON/i table_name reference_a /FOR EACH ROW|FOR EACH STATEMENT/i 'MODE DB2SQL' triggered_action]<<}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [CREATE /FEDERATED|/i VIEW view_name column_list /AS/i with_expression SQL_procedure_statement]}, - Parse::RecDescent::_tracefirst($_[1]), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{create}); - %item = (__RULE__ => q{create}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [CREATE]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::CREATE($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [CREATE]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{CREATE}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/FEDERATED|/i]}, Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/FEDERATED|/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FEDERATED|)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [VIEW]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{VIEW})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::VIEW($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [VIEW]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{VIEW}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [view_name]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{view_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::view_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [view_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{view_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [column_list]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{column_list})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [column_list]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_list(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying terminal: [/AS/i]}, Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/AS/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [with_expression]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{with_expression})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::with_expression, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [with_expression]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{with_expression(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying subrule: [SQL_procedure_statement]}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{SQL_procedure_statement})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SQL_procedure_statement($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [SQL_procedure_statement]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{SQL_procedure_statement}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = { - name => $item{view_name}{name}, - sql => $item{SQL_procedure_statement}, - with => $item{'with_expression(?)'}, - fields => $item{'column_list(?)'} - }; - push @views, $return; -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [CREATE /FEDERATED|/i VIEW view_name column_list /AS/i with_expression SQL_procedure_statement]<<}, - Parse::RecDescent::_tracefirst($text), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{create}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{create}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{create}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{create}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sysfun -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"sysfun"}; - - Parse::RecDescent::_trace(q{Trying rule: [sysfun]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ABS/i, or /ABSVAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_sysfun]}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysfun($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_sysfun]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_sysfun}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/ABS/i, or /ABSVAL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ACOS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ACOS/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ACOS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ACOS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ASCII/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ASCII/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ASCII)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ASCII/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ASIN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ASIN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ASIN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ASIN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ATAN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ATAN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ATAN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ATAN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ATAN2/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[5]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ATAN2/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ATAN2)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ATAN2/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CEIL/i, or /CEILING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[6]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_7_of_rule_sysfun]}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_7_of_rule_sysfun($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_7_of_rule_sysfun]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_7_of_rule_sysfun}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/CEIL/i, or /CEILING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CHAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[7]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CHAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CHAR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CHAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CHR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[8]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CHR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CHR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CHR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/COS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[9]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/COS/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:COS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/COS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/COT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[10]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/COT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:COT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/COT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DAYNAME/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[11]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DAYNAME/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DAYNAME)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DAYNAME/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DAYOFWEEK/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[12]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DAYOFWEEK/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DAYOFWEEK)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DAYOFWEEK/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DAYOFWEEK_ISO/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[13]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DAYOFWEEK_ISO/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DAYOFWEEK_ISO)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DAYOFWEEK_ISO/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DAYOFYEAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[14]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DAYOFYEAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DAYOFYEAR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DAYOFYEAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DEGREES/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[15]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DEGREES/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DEGREES)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DEGREES/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DIFFERENCE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[16]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DIFFERENCE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DIFFERENCE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DIFFERENCE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DOUBLE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[17]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DOUBLE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DOUBLE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DOUBLE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/EXP/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[18]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/EXP/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:EXP)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/EXP/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/FLOOR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[19]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/FLOOR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:FLOOR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/FLOOR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/GET_ROUTINE_SAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[20]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/GET_ROUTINE_SAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:GET_ROUTINE_SAR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/GET_ROUTINE_SAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/INSERT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[21]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/INSERT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:INSERT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/INSERT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/JULIAN_DAY/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[22]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/JULIAN_DAY/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:JULIAN_DAY)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/JULIAN_DAY/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LCASE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[23]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LCASE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LCASE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LCASE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LEFT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[24]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LEFT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LEFT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LEFT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[25]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LOCATE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[26]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LOCATE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LOCATE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LOCATE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LOG/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[27]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LOG/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LOG)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LOG/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LOG10/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[28]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LOG10/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LOG10)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LOG10/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LTRIM/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[29]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LTRIM/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LTRIM)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LTRIM/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/MIDNIGHT_SECONDS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[30]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/MIDNIGHT_SECONDS/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MIDNIGHT_SECONDS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/MIDNIGHT_SECONDS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/MOD/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[31]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/MOD/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MOD)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/MOD/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/MONTHNAME/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[32]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/MONTHNAME/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:MONTHNAME)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/MONTHNAME/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/POWER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[33]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/POWER/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:POWER)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/POWER/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/PUT_ROUTINE_SAR/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[34]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/PUT_ROUTINE_SAR/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:PUT_ROUTINE_SAR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/PUT_ROUTINE_SAR/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/QUARTER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[35]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/QUARTER/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:QUARTER)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/QUARTER/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RADIANS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[36]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RADIANS/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RADIANS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/RADIANS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RAND/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[37]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RAND/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RAND)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/RAND/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REPEAT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[38]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REPEAT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REPEAT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REPEAT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REPLACE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[39]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REPLACE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REPLACE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REPLACE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RIGHT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[40]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RIGHT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RIGHT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/RIGHT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ROUND/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[41]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ROUND/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ROUND)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ROUND/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RTRIM/ I]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[42]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RTRIM/]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RTRIM)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [I]}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{I})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::I($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [I]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{I}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/RTRIM/ I]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SIGN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[43]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SIGN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SIGN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SIGN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SIN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[44]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SIN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SIN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SIN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SOUNDEX/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[45]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SOUNDEX/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SOUNDEX)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SOUNDEX/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SPACE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[46]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SPACE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SPACE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SPACE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SQLCACHE_SNAPSHOT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[47]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SQLCACHE_SNAPSHOT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SQLCACHE_SNAPSHOT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SQLCACHE_SNAPSHOT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SQRT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[48]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SQRT/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SQRT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/SQRT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TAN/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[49]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TAN/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TAN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TAN/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TIMESTAMP_ISO/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[50]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TIMESTAMP_ISO/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TIMESTAMP_ISO)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TIMESTAMP_ISO/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TIMESTAMPDIFF/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[51]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TIMESTAMPDIFF/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TIMESTAMPDIFF)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TIMESTAMPDIFF/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TRUNCATE/i, or /TRUNC/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[52]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_53_of_rule_sysfun]}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_53_of_rule_sysfun($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_53_of_rule_sysfun]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_53_of_rule_sysfun}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/TRUNCATE/i, or /TRUNC/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/UCASE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[53]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/UCASE/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UCASE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/UCASE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WEEK/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[54]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/WEEK/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:WEEK)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/WEEK/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WEEK_ISO/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[55]; - $text = $_[1]; - my $_savetext; - @item = (q{sysfun}); - %item = (__RULE__ => q{sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/WEEK_ISO/i]}, Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:WEEK_ISO)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/WEEK_ISO/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{sysfun}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{sysfun}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SELECTIVITY/i numeric_constant]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SELECTIVITY/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SELECTIVITY)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [numeric_constant]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{numeric_constant})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numeric_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [numeric_constant]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{numeric_constant}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/SELECTIVITY/i numeric_constant]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"NAME"}; - - Parse::RecDescent::_trace(q{Trying rule: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/\\w+/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{NAME}); - %item = (__RULE__ => q{NAME}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/\\w+/]}, Parse::RecDescent::_tracefirst($text), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\w+)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/\\w+/]<<}, - Parse::RecDescent::_tracefirst($text), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/\\w\{1,18\}/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{NAME}); - %item = (__RULE__ => q{NAME}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/\\w\{1,18\}/]}, Parse::RecDescent::_tracefirst($text), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\w{1,18})//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/\\w\{1,18\}/]<<}, - Parse::RecDescent::_tracefirst($text), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{NAME}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{NAME}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{NAME}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::constant -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"constant"}; - - Parse::RecDescent::_trace(q{Trying rule: [constant]}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [int_const]}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{constant}); - %item = (__RULE__ => q{constant}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [int_const]}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::int_const($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [int_const]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{int_const}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [int_const]<<}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [float_const]}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{constant}); - %item = (__RULE__ => q{constant}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [float_const]}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::float_const($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [float_const]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{float_const}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [float_const]<<}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [dec_const]}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{constant}); - %item = (__RULE__ => q{constant}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [dec_const]}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::dec_const($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [dec_const]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{dec_const}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [dec_const]<<}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [char_const]}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{constant}); - %item = (__RULE__ => q{constant}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [char_const]}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::char_const($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [char_const]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{char_const}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [char_const]<<}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [hex_const]}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{constant}); - %item = (__RULE__ => q{constant}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [hex_const]}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::hex_const($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [hex_const]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{hex_const}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [hex_const]<<}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [grastr_const]}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[5]; - $text = $_[1]; - my $_savetext; - @item = (q{constant}); - %item = (__RULE__ => q{constant}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [grastr_const]}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::grastr_const($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [grastr_const]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{grastr_const}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [grastr_const]<<}, - Parse::RecDescent::_tracefirst($text), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{constant}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{constant}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{constant}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_ranking_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_ranking_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_ranking_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RANK/ '()']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_ranking_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_ranking_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/RANK/]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:RANK)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['()']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'()'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/RANK/ '()']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DENSE_RANK|DENSERANK/i '()']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_ranking_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_ranking_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DENSE_RANK|DENSERANK/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DENSE_RANK|DENSERANK)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['()']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'()'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DENSE_RANK|DENSERANK/i '()']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_ranking_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_aggregation_group_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"window_aggregation_group_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ROWS/i, or /RANGE/i group_start, or group_between, or group_end]}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{window_aggregation_group_clause}); - %item = (__RULE__ => q{window_aggregation_group_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($text), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_aggregation_group_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_window_aggregation_group_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_window_aggregation_group_clause}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_2_of_production_1_of_rule_window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($text), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{group_start, or group_between, or group_end})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_window_aggregation_group_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_2_of_production_1_of_rule_window_aggregation_group_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/ROWS/i, or /RANGE/i group_start, or group_between, or group_end]<<}, - Parse::RecDescent::_tracefirst($text), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{window_aggregation_group_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{window_aggregation_group_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule_window_aggregation_group_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule_window_aggregation_group_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_2_of_production_1_of_rule_window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [group_start]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [group_start]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_start($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [group_start]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{group_start}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [group_start]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [group_between]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [group_between]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_between($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [group_between]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{group_between}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [group_between]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [group_end]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [group_end]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_end($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [group_end]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{group_end}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [group_end]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_2_of_production_1_of_rule_window_aggregation_group_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::VIEW -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"VIEW"}; - - Parse::RecDescent::_trace(q{Trying rule: [VIEW]}, - Parse::RecDescent::_tracefirst($_[1]), - q{VIEW}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/view/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{VIEW}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{VIEW}); - %item = (__RULE__ => q{VIEW}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/view/i]}, Parse::RecDescent::_tracefirst($text), - q{VIEW}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:view)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/view/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{VIEW}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{VIEW}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{VIEW}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{VIEW}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{VIEW}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::with_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"with_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [with_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WITH/i ]}, - Parse::RecDescent::_tracefirst($_[1]), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{with_expression}); - %item = (__RULE__ => q{with_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/WITH/i]}, Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:WITH)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying operator: []}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - $_tok = undef; - OPLOOP: while (1) - { - $repcount = 0; - my @item; - - # MATCH LEFTARG - - Parse::RecDescent::_trace(q{Trying subrule: [common_table_expression]}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{common_table_expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::common_table_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [common_table_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{common_table_expression}} = $_tok; - push @item, $_tok; - - } - - - $repcount++; - - my $savetext = $text; - my $backtrack; - - # MATCH (OP RIGHTARG)(s) - while ($repcount < 100000000) - { - $backtrack = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/,/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - pop @item; - if (defined $1) {push @item, $item{'common_table_expression(s)'}=$1; $backtrack=1;} - - Parse::RecDescent::_trace(q{Trying subrule: [common_table_expression]}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{common_table_expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::common_table_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [common_table_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{common_table_expression}} = $_tok; - push @item, $_tok; - - } - - $savetext = $text; - $repcount++; - } - $text = $savetext; - pop @item if $backtrack; - - unless (@item) { undef $_tok; last } - $_tok = [ @item ]; - last; - } - - unless ($repcount>=1) - { - Parse::RecDescent::_trace(q{<]>>}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched operator: []<< (return value: [} - . qq{@{$_tok||[]}} . q{]}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - - push @item, $item{'common_table_expression(s)'}=$_tok||[]; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = $item{'common_table_expression'}; -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/WITH/i ]<<}, - Parse::RecDescent::_tracefirst($text), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{with_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{with_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{with_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numeric_constant -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"numeric_constant"}; - - Parse::RecDescent::_trace(q{Trying rule: [numeric_constant]}, - Parse::RecDescent::_tracefirst($_[1]), - q{numeric_constant}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/\\d+/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{numeric_constant}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{numeric_constant}); - %item = (__RULE__ => q{numeric_constant}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/\\d+/]}, Parse::RecDescent::_tracefirst($text), - q{numeric_constant}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:\d+)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/\\d+/]<<}, - Parse::RecDescent::_tracefirst($text), - q{numeric_constant}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{numeric_constant}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{numeric_constant}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{numeric_constant}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{numeric_constant}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_table -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"old_new_table"}; - - Parse::RecDescent::_trace(q{Trying rule: [old_new_table]}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/OLD_TABLE/i /(AS)?/i identifier]}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{old_new_table}); - %item = (__RULE__ => q{old_new_table}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/OLD_TABLE/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:OLD_TABLE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/(AS)?/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(AS)?/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(AS)?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [identifier]}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{identifier})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::identifier($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [identifier]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{identifier}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[1..3] ) }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/OLD_TABLE/i /(AS)?/i identifier]<<}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NEW_TABLE/i /(AS)?/i identifier]}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{old_new_table}); - %item = (__RULE__ => q{old_new_table}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NEW_TABLE/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NEW_TABLE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/(AS)?/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(AS)?/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(AS)?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [identifier]}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{identifier})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::identifier($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [identifier]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{identifier}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[1..3] ) }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NEW_TABLE/i /(AS)?/i identifier]<<}, - Parse::RecDescent::_tracefirst($text), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{old_new_table}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{old_new_table}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{old_new_table}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_numbering_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_numbering_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_numbering_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [window_order_clause window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_numbering_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_numbering_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [window_order_clause]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_order_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [window_order_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{window_order_clause}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying repeated subrule: [window_aggregation_group_clause]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{window_aggregation_group_clause})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_aggregation_group_clause, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [window_aggregation_group_clause]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{window_aggregation_group_clause(?)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [window_order_clause window_aggregation_group_clause]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_numbering_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [result_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [result_expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::result_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [result_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{result_expression}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [result_expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NULL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NULL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NULL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_corr -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"old_new_corr"}; - - Parse::RecDescent::_trace(q{Trying rule: [old_new_corr]}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/OLD/i /(AS)?/i correlation_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{old_new_corr}); - %item = (__RULE__ => q{old_new_corr}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/OLD/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:OLD)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/(AS)?/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(AS)?/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(AS)?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [correlation_name]}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{correlation_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::correlation_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [correlation_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{correlation_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[1..3] ) }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/OLD/i /(AS)?/i correlation_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NEW/i /(AS)?/i correlation_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{old_new_corr}); - %item = (__RULE__ => q{old_new_corr}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NEW/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NEW)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/(AS)?/i]}, Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(AS)?/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(AS)?)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [correlation_name]}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{correlation_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::correlation_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [correlation_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{correlation_name}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = join(' ', @item[1..3] ) }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NEW/i /(AS)?/i correlation_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{old_new_corr}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{old_new_corr}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{old_new_corr}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_42_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_42_of_rule_sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_42_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LCASE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_42_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_42_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LCASE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LCASE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LCASE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/LOWER/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_42_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_42_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/LOWER/]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:LOWER)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/LOWER/]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_42_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subtype_treatment -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"subtype_treatment"}; - - Parse::RecDescent::_trace(q{Trying rule: [subtype_treatment]}, - Parse::RecDescent::_tracefirst($_[1]), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/TREAT/i '(' expression /AS/i data_type ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{subtype_treatment}); - %item = (__RULE__ => q{subtype_treatment}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/TREAT/i]}, Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:TREAT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/AS/i]}, Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/AS/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [data_type]}, - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{data_type})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::data_type($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [data_type]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{data_type}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/TREAT/i '(' expression /AS/i data_type ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{subtype_treatment}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{subtype_treatment}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{subtype_treatment}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: []}, - Parse::RecDescent::_tracefirst($_[1]), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{expression}); - %item = (__RULE__ => q{expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying operator: []}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - $_tok = undef; - OPLOOP: while (1) - { - $repcount = 0; - my @item; - - # MATCH LEFTARG - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_expression]}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{'+', or '-'})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_expression}} = $_tok; - push @item, $_tok; - - } - - - $repcount++; - - my $savetext = $text; - my $backtrack; - - # MATCH (OP RIGHTARG)(s) - while ($repcount < 100000000) - { - $backtrack = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/operator/]}, Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/operator/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:operator)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - pop @item; - if (defined $1) {push @item, $item{'_alternation_1_of_production_1_of_rule_expression(s)'}=$1; $backtrack=1;} - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_expression]}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{'+', or '-'})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_expression}} = $_tok; - push @item, $_tok; - - } - - $savetext = $text; - $repcount++; - } - $text = $savetext; - pop @item if $backtrack; - - unless (@item) { undef $_tok; last } - $_tok = [ @item ]; - last; - } - - unless ($repcount>=1) - { - Parse::RecDescent::_trace(q{<]>>}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched operator: []<< (return value: [} - . qq{@{$_tok||[]}} . q{]}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - - push @item, $item{'_alternation_1_of_production_1_of_rule_expression(s)'}=$_tok||[]; - - - - Parse::RecDescent::_trace(q{>>Matched production: []<<}, - Parse::RecDescent::_tracefirst($text), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [function]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [function]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' expression ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' expression ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [constant]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [constant]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [constant]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{constant}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [constant]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [column_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[3]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [column_name]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_name}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [column_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [host_variable]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[4]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [host_variable]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::host_variable($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [host_variable]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{host_variable}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [host_variable]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [special_register]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[5]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [special_register]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::special_register($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [special_register]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{special_register}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [special_register]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' scalar_fullselect ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[6]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [scalar_fullselect]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{scalar_fullselect})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scalar_fullselect($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [scalar_fullselect]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{scalar_fullselect}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' scalar_fullselect ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [labeled_duration]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[7]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [labeled_duration]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::labeled_duration($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [labeled_duration]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{labeled_duration}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [labeled_duration]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [case_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[8]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [case_expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::case_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [case_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{case_expression}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [case_expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [cast_specification]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[9]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [cast_specification]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::cast_specification($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [cast_specification]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{cast_specification}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [cast_specification]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [OLAP_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[10]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [OLAP_function]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::OLAP_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [OLAP_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{OLAP_function}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [OLAP_function]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [method_invocation]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[11]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [method_invocation]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::method_invocation($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [method_invocation]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{method_invocation}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [method_invocation]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [subtype_treatment]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[12]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [subtype_treatment]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::subtype_treatment($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [subtype_treatment]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{subtype_treatment}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [subtype_treatment]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [sequence_reference]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[13]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - %item = (__RULE__ => q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [sequence_reference]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_reference($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sequence_reference]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sequence_reference}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [sequence_reference]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::startrule -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"startrule"}; - - Parse::RecDescent::_trace(q{Trying rule: [startrule]}, - Parse::RecDescent::_tracefirst($_[1]), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [statement eofile]}, - Parse::RecDescent::_tracefirst($_[1]), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{startrule}); - %item = (__RULE__ => q{startrule}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [statement]}, - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::statement, 1, 100000000, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [statement]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{statement(s)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying subrule: [eofile]}, - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{eofile})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::eofile($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [eofile]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{eofile}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = { - tables => \%tables, - views => \@views, - triggers => \@triggers, - } -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [statement eofile]<<}, - Parse::RecDescent::_tracefirst($text), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{startrule}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{startrule}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{startrule}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_cast_specification -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_cast_specification"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_cast_specification]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_cast_specification}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cast_specification}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [expression]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{expression}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [expression]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NULL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_cast_specification}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cast_specification}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NULL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NULL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NULL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [parameter_marker]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_cast_specification}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_cast_specification}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [parameter_marker]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::parameter_marker($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [parameter_marker]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{parameter_marker}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [parameter_marker]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_cast_specification}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::before -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"before"}; - - Parse::RecDescent::_trace(q{Trying rule: [before]}, - Parse::RecDescent::_tracefirst($_[1]), - q{before}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NO CASCADE BEFORE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{before}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{before}); - %item = (__RULE__ => q{before}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NO CASCADE BEFORE/i]}, Parse::RecDescent::_tracefirst($text), - q{before}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NO CASCADE BEFORE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/NO CASCADE BEFORE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{before}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{before}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{before}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{before}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{before}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_83_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_83_of_rule_sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_83_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/UCASE/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_83_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_83_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/UCASE/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UCASE)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/UCASE/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/UPPER/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_83_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_83_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/UPPER/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UPPER)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/UPPER/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_83_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::ranking_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"ranking_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [ranking_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/RANK/, or /DENSE_RANK|DENSERANK/i /OVER/i '(' window_partition_clause window_order_clause ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{ranking_function}); - %item = (__RULE__ => q{ranking_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_ranking_function]}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_ranking_function($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_ranking_function]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_ranking_function}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/OVER/i]}, Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/OVER/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:OVER)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'('})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [window_partition_clause]}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{window_partition_clause})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_partition_clause, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [window_partition_clause]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{window_partition_clause(?)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying subrule: [window_order_clause]}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{window_order_clause})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_order_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [window_order_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{window_order_clause}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/RANK/, or /DENSE_RANK|DENSERANK/i /OVER/i '(' window_partition_clause window_order_clause ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{ranking_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{ranking_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{ranking_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/SELECTIVITY/i numeric_constant]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/SELECTIVITY/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:SELECTIVITY)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [numeric_constant]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{numeric_constant})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numeric_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [numeric_constant]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{numeric_constant}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/SELECTIVITY/i numeric_constant]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ABS/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ABS/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ABS)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ABS/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/ABSVAL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/ABSVAL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ABSVAL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/ABSVAL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_b -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"reference_b"}; - - Parse::RecDescent::_trace(q{Trying rule: [reference_b]}, - Parse::RecDescent::_tracefirst($_[1]), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REFERENCING/i old_new_corr]}, - Parse::RecDescent::_tracefirst($_[1]), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{reference_b}); - %item = (__RULE__ => q{reference_b}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REFERENCING/i]}, Parse::RecDescent::_tracefirst($text), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REFERENCING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [old_new_corr]}, - Parse::RecDescent::_tracefirst($text), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{old_new_corr})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_corr, 0, 2, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [old_new_corr]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{old_new_corr(0..2)}} = $_tok; - push @item, $_tok; - - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = join(' ', $item[1], join(' ', @{$item[2]}) ) }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REFERENCING/i old_new_corr]<<}, - Parse::RecDescent::_tracefirst($text), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{reference_b}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{reference_b}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{reference_b}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_simple_when_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_simple_when_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_1_of_rule_simple_when_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_1_of_rule_simple_when_clause}); - %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_simple_when_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/WHEN/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:WHEN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [search_condition]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{search_condition})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [search_condition]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{search_condition}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/THEN/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/THEN/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:THEN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause]}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{result_expression, or /NULL/i})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_1_of_rule_simple_when_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_9_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_9_of_rule_sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_9_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CORRELATION/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_9_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_9_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CORRELATION/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CORRELATION)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CORRELATION/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CORR/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_9_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_9_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CORR/]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CORR)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CORR/]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_9_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_7_of_rule_sysfun -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_7_of_rule_sysfun"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_7_of_rule_sysfun]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CEIL/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_7_of_rule_sysfun}); - %item = (__RULE__ => q{_alternation_1_of_production_7_of_rule_sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CEIL/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CEIL)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CEIL/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CEILING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_7_of_rule_sysfun}); - %item = (__RULE__ => q{_alternation_1_of_production_7_of_rule_sysfun}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CEILING/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CEILING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CEILING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_7_of_rule_sysfun}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::prevval_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"prevval_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [prevval_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/PREVVAL\\s+FOR/i sequence_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{prevval_expression}); - %item = (__RULE__ => q{prevval_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/PREVVAL\\s+FOR/i]}, Parse::RecDescent::_tracefirst($text), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:PREVVAL\s+FOR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [sequence_name]}, - Parse::RecDescent::_tracefirst($text), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sequence_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sequence_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sequence_name}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/PREVVAL\\s+FOR/i sequence_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{prevval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{prevval_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{prevval_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::where_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"where_clause"}; - - Parse::RecDescent::_trace(q{Trying rule: [where_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [WHERE search_condition]}, - Parse::RecDescent::_tracefirst($_[1]), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{where_clause}); - %item = (__RULE__ => q{where_clause}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [WHERE]}, - Parse::RecDescent::_tracefirst($text), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::WHERE($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [WHERE]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{WHERE}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying subrule: [search_condition]}, - Parse::RecDescent::_tracefirst($text), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{search_condition})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [search_condition]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{search_condition}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [WHERE search_condition]<<}, - Parse::RecDescent::_tracefirst($text), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{where_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{where_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{where_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_start -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"group_start"}; - - Parse::RecDescent::_trace(q{Trying rule: [group_start]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{group_start}); - %item = (__RULE__ => q{group_start}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [unsigned_constant /PRECEDING/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{group_start}); - %item = (__RULE__ => q{group_start}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [unsigned_constant]}, - Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [unsigned_constant]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{unsigned_constant}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/PRECEDING/i]}, Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/PRECEDING/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:PRECEDING)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [unsigned_constant /PRECEDING/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/CURRENT\\s+ROW/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[2]; - $text = $_[1]; - my $_savetext; - @item = (q{group_start}); - %item = (__RULE__ => q{group_start}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/CURRENT\\s+ROW/i]}, Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:CURRENT\s+ROW)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/CURRENT\\s+ROW/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{group_start}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{group_start}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{group_start}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::correlation_name -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"correlation_name"}; - - Parse::RecDescent::_trace(q{Trying rule: [correlation_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [NAME]}, - Parse::RecDescent::_tracefirst($_[1]), - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{correlation_name}); - %item = (__RULE__ => q{correlation_name}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying subrule: [NAME]}, - Parse::RecDescent::_tracefirst($text), - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [NAME]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{NAME}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [NAME]<<}, - Parse::RecDescent::_tracefirst($text), - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{correlation_name}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{correlation_name}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{correlation_name}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SQL_procedure_statement -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"SQL_procedure_statement"}; - - Parse::RecDescent::_trace(q{Trying rule: [SQL_procedure_statement]}, - Parse::RecDescent::_tracefirst($_[1]), - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/[^;]*/ /(;|\\z)/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{SQL_procedure_statement}); - %item = (__RULE__ => q{SQL_procedure_statement}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/[^;]*/]}, Parse::RecDescent::_tracefirst($text), - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:[^;]*)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying terminal: [/(;|\\z)/]}, Parse::RecDescent::_tracefirst($text), - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/(;|\\z)/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:(;|\z))//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { $return = $item[1] . $item[2] }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/[^;]*/ /(;|\\z)/]<<}, - Parse::RecDescent::_tracefirst($text), - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{SQL_procedure_statement}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{SQL_procedure_statement}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{SQL_procedure_statement}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_between -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"group_between"}; - - Parse::RecDescent::_trace(q{Trying rule: [group_between]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/BETWEEN/i group_bound1 /AND/i group_bound2]}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{group_between}); - %item = (__RULE__ => q{group_between}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/BETWEEN/i]}, Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:BETWEEN)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [group_bound1]}, - Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{group_bound1})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound1($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [group_bound1]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{group_bound1}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: [/AND/i]}, Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/AND/i})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:AND)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [group_bound2]}, - Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{group_bound2})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound2($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [group_bound2]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{group_bound2}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/BETWEEN/i group_bound1 /AND/i group_bound2]<<}, - Parse::RecDescent::_tracefirst($text), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{group_between}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{group_between}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{group_between}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::nextval_expression -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"nextval_expression"}; - - Parse::RecDescent::_trace(q{Trying rule: [nextval_expression]}, - Parse::RecDescent::_tracefirst($_[1]), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/NEXTVAL\\s+FOR/i sequence_name]}, - Parse::RecDescent::_tracefirst($_[1]), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{nextval_expression}); - %item = (__RULE__ => q{nextval_expression}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/NEXTVAL\\s+FOR/i]}, Parse::RecDescent::_tracefirst($text), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:NEXTVAL\s+FOR)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying subrule: [sequence_name]}, - Parse::RecDescent::_tracefirst($text), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sequence_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [sequence_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{sequence_name}} = $_tok; - push @item, $_tok; - - } - - - Parse::RecDescent::_trace(q{>>Matched production: [/NEXTVAL\\s+FOR/i sequence_name]<<}, - Parse::RecDescent::_tracefirst($text), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{nextval_expression}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{nextval_expression}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{nextval_expression}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::desc_option -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"desc_option"}; - - Parse::RecDescent::_trace(q{Trying rule: [desc_option]}, - Parse::RecDescent::_tracefirst($_[1]), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/DESC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{desc_option}); - %item = (__RULE__ => q{desc_option}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/DESC/i]}, Parse::RecDescent::_tracefirst($text), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:DESC)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - Parse::RecDescent::_trace(q{Trying repeated subrule: [/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, - Parse::RecDescent::_tracefirst($text), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_desc_option, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_desc_option]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_desc_option(?)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [/DESC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{desc_option}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{desc_option}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{desc_option}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"column_list"}; - - Parse::RecDescent::_trace(q{Trying rule: [column_list]}, - Parse::RecDescent::_tracefirst($_[1]), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - - - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: ['(' ')']}, - Parse::RecDescent::_tracefirst($_[1]), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{column_list}); - %item = (__RULE__ => q{column_list}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: ['(']}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\(//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; - - - Parse::RecDescent::_trace(q{Trying operator: []}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); - - $_tok = undef; - OPLOOP: while (1) - { - $repcount = 0; - my @item; - - # MATCH LEFTARG - - Parse::RecDescent::_trace(q{Trying subrule: [column_name]}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{column_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_name}} = $_tok; - push @item, $_tok; - - } - - - $repcount++; - - my $savetext = $text; - my $backtrack; - - # MATCH (OP RIGHTARG)(s) - while ($repcount < 100000000) - { - $backtrack = 0; - - Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/,/})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - pop @item; - if (defined $1) {push @item, $item{'column_name(s)'}=$1; $backtrack=1;} - - Parse::RecDescent::_trace(q{Trying subrule: [column_name]}, Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{column_name})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [column_name]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{column_name}} = $_tok; - push @item, $_tok; - - } + q{ranking_function}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{window_order_clause}} = $_tok; + push @item, $_tok; - $savetext = $text; - $repcount++; } - $text = $savetext; - pop @item if $backtrack; - - unless (@item) { undef $_tok; last } - $_tok = [ @item ]; - last; - } - - unless ($repcount>=1) - { - Parse::RecDescent::_trace(q{<]>>}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched operator: []<< (return value: [} - . qq{@{$_tok||[]}} . q{]}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - - push @item, $item{'column_name(s)'}=$_tok||[]; - - - Parse::RecDescent::_trace(q{Trying terminal: [')']}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{')'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\)//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING2__}=$&; - - - Parse::RecDescent::_trace(q{Trying action}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - - - $_tok = ($_noactions) ? 0 : do { - $return = join(' ', '(', @{$item[2]}, ')'); -}; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; - - - - Parse::RecDescent::_trace(q{>>Matched production: ['(' ')']<<}, - Parse::RecDescent::_tracefirst($text), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{column_list}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{column_list}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{column_list}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_63_of_rule_sysibm_function -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_63_of_rule_sysibm_function"}; - - Parse::RecDescent::_trace(q{Trying rule: [_alternation_1_of_production_63_of_rule_sysibm_function]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - my $err_at = @{$thisparser->{errors}}; - - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); - - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REGR_INTERCEPT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_63_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_63_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_INTERCEPT/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_INTERCEPT)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_INTERCEPT/i]<<}, + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/RANK/, or /DENSE_RANK|DENSERANK/i /OVER/i '(' window_partition_clause window_order_clause ')']<<}, + Parse::RecDescent::_tracefirst($text), q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{ranking_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{ranking_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{ranking_function}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{ranking_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"} + {"_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/SELECTIVITY/i numeric_constant]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}); + %item = (__RULE__ => + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/SELECTIVITY/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:SELECTIVITY)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [numeric_constant]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{numeric_constant})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::numeric_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [/REGR_ICPT/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[1]; - $text = $_[1]; - my $_savetext; - @item = (q{_alternation_1_of_production_63_of_rule_sysibm_function}); - %item = (__RULE__ => q{_alternation_1_of_production_63_of_rule_sysibm_function}); - my $repcount = 0; - - - Parse::RecDescent::_trace(q{Trying terminal: [/REGR_ICPT/i]}, Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [numeric_constant]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{numeric_constant}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:REGR_ICPT)//i) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + Parse::RecDescent::_trace( + q{>>Matched production: [/SELECTIVITY/i numeric_constant]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , + q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition}, + $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_sysibm_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ABS/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/ABS/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ABS)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/ABS/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - - - - Parse::RecDescent::_trace(q{>>Matched production: [/REGR_ICPT/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - unless ( $_matched || defined($return) || defined($score) ) - { - - - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{_alternation_1_of_production_63_of_rule_sysibm_function}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::dereference_operation -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"dereference_operation"}; - - Parse::RecDescent::_trace(q{Trying rule: [dereference_operation]}, - Parse::RecDescent::_tracefirst($_[1]), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/ABSVAL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_sysibm_function}); + my $repcount = 0; - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_trace( + q{Trying terminal: [/ABSVAL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ABSVAL)//i) { - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; - - - - while (!$_matched && !$commit) - { - - Parse::RecDescent::_trace(q{Trying production: [scoped_reference_expression '->' name1 '(']}, - Parse::RecDescent::_tracefirst($_[1]), - q{dereference_operation}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{dereference_operation}); - %item = (__RULE__ => q{dereference_operation}); - my $repcount = 0; - - Parse::RecDescent::_trace(q{Trying subrule: [scoped_reference_expression]}, + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ABSVAL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::reference_b { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"reference_b"}; + + Parse::RecDescent::_trace( + q{Trying rule: [reference_b]}, + Parse::RecDescent::_tracefirst($_[1]), + q{reference_b}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/REFERENCING/i old_new_corr]}, + Parse::RecDescent::_tracefirst($_[1]), + q{reference_b}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{reference_b}); + %item = (__RULE__ => q{reference_b}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/REFERENCING/i]}, + Parse::RecDescent::_tracefirst($text), + q{reference_b}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REFERENCING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [old_new_corr]}, + Parse::RecDescent::_tracefirst($text), + q{reference_b}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{old_new_corr})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::old_new_corr, + 0, 2, $_noactions, $expectation, undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scoped_reference_expression($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [scoped_reference_expression]<< (return value: [} - . $_tok . q{]}, - - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{scoped_reference_expression}} = $_tok; - push @item, $_tok; - - } - - Parse::RecDescent::_trace(q{Trying terminal: ['->']}, - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{'->'})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A\-\>//) - { - - $expectation->failed(); - Parse::RecDescent::_trace(qq{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__STRING1__}=$&; + q{reference_b}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [old_new_corr]<< (} . @$_tok . q{ times)}, + Parse::RecDescent::_tracefirst($text), + q{reference_b}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{old_new_corr(0..2)}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying subrule: [name1]}, - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{reference_b}, $tracelevel) if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{name1})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::name1($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { - - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [name1]<< (return value: [} - . $_tok . q{]}, - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) + $_tok + = ($_noactions) + ? 0 + : do { $return = join(' ', $item[1], join(' ', @{ $item[2] })) }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $item{q{name1}} = $_tok; - push @item, $_tok; - - } + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/REFERENCING/i old_new_corr]<<}, + Parse::RecDescent::_tracefirst($text), + q{reference_b}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{reference_b}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{reference_b}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{reference_b}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{reference_b}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_simple_when_clause + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_1_of_rule_simple_when_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_1_of_rule_simple_when_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_1_of_rule_simple_when_clause}); + %item = (__RULE__ => q{_alternation_1_of_production_1_of_rule_simple_when_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/WHEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:WHEN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [search_condition]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{search_condition})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [search_condition]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying repeated subrule: ['(']}, Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{'('})->at($text); - - unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_dereference_operation, 0, 1, $_noactions,$expectation,undef))) - { - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_dereference_operation]<< (} - . @$_tok . q{ times)}, - - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_dereference_operation(?)}} = $_tok; - push @item, $_tok; - - - - - Parse::RecDescent::_trace(q{>>Matched production: [scoped_reference_expression '->' name1 '(']<<}, - Parse::RecDescent::_tracefirst($text), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{search_condition}} = $_tok; + push @item, $_tok; + } - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/THEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/THEN/i})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:THEN)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{dereference_operation}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{dereference_operation}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{dereference_operation}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{dereference_operation}, - $tracelevel) - } - $_[1] = $text; - return $return; -} - -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::OUTER -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"OUTER"}; - - Parse::RecDescent::_trace(q{Trying rule: [OUTER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{OUTER}, - $tracelevel) - if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{result_expression, or /NULL/i})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause]<< (return value: [} + . $_tok . q{]}, - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause}} + = $_tok; + push @item, $_tok; - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_trace( + q{>>Matched production: [/WHEN/i search_condition /THEN/i result_expression, or /NULL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_1_of_rule_simple_when_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_9_of_rule_sysibm_function { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_9_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_9_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CORRELATION/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_9_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_9_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/CORRELATION/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CORRELATION)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/CORRELATION/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + while (!$_matched && !$commit) { - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying production: [/CORR/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_9_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_9_of_rule_sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{Trying production: [/outer/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{OUTER}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{OUTER}); - %item = (__RULE__ => q{OUTER}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{Trying terminal: [/CORR/]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CORR)//) { - Parse::RecDescent::_trace(q{Trying terminal: [/outer/i]}, Parse::RecDescent::_tracefirst($text), - q{OUTER}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:outer)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/CORR/]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_9_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_7_of_rule_sysfun { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_7_of_rule_sysfun"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_7_of_rule_sysfun]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/CEIL/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_7_of_rule_sysfun}); + %item = (__RULE__ => q{_alternation_1_of_production_7_of_rule_sysfun}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/CEIL/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CEIL)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/CEIL/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; - + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{>>Matched production: [/outer/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{OUTER}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - + Parse::RecDescent::_trace( + q{Trying production: [/CEILING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_7_of_rule_sysfun}); + %item = (__RULE__ => q{_alternation_1_of_production_7_of_rule_sysfun}); + my $repcount = 0; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/CEILING/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CEILING)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{OUTER}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{OUTER}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{OUTER}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{OUTER}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_order_clause -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"window_order_clause"}; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/CEILING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_7_of_rule_sysfun}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::prevval_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"prevval_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [prevval_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{prevval_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/PREVVAL\\s+FOR/i sequence_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{prevval_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{prevval_expression}); + %item = (__RULE__ => q{prevval_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/PREVVAL\\s+FOR/i]}, + Parse::RecDescent::_tracefirst($text), + q{prevval_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:PREVVAL\s+FOR)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [sequence_name]}, + Parse::RecDescent::_tracefirst($text), + q{prevval_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{sequence_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{prevval_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [sequence_name]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying rule: [window_order_clause]}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{prevval_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{sequence_name}} = $_tok; + push @item, $_tok; + } - my $err_at = @{$thisparser->{errors}}; + Parse::RecDescent::_trace( + q{>>Matched production: [/PREVVAL\\s+FOR/i sequence_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{prevval_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{prevval_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{prevval_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{prevval_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{prevval_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::where_clause { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"where_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [where_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [WHERE search_condition]}, + Parse::RecDescent::_tracefirst($_[1]), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{where_clause}); + %item = (__RULE__ => q{where_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [WHERE]}, + Parse::RecDescent::_tracefirst($text), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::WHERE( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [WHERE]<< (return value: [} . $_tok . q{]}, - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_tracefirst($text), + q{where_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{WHERE}} = $_tok; + push @item, $_tok; - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + } + Parse::RecDescent::_trace( + q{Trying subrule: [search_condition]}, + Parse::RecDescent::_tracefirst($text), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{search_condition})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::search_condition( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [search_condition]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{where_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{search_condition}} = $_tok; + push @item, $_tok; - while (!$_matched && !$commit) - { + } - Parse::RecDescent::_trace(q{Trying production: [/ORDER\\s+BY/i ]}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{window_order_clause}); - %item = (__RULE__ => q{window_order_clause}); - my $repcount = 0; + Parse::RecDescent::_trace( + q{>>Matched production: [WHERE search_condition]<<}, + Parse::RecDescent::_tracefirst($text), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{where_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{where_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{where_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{where_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_start { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"group_start"}; + + Parse::RecDescent::_trace( + q{Trying rule: [group_start]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{group_start}); + %item = (__RULE__ => q{group_start}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/UNBOUNDED\\s+PRECEDING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:UNBOUNDED\s+PRECEDING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/UNBOUNDED\\s+PRECEDING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [unsigned_constant /PRECEDING/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{group_start}); + %item = (__RULE__ => q{group_start}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [unsigned_constant]}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::unsigned_constant( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [unsigned_constant]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{unsigned_constant}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{Trying terminal: [/ORDER\\s+BY/i]}, Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + } + Parse::RecDescent::_trace( + q{Trying terminal: [/PRECEDING/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/PRECEDING/i})->at($text); - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:ORDER\s+BY)//i) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:PRECEDING)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [unsigned_constant /PRECEDING/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { - Parse::RecDescent::_trace(q{Trying operator: []}, - Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying production: [/CURRENT\\s+ROW/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[2]; + $text = $_[1]; + my $_savetext; + @item = (q{group_start}); + %item = (__RULE__ => q{group_start}); + my $repcount = 0; - $_tok = undef; - OPLOOP: while (1) - { - $repcount = 0; - my @item; + Parse::RecDescent::_trace( + q{Trying terminal: [/CURRENT\\s+ROW/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:CURRENT\s+ROW)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - # MATCH LEFTARG + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/CURRENT\\s+ROW/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_start}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{group_start}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{group_start}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{group_start}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::correlation_name { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"correlation_name"}; + + Parse::RecDescent::_trace( + q{Trying rule: [correlation_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{correlation_name}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [NAME]}, + Parse::RecDescent::_tracefirst($_[1]), + q{correlation_name}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{correlation_name}); + %item = (__RULE__ => q{correlation_name}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [NAME]}, + Parse::RecDescent::_tracefirst($text), + q{correlation_name}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::NAME( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{correlation_name}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [NAME]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]}, Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sort_key_expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_order_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{correlation_name}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{NAME}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_window_order_clause}} = $_tok; - push @item, $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [NAME]<<}, + Parse::RecDescent::_tracefirst($text), + q{correlation_name}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{correlation_name}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{correlation_name}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{correlation_name}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{correlation_name}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::SQL_procedure_statement { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"SQL_procedure_statement"}; + + Parse::RecDescent::_trace( + q{Trying rule: [SQL_procedure_statement]}, + Parse::RecDescent::_tracefirst($_[1]), + q{SQL_procedure_statement}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/[^;]*/ /(;|\\z)/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{SQL_procedure_statement}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{SQL_procedure_statement}); + %item = (__RULE__ => q{SQL_procedure_statement}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/[^;]*/]}, + Parse::RecDescent::_tracefirst($text), + q{SQL_procedure_statement}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:[^;]*)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - } + Parse::RecDescent::_trace( + q{Trying terminal: [/(;|\\z)/]}, + Parse::RecDescent::_tracefirst($text), + q{SQL_procedure_statement}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/(;|\\z)/})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:(;|\z))//) { - $repcount++; + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - my $savetext = $text; - my $backtrack; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; - # MATCH (OP RIGHTARG)(s) - while ($repcount < 100000000) - { - $backtrack = 0; + Parse::RecDescent::_trace( + q{Trying action}, + Parse::RecDescent::_tracefirst($text), + q{SQL_procedure_statement}, $tracelevel + ) if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { $return = $item[1] . $item[2] }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{/,/})->at($text); + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/[^;]*/ /(;|\\z)/]<<}, + Parse::RecDescent::_tracefirst($text), + q{SQL_procedure_statement}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{SQL_procedure_statement}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{SQL_procedure_statement}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{SQL_procedure_statement}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{SQL_procedure_statement}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_between { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"group_between"}; + + Parse::RecDescent::_trace( + q{Trying rule: [group_between]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/BETWEEN/i group_bound1 /AND/i group_bound2]}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{group_between}); + %item = (__RULE__ => q{group_between}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/BETWEEN/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:BETWEEN)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [group_bound1]}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{group_bound1})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound1( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [group_bound1]<< (return value: [} . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{group_bound1}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:,)//) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying terminal: [/AND/i]}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/AND/i})->at($text); - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN2__}=$&; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:AND)//i) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - pop @item; - if (defined $1) {push @item, $item{'_alternation_1_of_production_1_of_rule_window_order_clause(s)'}=$1; $backtrack=1;} + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [group_bound2]}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{group_bound2})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::group_bound2( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [group_bound2]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]}, Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - if (1) { no strict qw{refs}; - $expectation->is(q{sort_key_expression})->at($text); - unless (defined ($_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_order_clause($thisparser,$text,$repeating,$_noactions,sub { \@arg }))) - { + q{group_between}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{group_bound2}} = $_tok; + push @item, $_tok; - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]<< (return value: [} - . $_tok . q{]}, + } - Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $item{q{_alternation_1_of_production_1_of_rule_window_order_clause}} = $_tok; - push @item, $_tok; + Parse::RecDescent::_trace( + q{>>Matched production: [/BETWEEN/i group_bound1 /AND/i group_bound2]<<}, + Parse::RecDescent::_tracefirst($text), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{group_between}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{group_between}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{group_between}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{group_between}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::nextval_expression { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"nextval_expression"}; + + Parse::RecDescent::_trace( + q{Trying rule: [nextval_expression]}, + Parse::RecDescent::_tracefirst($_[1]), + q{nextval_expression}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/NEXTVAL\\s+FOR/i sequence_name]}, + Parse::RecDescent::_tracefirst($_[1]), + q{nextval_expression}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{nextval_expression}); + %item = (__RULE__ => q{nextval_expression}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/NEXTVAL\\s+FOR/i]}, + Parse::RecDescent::_tracefirst($text), + q{nextval_expression}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:NEXTVAL\s+FOR)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [sequence_name]}, + Parse::RecDescent::_tracefirst($text), + q{nextval_expression}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{sequence_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::sequence_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{nextval_expression}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [sequence_name]<< (return value: [} . $_tok . q{]}, - } + Parse::RecDescent::_tracefirst($text), + q{nextval_expression}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{sequence_name}} = $_tok; + push @item, $_tok; - $savetext = $text; - $repcount++; } - $text = $savetext; - pop @item if $backtrack; - unless (@item) { undef $_tok; last } - $_tok = [ @item ]; - last; - } + Parse::RecDescent::_trace( + q{>>Matched production: [/NEXTVAL\\s+FOR/i sequence_name]<<}, + Parse::RecDescent::_tracefirst($text), + q{nextval_expression}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{nextval_expression}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{nextval_expression}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{nextval_expression}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{nextval_expression}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::desc_option { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"desc_option"}; + + Parse::RecDescent::_trace( + q{Trying rule: [desc_option]}, + Parse::RecDescent::_tracefirst($_[1]), + q{desc_option}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/DESC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{desc_option}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{desc_option}); + %item = (__RULE__ => q{desc_option}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/DESC/i]}, + Parse::RecDescent::_tracefirst($text), + q{desc_option}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:DESC)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{Trying repeated subrule: [/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]}, + Parse::RecDescent::_tracefirst($text), + q{desc_option}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{/NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i}) + ->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_desc_option, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{desc_option}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_desc_option]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{desc_option}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_desc_option(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [/DESC/i /NULLS\\s+FIRST/i, or /NULLS\\s+LAST/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{desc_option}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{desc_option}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{desc_option}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{desc_option}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{desc_option}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_list { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"column_list"}; + + Parse::RecDescent::_trace( + q{Trying rule: [column_list]}, + Parse::RecDescent::_tracefirst($_[1]), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: ['(' ')']}, + Parse::RecDescent::_tracefirst($_[1]), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{column_list}); + %item = (__RULE__ => q{column_list}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\(//) { + + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; - unless ($repcount>=1) - { - Parse::RecDescent::_trace(q{<]>>}, - Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $expectation->failed(); - last; - } - Parse::RecDescent::_trace(q{>>Matched operator: []<< (return value: [} - . qq{@{$_tok||[]}} . q{]}, - Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_trace( + q{Trying operator: []}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{}) + ->at($text); - push @item, $item{'_alternation_1_of_production_1_of_rule_window_order_clause(s)'}=$_tok||[]; + $_tok = undef; + OPLOOP: while (1) { + $repcount = 0; + my @item; + # MATCH LEFTARG + Parse::RecDescent::_trace( + q{Trying subrule: [column_name]}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{column_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_name]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{>>Matched production: [/ORDER\\s+BY/i ]<<}, Parse::RecDescent::_tracefirst($text), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } + q{column_list}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_name}} = $_tok; + push @item, $_tok; + } - unless ( $_matched || defined($return) || defined($score) ) - { + $repcount++; + my $savetext = $text; + my $backtrack; - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{window_order_clause}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{window_order_clause}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{window_order_clause}, - $tracelevel) - } - $_[1] = $text; - return $return; -} + # MATCH (OP RIGHTARG)(s) + while ($repcount < 100000000) { + $backtrack = 0; -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::TRIGGER -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"TRIGGER"}; + Parse::RecDescent::_trace( + q{Trying terminal: [/,/]}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/,/})->at($text); - Parse::RecDescent::_trace(q{Trying rule: [TRIGGER]}, - Parse::RecDescent::_tracefirst($_[1]), - q{TRIGGER}, - $tracelevel) - if defined $::RD_TRACE; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:,)//) { + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; - my $err_at = @{$thisparser->{errors}}; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + pop @item; + if (defined $1) { + push @item, $item{'column_name(s)'} = $1; + $backtrack = 1; + } + + Parse::RecDescent::_trace( + q{Trying subrule: [column_name]}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{column_name})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::column_name( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [column_name]<< (return value: [} . $_tok . q{]}, - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + Parse::RecDescent::_tracefirst($text), + q{column_list}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{column_name}} = $_tok; + push @item, $_tok; + + } + + $savetext = $text; + $repcount++; + } + $text = $savetext; + pop @item if $backtrack; + + unless (@item) { undef $_tok; last } + $_tok = [@item]; + last; + } - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + unless ($repcount >= 1) { + Parse::RecDescent::_trace( + q{<]>>}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched operator: []<< (return value: [} . qq{@{$_tok||[]}} . q{]}, + Parse::RecDescent::_tracefirst($text), q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + push @item, $item{'column_name(s)'} = $_tok || []; + Parse::RecDescent::_trace( + q{Trying terminal: [')']}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{')'})->at($text); - while (!$_matched && !$commit) - { + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\)//) { - Parse::RecDescent::_trace(q{Trying production: [/trigger/i]}, - Parse::RecDescent::_tracefirst($_[1]), - q{TRIGGER}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{TRIGGER}); - %item = (__RULE__ => q{TRIGGER}); - my $repcount = 0; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING2__} = $&; + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{column_list}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{Trying terminal: [/trigger/i]}, Parse::RecDescent::_tracefirst($text), - q{TRIGGER}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { + $return = join(' ', '(', @{ $item[2] }, ')'); + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); - - - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:trigger)//i) - { - - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: ['(' ')']<<}, + Parse::RecDescent::_tracefirst($text), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{column_list}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{column_list}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{column_list}, + $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{column_list}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_63_of_rule_sysibm_function + { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"_alternation_1_of_production_63_of_rule_sysibm_function"}; + + Parse::RecDescent::_trace( + q{Trying rule: [_alternation_1_of_production_63_of_rule_sysibm_function]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/REGR_INTERCEPT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_63_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_63_of_rule_sysibm_function}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_INTERCEPT/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_INTERCEPT)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_INTERCEPT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; last; } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + while (!$_matched && !$commit) { + Parse::RecDescent::_trace( + q{Trying production: [/REGR_ICPT/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[1]; + $text = $_[1]; + my $_savetext; + @item = (q{_alternation_1_of_production_63_of_rule_sysibm_function}); + %item = (__RULE__ => q{_alternation_1_of_production_63_of_rule_sysibm_function}); + my $repcount = 0; - Parse::RecDescent::_trace(q{>>Matched production: [/trigger/i]<<}, - Parse::RecDescent::_tracefirst($text), - q{TRIGGER}, - $tracelevel) - if defined $::RD_TRACE; - $_matched = 1; - last; - } - - - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{Trying terminal: [/REGR_ICPT/i]}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:REGR_ICPT)//i) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{TRIGGER}, - $tracelevel) - if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{TRIGGER}, - $tracelevel) + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{TRIGGER}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{TRIGGER}, - $tracelevel) - } - $_[1] = $text; - return $return; -} -# ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) -sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::comment -{ - my $thisparser = $_[0]; - use vars q{$tracelevel}; - local $tracelevel = ($tracelevel||0)+1; - $ERRORS = 0; - my $thisrule = $thisparser->{"rules"}{"comment"}; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/REGR_ICPT/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, + "", q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace( + q{>>Matched rule<< (return value: [} . $return . q{])}, "", + q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{_alternation_1_of_production_63_of_rule_sysibm_function}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::dereference_operation { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"dereference_operation"}; + + Parse::RecDescent::_trace( + q{Trying rule: [dereference_operation]}, + Parse::RecDescent::_tracefirst($_[1]), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [scoped_reference_expression '->' name1 '(']}, + Parse::RecDescent::_tracefirst($_[1]), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{dereference_operation}); + %item = (__RULE__ => q{dereference_operation}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying subrule: [scoped_reference_expression]}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::scoped_reference_expression( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [scoped_reference_expression]<< (return value: [} . $_tok . q{]}, - Parse::RecDescent::_trace(q{Trying rule: [comment]}, - Parse::RecDescent::_tracefirst($_[1]), - q{comment}, - $tracelevel) - if defined $::RD_TRACE; + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{scoped_reference_expression}} = $_tok; + push @item, $_tok; + + } + Parse::RecDescent::_trace( + q{Trying terminal: ['->']}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{'->'})->at($text); - my $err_at = @{$thisparser->{errors}}; + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A\-\>//) { - my $score; - my $score_return; - my $_tok; - my $return = undef; - my $_matched=0; - my $commit=0; - my @item = (); - my %item = (); - my $repeating = defined($_[2]) && $_[2]; - my $_noactions = defined($_[3]) && $_[3]; - my @arg = defined $_[4] ? @{ &{$_[4]} } : (); - my %arg = ($#arg & 01) ? @arg : (@arg, undef); - my $text; - my $lastsep=""; - my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); - $expectation->at($_[1]); + $expectation->failed(); + Parse::RecDescent::_trace(qq{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__STRING1__} = $&; + + Parse::RecDescent::_trace( + q{Trying subrule: [name1]}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{name1})->at($text); + unless (defined( + $_tok = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::name1( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [name1]<< (return value: [} . $_tok . q{]}, - my $thisline; - tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{name1}} = $_tok; + push @item, $_tok; + } + Parse::RecDescent::_trace( + q{Trying repeated subrule: ['(']}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{'('})->at($text); + + unless (defined( + $_tok = $thisparser->_parserepeat( + $text, + \&Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_dereference_operation, + 0, + 1, + $_noactions, + $expectation, + undef + ) + )) { + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + last; + } + Parse::RecDescent::_trace( + q{>>Matched repeated subrule: [_alternation_1_of_production_1_of_rule_dereference_operation]<< (} + . @$_tok + . q{ times)}, + + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_dereference_operation(?)}} = $_tok; + push @item, $_tok; + + Parse::RecDescent::_trace( + q{>>Matched production: [scoped_reference_expression '->' name1 '(']<<}, + Parse::RecDescent::_tracefirst($text), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{dereference_operation}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{dereference_operation}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{dereference_operation}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{dereference_operation}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::OUTER { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"OUTER"}; + + Parse::RecDescent::_trace(q{Trying rule: [OUTER]}, Parse::RecDescent::_tracefirst($_[1]), q{OUTER}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/outer/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{OUTER}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{OUTER}); + %item = (__RULE__ => q{OUTER}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/outer/i]}, + Parse::RecDescent::_tracefirst($text), + q{OUTER}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:outer)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/outer/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{OUTER}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($_[1]), q{OUTER}, $tracelevel) + if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{OUTER}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{OUTER}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{OUTER}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::window_order_clause { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"window_order_clause"}; + + Parse::RecDescent::_trace( + q{Trying rule: [window_order_clause]}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/ORDER\\s+BY/i ]}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{window_order_clause}); + %item = (__RULE__ => q{window_order_clause}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/ORDER\\s+BY/i]}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:ORDER\s+BY)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; - while (!$_matched && !$commit) - { + Parse::RecDescent::_trace( + q{Trying operator: []}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->is(q{}) + ->at($text); - Parse::RecDescent::_trace(q{Trying production: [/^\\s*-\{2\}.*\\n/]}, - Parse::RecDescent::_tracefirst($_[1]), - q{comment}, - $tracelevel) - if defined $::RD_TRACE; - my $thisprod = $thisrule->{"prods"}[0]; - $text = $_[1]; - my $_savetext; - @item = (q{comment}); - %item = (__RULE__ => q{comment}); - my $repcount = 0; + $_tok = undef; + OPLOOP: while (1) { + $repcount = 0; + my @item; + # MATCH LEFTARG - Parse::RecDescent::_trace(q{Trying terminal: [/^\\s*-\{2\}.*\\n/]}, Parse::RecDescent::_tracefirst($text), - q{comment}, - $tracelevel) - if defined $::RD_TRACE; - $lastsep = ""; - $expectation->is(q{})->at($text); + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{sort_key_expression})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_order_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]<< (return value: [} + . $_tok . q{]}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_window_order_clause}} = $_tok; + push @item, $_tok; - unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ s/\A(?:^\s*-{2}.*\n)//) - { + } - $expectation->failed(); - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; + $repcount++; - last; - } - Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} - . $& . q{])}, - Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $item{__PATTERN1__}=$&; + my $savetext = $text; + my $backtrack; + # MATCH (OP RIGHTARG)(s) + while ($repcount < 100000000) { + $backtrack = 0; - Parse::RecDescent::_trace(q{Trying action}, + Parse::RecDescent::_trace( + q{Trying terminal: [/,/]}, Parse::RecDescent::_tracefirst($text), - q{comment}, - $tracelevel) - if defined $::RD_TRACE; + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{/,/})->at($text); + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:,)//) { - $_tok = ($_noactions) ? 0 : do { - my $comment = $item[1]; - $comment =~ s/^\s*(-{2})\s*//; - $comment =~ s/\s*$//; - $return = $comment; - }; - unless (defined $_tok) - { - Parse::RecDescent::_trace(q{<> (return value: [undef])}) - if defined $::RD_TRACE; - last; - } - Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} - . $_tok . q{])}, + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, Parse::RecDescent::_tracefirst($text)) - if defined $::RD_TRACE; - push @item, $_tok; - $item{__ACTION1__}=$_tok; + if defined $::RD_TRACE; + push @item, $item{__PATTERN2__} = $&; + + pop @item; + if (defined $1) { + push @item, $item{'_alternation_1_of_production_1_of_rule_window_order_clause(s)'} = $1; + $backtrack = 1; + } + + Parse::RecDescent::_trace( + q{Trying subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + if (1) { + no strict qw{refs}; + $expectation->is(q{sort_key_expression})->at($text); + unless (defined( + $_tok + = Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::_alternation_1_of_production_1_of_rule_window_order_clause( + $thisparser, $text, $repeating, $_noactions, sub { \@arg } + ) + )) { + + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched subrule: [_alternation_1_of_production_1_of_rule_window_order_clause]<< (return value: [} + . $_tok . q{]}, + + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, + $tracelevel + ) if defined $::RD_TRACE; + $item{q{_alternation_1_of_production_1_of_rule_window_order_clause}} = $_tok; + push @item, $_tok; + + } + + $savetext = $text; + $repcount++; + } + $text = $savetext; + pop @item if $backtrack; + + unless (@item) { undef $_tok; last } + $_tok = [@item]; + last; + } + unless ($repcount >= 1) { + Parse::RecDescent::_trace( + q{<]>>}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $expectation->failed(); + last; + } + Parse::RecDescent::_trace( + q{>>Matched operator: []<< (return value: [} + . qq{@{$_tok||[]}} . q{]}, + Parse::RecDescent::_tracefirst($text), q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + + push @item, $item{'_alternation_1_of_production_1_of_rule_window_order_clause(s)'} = $_tok || []; + + Parse::RecDescent::_trace( + q{>>Matched production: [/ORDER\\s+BY/i ]<<}, + Parse::RecDescent::_tracefirst($text), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{window_order_clause}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{window_order_clause}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, + "", q{window_order_clause}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{window_order_clause}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::TRIGGER { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"TRIGGER"}; + + Parse::RecDescent::_trace(q{Trying rule: [TRIGGER]}, Parse::RecDescent::_tracefirst($_[1]), q{TRIGGER}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/trigger/i]}, + Parse::RecDescent::_tracefirst($_[1]), + q{TRIGGER}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{TRIGGER}); + %item = (__RULE__ => q{TRIGGER}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/trigger/i]}, + Parse::RecDescent::_tracefirst($text), + q{TRIGGER}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:trigger)//i) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + + Parse::RecDescent::_trace( + q{>>Matched production: [/trigger/i]<<}, + Parse::RecDescent::_tracefirst($text), + q{TRIGGER}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + + unless ($_matched || defined($return) || defined($score)) { + + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{TRIGGER}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{TRIGGER}, $tracelevel) + if defined $::RD_TRACE; + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{TRIGGER}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{TRIGGER}, $tracelevel + ); + } + $_[1] = $text; + return $return; + } + + # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args) + sub Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar::comment { + my $thisparser = $_[0]; + use vars q{$tracelevel}; + local $tracelevel = ($tracelevel || 0) + 1; + $ERRORS = 0; + my $thisrule = $thisparser->{"rules"}{"comment"}; + + Parse::RecDescent::_trace(q{Trying rule: [comment]}, Parse::RecDescent::_tracefirst($_[1]), q{comment}, $tracelevel) + if defined $::RD_TRACE; + + my $err_at = @{ $thisparser->{errors} }; + + my $score; + my $score_return; + my $_tok; + my $return = undef; + my $_matched = 0; + my $commit = 0; + my @item = (); + my %item = (); + my $repeating = defined($_[2]) && $_[2]; + my $_noactions = defined($_[3]) && $_[3]; + my @arg = defined $_[4] ? @{ &{ $_[4] } } : (); + my %arg = ($#arg & 01) ? @arg : (@arg, undef); + my $text; + my $lastsep = ""; + my $expectation = new Parse::RecDescent::Expectation($thisrule->expected()); + $expectation->at($_[1]); + + my $thisline; + tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser; + + while (!$_matched && !$commit) { + + Parse::RecDescent::_trace( + q{Trying production: [/^\\s*-\{2\}.*\\n/]}, + Parse::RecDescent::_tracefirst($_[1]), + q{comment}, $tracelevel + ) if defined $::RD_TRACE; + my $thisprod = $thisrule->{"prods"}[0]; + $text = $_[1]; + my $_savetext; + @item = (q{comment}); + %item = (__RULE__ => q{comment}); + my $repcount = 0; + + Parse::RecDescent::_trace( + q{Trying terminal: [/^\\s*-\{2\}.*\\n/]}, + Parse::RecDescent::_tracefirst($text), + q{comment}, $tracelevel + ) if defined $::RD_TRACE; + $lastsep = ""; + $expectation->is(q{})->at($text); + + unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e + and $text =~ s/\A(?:^\s*-{2}.*\n)//) { + + $expectation->failed(); + Parse::RecDescent::_trace(q{<>}, Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + + last; + } + Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [} . $& . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $item{__PATTERN1__} = $&; + Parse::RecDescent::_trace(q{Trying action}, Parse::RecDescent::_tracefirst($text), q{comment}, $tracelevel) + if defined $::RD_TRACE; - Parse::RecDescent::_trace(q{>>Matched production: [/^\\s*-\{2\}.*\\n/]<<}, - Parse::RecDescent::_tracefirst($text), - q{comment}, - $tracelevel) + $_tok = ($_noactions) ? 0 : do { + my $comment = $item[1]; + $comment =~ s/^\s*(-{2})\s*//; + $comment =~ s/\s*$//; + $return = $comment; + }; + unless (defined $_tok) { + Parse::RecDescent::_trace(q{<> (return value: [undef])}) if defined $::RD_TRACE; - $_matched = 1; - last; - } - + last; + } + Parse::RecDescent::_trace(q{>>Matched action<< (return value: [} . $_tok . q{])}, + Parse::RecDescent::_tracefirst($text)) + if defined $::RD_TRACE; + push @item, $_tok; + $item{__ACTION1__} = $_tok; - unless ( $_matched || defined($return) || defined($score) ) - { + Parse::RecDescent::_trace( + q{>>Matched production: [/^\\s*-\{2\}.*\\n/]<<}, + Parse::RecDescent::_tracefirst($text), + q{comment}, $tracelevel + ) if defined $::RD_TRACE; + $_matched = 1; + last; + } + unless ($_matched || defined($return) || defined($score)) { - $_[1] = $text; # NOT SURE THIS IS NEEDED - Parse::RecDescent::_trace(q{<>}, - Parse::RecDescent::_tracefirst($_[1]), - q{comment}, - $tracelevel) + $_[1] = $text; # NOT SURE THIS IS NEEDED + Parse::RecDescent::_trace( + q{<>}, + Parse::RecDescent::_tracefirst($_[1]), + q{comment}, $tracelevel + ) if defined $::RD_TRACE; + return undef; + } + if (!defined($return) && defined($score)) { + Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", q{comment}, $tracelevel) if defined $::RD_TRACE; - return undef; - } - if (!defined($return) && defined($score)) - { - Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "", - q{comment}, - $tracelevel) - if defined $::RD_TRACE; - $return = $score_return; - } - splice @{$thisparser->{errors}}, $err_at; - $return = $item[$#item] unless defined $return; - if (defined $::RD_TRACE) - { - Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . - $return . q{])}, "", - q{comment}, - $tracelevel); - Parse::RecDescent::_trace(q{(consumed: [} . - Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])}, - Parse::RecDescent::_tracefirst($text), - , q{comment}, - $tracelevel) + $return = $score_return; + } + splice @{ $thisparser->{errors} }, $err_at; + $return = $item[$#item] unless defined $return; + if (defined $::RD_TRACE) { + Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} . $return . q{])}, "", q{comment}, $tracelevel); + Parse::RecDescent::_trace( + q{(consumed: [} . Parse::RecDescent::_tracemax(substr($_[1], 0, -length($text))) . q{])}, + Parse::RecDescent::_tracefirst($text), + , q{comment}, $tracelevel + ); + } + $_[1] = $text; + return $return; } - $_[1] = $text; - return $return; } -} -package SQL::Translator::Parser::DB2::Grammar; sub new { my $self = bless( { - '_AUTOTREE' => undef, - 'localvars' => '', - 'startcode' => '', - '_check' => { - 'thisoffset' => '', - 'itempos' => '', - 'prevoffset' => '', - 'prevline' => '', - 'prevcolumn' => '', - 'thiscolumn' => '' - }, - 'namespace' => 'Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar', - '_AUTOACTION' => undef, - 'rules' => { - '_alternation_1_of_production_17_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DECIMAL', - 'hashname' => '__PATTERN1__', - 'description' => '/DECIMAL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DEC', - 'hashname' => '__PATTERN1__', - 'description' => '/DEC/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_17_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'triggered_action' => bless( { - 'impcount' => 0, - 'calls' => [ - 'when_clause', - 'SQL_procedure_statement' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'when_clause', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 263 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'SQL_procedure_statement', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 263 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 264, - 'code' => '{ $return = { \'condition\' => $item[1][0], + +package SQL::Translator::Parser::DB2::Grammar; + +sub new { + my $self = bless( + { + '_AUTOTREE' => undef, + 'localvars' => '', + 'startcode' => '', + '_check' => { + 'thisoffset' => '', + 'itempos' => '', + 'prevoffset' => '', + 'prevline' => '', + 'prevcolumn' => '', + 'thiscolumn' => '' + }, + 'namespace' => 'Parse::RecDescent::SQL::Translator::Parser::DB2::Grammar', + '_AUTOACTION' => undef, + 'rules' => { + '_alternation_1_of_production_17_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DECIMAL', + 'hashname' => '__PATTERN1__', + 'description' => '/DECIMAL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DEC', + 'hashname' => '__PATTERN1__', + 'description' => '/DEC/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_17_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'triggered_action' => bless( + { + 'impcount' => 0, + 'calls' => [ 'when_clause', 'SQL_procedure_statement' ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'when_clause', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 263 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => 'SQL_procedure_statement', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 263 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 264, + 'code' => '{ $return = { \'condition\' => $item[1][0], \'statement\' => $item{\'SQL_procedure_statement\'} }; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'triggered_action', - 'vars' => '', - 'line' => 263 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_2_of_rule_search_condition' => bless( { - 'impcount' => 0, - 'calls' => [ - 'predicate', - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition', - 'search_condition' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'predicate', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition', - 'expected' => '/SELECTIVITY/i', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'search_condition', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_2_of_rule_search_condition', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'name1' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 536 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'name1', - 'vars' => '', - 'line' => 536 - }, 'Parse::RecDescent::Rule' ), - '_alternation_2_of_production_1_of_rule_cond' => bless( { - 'impcount' => 0, - 'calls' => [ - 'predicate', - '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond', - 'search_condition' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'predicate', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond', - 'expected' => '/SELECTIVITY/i', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'search_condition', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_2_of_production_1_of_rule_cond', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_expression' => bless( { - 'impcount' => 2, - 'calls' => [ - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', - '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', - 'expected' => '\'+\', or \'-\'', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 611 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', - 'matchrule' => 0, - 'implicit' => 'function, or \'(\', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_expression', - 'vars' => '', - 'line' => 608 - }, 'Parse::RecDescent::Rule' ), - 'SCHEMA' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '\\w+', - 'hashname' => '__PATTERN1__', - 'description' => '/\\\\w+/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 142, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '\\w{1,128}', - 'hashname' => '__PATTERN1__', - 'description' => '/\\\\w\\{1,128\\}/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 144, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'SCHEMA', - 'vars' => '', - 'line' => 142 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_87_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'VARIANCE', - 'hashname' => '__PATTERN1__', - 'description' => '/VARIANCE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'VAR', - 'hashname' => '__PATTERN1__', - 'description' => '/VAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_87_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '+', - 'hashname' => '__STRING1__', - 'description' => '\'+\'', - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '-', - 'hashname' => '__STRING1__', - 'description' => '\'-\'', - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'get_bracketed' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 170, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'triggered_action', + 'vars' => '', + 'line' => 263 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_2_of_rule_search_condition' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'predicate', + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition', + 'search_condition' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'predicate', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition', + 'expected' => '/SELECTIVITY/i', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'search_condition', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_2_of_rule_search_condition', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'name1' => bless( + { + 'impcount' => 0, + 'calls' => ['NAME'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 536 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'name1', + 'vars' => '', + 'line' => 536 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_2_of_production_1_of_rule_cond' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'predicate', + '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond', + 'search_condition' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'predicate', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => + '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond', + 'expected' => '/SELECTIVITY/i', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'search_condition', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_2_of_production_1_of_rule_cond', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_expression' => bless( + { + 'impcount' => 2, + 'calls' => [ + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', + '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', + 'expected' => '\'+\', or \'-\'', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 611 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => + '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', + 'matchrule' => 0, + 'implicit' => + 'function, or \'(\', or constant, or column_name, or host_variable, or special_register, or labeled_duration, or case_expression, or cast_specification, or OLAP_function, or method_invocation, or subtype_treatment, or sequence_reference', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_expression', + 'vars' => '', + 'line' => 608 + }, + 'Parse::RecDescent::Rule' + ), + 'SCHEMA' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '\\w+', + 'hashname' => '__PATTERN1__', + 'description' => '/\\\\w+/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 142, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '\\w{1,128}', + 'hashname' => '__PATTERN1__', + 'description' => '/\\\\w\\{1,128\\}/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 144, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'SCHEMA', + 'vars' => '', + 'line' => 142 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_87_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'VARIANCE', + 'hashname' => '__PATTERN1__', + 'description' => '/VARIANCE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'VAR', + 'hashname' => '__PATTERN1__', + 'description' => '/VAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_87_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '+', + 'hashname' => '__STRING1__', + 'description' => '\'+\'', + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '-', + 'hashname' => '__STRING1__', + 'description' => '\'-\'', + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'get_bracketed' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 170, + 'code' => '{ extract_bracketed($text, \'(\'); }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'get_bracketed', - 'vars' => '', - 'line' => 169 - }, 'Parse::RecDescent::Rule' ), - 'labeled_duration' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ld_type', - 'ld_duration' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ld_type', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 480 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'ld_duration', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 480 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'labeled_duration', - 'vars' => '', - 'line' => 480 - }, 'Parse::RecDescent::Rule' ), - 'group_end' => bless( { - 'impcount' => 0, - 'calls' => [ - 'unsigned_constant' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UNBOUNDED\\s+PRECEDING', - 'hashname' => '__PATTERN1__', - 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 590, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'unsigned_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 591 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'FOLLOWING', - 'hashname' => '__PATTERN1__', - 'description' => '/FOLLOWING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 591, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 591 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'group_end', - 'vars' => '', - 'line' => 590 - }, 'Parse::RecDescent::Rule' ), - 'statement' => bless( { - 'impcount' => 0, - 'calls' => [ - 'comment', - 'create' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'comment', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 23 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'create', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 24 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 24 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => 0, - 'error' => 1, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'msg' => '', - 'hashname' => '__DIRECTIVE1__', - 'commitonly' => '', - 'lookahead' => 0, - 'line' => 25 - }, 'Parse::RecDescent::Error' ) - ], - 'line' => 25 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'statement', - 'vars' => '', - 'line' => 22 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause' => bless( { - 'impcount' => 0, - 'calls' => [ - 'result_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'result_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULL', - 'hashname' => '__PATTERN1__', - 'description' => '/NULL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 627, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - '_alternation_2_of_production_1_of_rule_case_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'result_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ELSE\\s+NULL', - 'hashname' => '__PATTERN1__', - 'description' => '/ELSE\\\\s+NULL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ELSE', - 'hashname' => '__PATTERN1__', - 'description' => '/ELSE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 627, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'result_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_2_of_production_1_of_rule_case_expression', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'subject_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 598 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 599, - 'code' => '{ # with static result type that is a used-defined struct type + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'get_bracketed', + 'vars' => '', + 'line' => 169 + }, + 'Parse::RecDescent::Rule' + ), + 'labeled_duration' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'ld_type', + 'ld_duration' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'ld_type', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 480 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'ld_duration', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 480 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'labeled_duration', + 'vars' => '', + 'line' => 480 + }, + 'Parse::RecDescent::Rule' + ), + 'group_end' => bless( + { + 'impcount' => 0, + 'calls' => ['unsigned_constant'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UNBOUNDED\\s+PRECEDING', + 'hashname' => '__PATTERN1__', + 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 590, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'unsigned_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 591 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'FOLLOWING', + 'hashname' => '__PATTERN1__', + 'description' => '/FOLLOWING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 591, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 591 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'group_end', + 'vars' => '', + 'line' => 590 + }, + 'Parse::RecDescent::Rule' + ), + 'statement' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'comment', + 'create' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'comment', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 23 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'create', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 24 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 24 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => 0, + 'error' => 1, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'msg' => '', + 'hashname' => '__DIRECTIVE1__', + 'commitonly' => '', + 'lookahead' => 0, + 'line' => 25 + }, + 'Parse::RecDescent::Error' + ) + ], + 'line' => 25 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'statement', + 'vars' => '', + 'line' => 22 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause' => + bless( + { + 'impcount' => 0, + 'calls' => ['result_expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'result_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULL', + 'hashname' => '__PATTERN1__', + 'description' => '/NULL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 627, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_2_of_production_1_of_rule_case_expression' => bless( + { + 'impcount' => 0, + 'calls' => ['result_expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ELSE\\s+NULL', + 'hashname' => '__PATTERN1__', + 'description' => '/ELSE\\\\s+NULL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ELSE', + 'hashname' => '__PATTERN1__', + 'description' => '/ELSE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 627, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'result_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_2_of_production_1_of_rule_case_expression', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'subject_expression' => bless( + { + 'impcount' => 0, + 'calls' => ['expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 598 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 599, + 'code' => '{ # with static result type that is a used-defined struct type }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'subject_expression', - 'vars' => '', - 'line' => 598 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_desc_option' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULLS\\s+FIRST', - 'hashname' => '__PATTERN1__', - 'description' => '/NULLS\\\\s+FIRST/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULLS\\s+LAST', - 'hashname' => '__PATTERN1__', - 'description' => '/NULLS\\\\s+LAST/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_desc_option', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'view_name' => bless( { - 'impcount' => 0, - 'calls' => [ - 'SCHEMA', - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'SCHEMA', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 129 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '.', - 'hashname' => '__STRING1__', - 'description' => '\'.\'', - 'lookahead' => 0, - 'line' => 129 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 129 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 130, - 'code' => '{ $return = { schema => $item[1], name => $item[3] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 131 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 132, - 'code' => '{ $return = { name => $item[1] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 131 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'view_name', - 'vars' => '', - 'line' => 129 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_cond' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'AND', - 'hashname' => '__PATTERN1__', - 'description' => '/AND/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'OR', - 'hashname' => '__PATTERN1__', - 'description' => '/OR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_cond', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'numbering_function' => bless( { - 'impcount' => 2, - 'calls' => [ - 'window_partition_clause', - '_alternation_1_of_production_1_of_rule_numbering_function', - '_alternation_2_of_production_1_of_rule_numbering_function' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 3, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ROW_NUMBER|ROWNUMBER', - 'hashname' => '__PATTERN1__', - 'description' => '/ROW_NUMBER|ROWNUMBER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 546, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '()', - 'hashname' => '__STRING1__', - 'description' => '\'()\'', - 'lookahead' => 0, - 'line' => 546 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'pattern' => 'OVER', - 'hashname' => '__PATTERN2__', - 'description' => '/OVER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 546, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING2__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 546 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'window_partition_clause', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 546 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_numbering_function', - 'expected' => 'window_order_clause', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 548 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => '_alternation_2_of_production_1_of_rule_numbering_function', - 'expected' => '/RANGE\\\\s+BETWEEN\\\\s+UNBOUNDED\\\\s+PRECEDING\\\\s+AND\\\\s+UNBBOUNDED\\\\s+FOLLOWING/i, or window_aggregation_group_clause', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 551 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING3__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 551 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'numbering_function', - 'vars' => '', - 'line' => 546 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ROWS', - 'hashname' => '__PATTERN1__', - 'description' => '/ROWS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RANGE', - 'hashname' => '__PATTERN1__', - 'description' => '/RANGE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 627, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'group_bound1' => bless( { - 'impcount' => 0, - 'calls' => [ - 'unsigned_constant' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UNBOUNDED\\s+PRECEDING', - 'hashname' => '__PATTERN1__', - 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 580, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'unsigned_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 581 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'PRECEDING', - 'hashname' => '__PATTERN1__', - 'description' => '/PRECEDING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 581, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 581 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'unsigned_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 582 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'FOLLOWING', - 'hashname' => '__PATTERN1__', - 'description' => '/FOLLOWING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 582, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 582 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CURRENT\\s+ROW', - 'hashname' => '__PATTERN1__', - 'description' => '/CURRENT\\\\s+ROW/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 583, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 583 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'group_bound1', - 'vars' => '', - 'line' => 580 - }, 'Parse::RecDescent::Rule' ), - 'OLAP_function' => bless( { - 'impcount' => 0, - 'calls' => [ - 'ranking_function', - 'numbering_function', - 'aggregation_function' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'ranking_function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 538 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'numbering_function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 539 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 539 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'aggregation_function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 540 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 540 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'OLAP_function', - 'vars' => '', - 'line' => 538 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_30_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DOUBLE', - 'hashname' => '__PATTERN1__', - 'description' => '/DOUBLE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DOUBLE_PRECISION', - 'hashname' => '__PATTERN1__', - 'description' => '/DOUBLE_PRECISION/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_30_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'FULL' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'full', - 'hashname' => '__PATTERN1__', - 'description' => '/full/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 113, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'FULL', - 'vars' => '', - 'line' => 113 - }, 'Parse::RecDescent::Rule' ), - '_alternation_2_of_production_1_of_rule_cast_specification' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SCOPE', - 'hashname' => '__PATTERN1__', - 'description' => '/SCOPE/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 625, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification', - 'matchrule' => 0, - 'implicit' => 'typed_table_name, or typed_view_name', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_2_of_production_1_of_rule_cast_specification', - 'vars' => '', - 'line' => 625 - }, 'Parse::RecDescent::Rule' ), - 'case_expression' => bless( { - 'impcount' => 2, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_case_expression', - '_alternation_2_of_production_1_of_rule_case_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CASE', - 'hashname' => '__PATTERN1__', - 'description' => '/CASE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 496, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_case_expression', - 'matchrule' => 0, - 'implicit' => 'searched_when_clause, or simple_when_clause', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 498 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_2_of_production_1_of_rule_case_expression', - 'expected' => '/ELSE\\\\s+NULL/i, or /ELSE/i', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 501 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => 'END', - 'hashname' => '__PATTERN2__', - 'description' => '/END/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 501, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'case_expression', - 'vars' => '', - 'line' => 496 - }, 'Parse::RecDescent::Rule' ), - 'operator' => bless( { - 'impcount' => 0, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_operator' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_operator', - 'matchrule' => 0, - 'implicit' => '/CONCAT/i, or \'||\'', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 321 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '/', - 'hashname' => '__STRING1__', - 'description' => '\'/\'', - 'lookahead' => 0, - 'line' => 321 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 321 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '*', - 'hashname' => '__STRING1__', - 'description' => '\'*\'', - 'lookahead' => 0, - 'line' => 321 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 321 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '+', - 'hashname' => '__STRING1__', - 'description' => '\'+\'', - 'lookahead' => 0, - 'line' => 321 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 321 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '-', - 'hashname' => '__STRING1__', - 'description' => '\'-\'', - 'lookahead' => 0, - 'line' => 321 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 321 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'operator', - 'vars' => '', - 'line' => 321 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_2_of_rule_type' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'INSERT', - 'hashname' => '__PATTERN1__', - 'description' => '/INSERT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DELETE', - 'hashname' => '__PATTERN1__', - 'description' => '/DELETE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UPDATE', - 'hashname' => '__PATTERN1__', - 'description' => '/UPDATE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_2_of_rule_type', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_8_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CONCAT', - 'hashname' => '__PATTERN1__', - 'description' => '/CONCAT/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '||', - 'hashname' => '__STRING1__', - 'description' => '\'||\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_8_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'sequence_reference' => bless( { - 'impcount' => 0, - 'calls' => [ - 'nextval_expression', - 'prevval_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'nextval_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 608 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'prevval_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 609 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 609 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'sequence_reference', - 'vars' => '', - 'line' => 608 - }, 'Parse::RecDescent::Rule' ), - 'sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_sysibm_function', - '_alternation_1_of_production_8_of_rule_sysibm_function', - '_alternation_1_of_production_9_of_rule_sysibm_function', - '_alternation_1_of_production_12_of_rule_sysibm_function', - '_alternation_1_of_production_17_of_rule_sysibm_function', - '_alternation_1_of_production_30_of_rule_sysibm_function', - '_alternation_1_of_production_41_of_rule_sysibm_function', - '_alternation_1_of_production_42_of_rule_sysibm_function', - '_alternation_1_of_production_63_of_rule_sysibm_function', - '_alternation_1_of_production_83_of_rule_sysibm_function', - '_alternation_1_of_production_87_of_rule_sysibm_function' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/ABS/i, or /ABSVAL/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 332 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'AVG', - 'hashname' => '__PATTERN1__', - 'description' => '/AVG/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 333, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 333 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'BIGINT', - 'hashname' => '__PATTERN1__', - 'description' => '/BIGINT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 334, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 334 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'BLOB', - 'hashname' => '__PATTERN1__', - 'description' => '/BLOB/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 335, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 335 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CHAR', - 'hashname' => '__PATTERN1__', - 'description' => '/CHAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 336, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 336 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '5', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CLOB', - 'hashname' => '__PATTERN1__', - 'description' => '/CLOB/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 337, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 337 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '6', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'COALESCE', - 'hashname' => '__PATTERN1__', - 'description' => '/COALESCE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 338, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 338 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '7', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_8_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/CONCAT/, or \'||\'', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 339 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 339 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '8', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_9_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/CORRELATION/i, or /CORR/', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 340 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 340 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '9', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'COUNT', - 'hashname' => '__PATTERN1__', - 'description' => '/COUNT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 341, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 341 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '10', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'COUNT_BIG', - 'hashname' => '__PATTERN1__', - 'description' => '/COUNT_BIG/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 342, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 342 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '11', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_12_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/COVARIANCE/i, or /COVAR/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 343 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 343 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '12', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DATE', - 'hashname' => '__PATTERN1__', - 'description' => '/DATE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 344, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 344 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '13', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DAY', - 'hashname' => '__PATTERN1__', - 'description' => '/DAY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 345, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 345 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '14', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DAYS', - 'hashname' => '__PATTERN1__', - 'description' => '/DAYS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 346, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 346 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '15', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DBCLOB', - 'hashname' => '__PATTERN1__', - 'description' => '/DBCLOB/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 347, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 347 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '16', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_17_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/DECIMAL/i, or /DEC/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 348 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 348 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '17', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DECRYPT_BIN', - 'hashname' => '__PATTERN1__', - 'description' => '/DECRYPT_BIN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 349, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 349 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '18', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DECRYPT_CHAR', - 'hashname' => '__PATTERN1__', - 'description' => '/DECRYPT_CHAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 350, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 350 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '19', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DEREF', - 'hashname' => '__PATTERN1__', - 'description' => '/DEREF/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 351, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 351 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '20', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DIGITS', - 'hashname' => '__PATTERN1__', - 'description' => '/DIGITS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 352, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 352 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '21', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLCOMMENT', - 'hashname' => '__PATTERN1__', - 'description' => '/DLCOMMENT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 353, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 353 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '22', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLLINKTYPE', - 'hashname' => '__PATTERN1__', - 'description' => '/DLLINKTYPE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 354, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 354 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '23', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLURLCOMPLETE', - 'hashname' => '__PATTERN1__', - 'description' => '/DLURLCOMPLETE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 355, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 355 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '24', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLURLPATH', - 'hashname' => '__PATTERN1__', - 'description' => '/DLURLPATH/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 356, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 356 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '25', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLURLPATHONLY', - 'hashname' => '__PATTERN1__', - 'description' => '/DLURLPATHONLY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 357, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 357 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '26', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLURLSCHEME', - 'hashname' => '__PATTERN1__', - 'description' => '/DLURLSCHEME/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 358, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 358 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '27', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLURLSERVER', - 'hashname' => '__PATTERN1__', - 'description' => '/DLURLSERVER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 359, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 359 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '28', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DLVALUE', - 'hashname' => '__PATTERN1__', - 'description' => '/DLVALUE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 360, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 360 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '29', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_30_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/DOUBLE/i, or /DOUBLE_PRECISION/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 361 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 361 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '30', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ENCRYPT', - 'hashname' => '__PATTERN1__', - 'description' => '/ENCRYPT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 362, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 362 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '31', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'EVENT_MON_STATE', - 'hashname' => '__PATTERN1__', - 'description' => '/EVENT_MON_STATE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 363, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 363 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '32', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'FLOAT', - 'hashname' => '__PATTERN1__', - 'description' => '/FLOAT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 364, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 364 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '33', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'GETHINT', - 'hashname' => '__PATTERN1__', - 'description' => '/GETHINT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 365, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 365 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '34', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'GENERATE_UNIQUE', - 'hashname' => '__PATTERN1__', - 'description' => '/GENERATE_UNIQUE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 366, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 366 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '35', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'GRAPHIC', - 'hashname' => '__PATTERN1__', - 'description' => '/GRAPHIC/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 367, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 367 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '36', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'GROUPING', - 'hashname' => '__PATTERN1__', - 'description' => '/GROUPING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 368, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 368 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '37', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'HEX', - 'hashname' => '__PATTERN1__', - 'description' => '/HEX/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 369, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 369 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '38', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'HOUR', - 'hashname' => '__PATTERN1__', - 'description' => '/HOUR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 370, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 370 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '39', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'IDENTITY_VAL_LOCAL', - 'hashname' => '__PATTERN1__', - 'description' => '/IDENTITY_VAL_LOCAL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 371, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 371 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '40', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_41_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/INTEGER/i, or /INT/', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 372 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 372 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '41', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_42_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/LCASE/i, or /LOWER/', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 373 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 373 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '42', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LENGTH', - 'hashname' => '__PATTERN1__', - 'description' => '/LENGTH/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 374, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 374 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '43', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LONG_VARCHAR', - 'hashname' => '__PATTERN1__', - 'description' => '/LONG_VARCHAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 375, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 375 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '44', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LONG_VARGRAPHIC', - 'hashname' => '__PATTERN1__', - 'description' => '/LONG_VARGRAPHIC/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 376, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 376 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '45', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LTRIM', - 'hashname' => '__PATTERN1__', - 'description' => '/LTRIM/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 377, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 377 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '46', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MAX', - 'hashname' => '__PATTERN1__', - 'description' => '/MAX/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 378, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 378 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '47', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MICROSECOND', - 'hashname' => '__PATTERN1__', - 'description' => '/MICROSECOND/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 379, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 379 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '48', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MIN', - 'hashname' => '__PATTERN1__', - 'description' => '/MIN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 380, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 380 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '49', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MINUTE', - 'hashname' => '__PATTERN1__', - 'description' => '/MINUTE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 381, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 381 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '50', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MONTH', - 'hashname' => '__PATTERN1__', - 'description' => '/MONTH/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 382, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 382 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '51', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MULTIPLY_ACT', - 'hashname' => '__PATTERN1__', - 'description' => '/MULTIPLY_ACT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 383, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 383 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '52', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NODENUMBER', - 'hashname' => '__PATTERN1__', - 'description' => '/NODENUMBER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 384, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 384 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '53', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULLIF', - 'hashname' => '__PATTERN1__', - 'description' => '/NULLIF/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 385, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 385 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '54', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'PARTITON', - 'hashname' => '__PATTERN1__', - 'description' => '/PARTITON/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 386, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 386 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '55', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'POSSTR', - 'hashname' => '__PATTERN1__', - 'description' => '/POSSTR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 387, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 387 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '56', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RAISE_ERROR', - 'hashname' => '__PATTERN1__', - 'description' => '/RAISE_ERROR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 388, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 388 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '57', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REAL', - 'hashname' => '__PATTERN1__', - 'description' => '/REAL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 389, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 389 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '58', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REC2XML', - 'hashname' => '__PATTERN1__', - 'description' => '/REC2XML/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 390, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 390 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '59', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_AVGX', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_AVGX/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 391, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 391 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '60', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_AVGY', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_AVGY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 392, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 392 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '61', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_COUNT', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_COUNT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 393, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 393 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '62', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_63_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/REGR_INTERCEPT/i, or /REGR_ICPT/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 394 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 394 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '63', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_R2', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_R2/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 395, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 395 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '64', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_SLOPE', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_SLOPE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 396, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 396 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '65', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_SXX', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_SXX/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 397, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 397 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '66', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_SXY', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_SXY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 398, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 398 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '67', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_SYY', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_SYY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 399, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 399 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '68', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RTRIM', - 'hashname' => '__PATTERN1__', - 'description' => '/RTRIM/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 400, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 400 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '69', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SECOND', - 'hashname' => '__PATTERN1__', - 'description' => '/SECOND/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 401, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 401 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '70', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SMALLINT', - 'hashname' => '__PATTERN1__', - 'description' => '/SMALLINT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 402, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 402 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '71', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'STDDEV', - 'hashname' => '__PATTERN1__', - 'description' => '/STDDEV/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 403, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 403 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '72', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SUBSTR', - 'hashname' => '__PATTERN1__', - 'description' => '/SUBSTR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 404, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 404 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '73', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SUM', - 'hashname' => '__PATTERN1__', - 'description' => '/SUM/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 405, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 405 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '74', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TABLE_NAME', - 'hashname' => '__PATTERN1__', - 'description' => '/TABLE_NAME/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 406, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 406 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '75', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TABLE_SCHEMA', - 'hashname' => '__PATTERN1__', - 'description' => '/TABLE_SCHEMA/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 407, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 407 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '76', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TIME', - 'hashname' => '__PATTERN1__', - 'description' => '/TIME/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 408, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 408 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '77', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TIMESTAMP', - 'hashname' => '__PATTERN1__', - 'description' => '/TIMESTAMP/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 409, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 409 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '78', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TRANSLATE', - 'hashname' => '__PATTERN1__', - 'description' => '/TRANSLATE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 410, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 410 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '79', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TYPE_ID', - 'hashname' => '__PATTERN1__', - 'description' => '/TYPE_ID/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 411, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 411 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '80', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TYPE_NAME', - 'hashname' => '__PATTERN1__', - 'description' => '/TYPE_NAME/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 412, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 412 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '81', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TYPE_SCHEMA', - 'hashname' => '__PATTERN1__', - 'description' => '/TYPE_SCHEMA/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 413, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 413 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '82', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_83_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/UCASE/i, or /UPPER/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 414 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 414 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '83', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'VALUE', - 'hashname' => '__PATTERN1__', - 'description' => '/VALUE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 415, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 415 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '84', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'VARCHAR', - 'hashname' => '__PATTERN1__', - 'description' => '/VARCHAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 416, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 416 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '85', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'VARGRAPHIC', - 'hashname' => '__PATTERN1__', - 'description' => '/VARGRAPHIC/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 417, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 417 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '86', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_87_of_rule_sysibm_function', - 'matchrule' => 0, - 'implicit' => '/VARIANCE/i, or /VAR/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 418 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 418 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '87', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'YEAR', - 'hashname' => '__PATTERN1__', - 'description' => '/YEAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 419, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 419 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'sysibm_function', - 'vars' => '', - 'line' => 332 - }, 'Parse::RecDescent::Rule' ), - 'window_partition_clause' => bless( { - 'impcount' => 0, - 'calls' => [ - 'partitioning_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'op' => [], - 'items' => [ - bless( { - 'pattern' => 'PARTITION\\s+BY', - 'hashname' => '__PATTERN1__', - 'description' => '/PARTITION\\\\s+BY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 553, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'expected' => '', - 'min' => 1, - 'name' => '\'partitioning_expression(s)\'', - 'max' => 100000000, - 'leftarg' => bless( { - 'subrule' => 'partitioning_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 553 - }, 'Parse::RecDescent::Subrule' ), - 'rightarg' => bless( { - 'subrule' => 'partitioning_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 553 - }, 'Parse::RecDescent::Subrule' ), - 'hashname' => '__DIRECTIVE1__', - 'type' => 'leftop', - 'op' => bless( { - 'pattern' => ',', - 'hashname' => '__PATTERN2__', - 'description' => '/,/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 553, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - }, 'Parse::RecDescent::Operator' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'window_partition_clause', - 'vars' => '', - 'line' => 553 - }, 'Parse::RecDescent::Rule' ), - 'WHERE' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'where', - 'hashname' => '__PATTERN1__', - 'description' => '/where/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 117, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'WHERE', - 'vars' => '', - 'line' => 117 - }, 'Parse::RecDescent::Rule' ), - 'CREATE' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'create', - 'hashname' => '__PATTERN1__', - 'description' => '/create/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 101, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'CREATE', - 'vars' => '', - 'line' => 101 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_sysfun' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ABS', - 'hashname' => '__PATTERN1__', - 'description' => '/ABS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ABSVAL', - 'hashname' => '__PATTERN1__', - 'description' => '/ABSVAL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_sysfun', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_function' => bless( { - 'impcount' => 0, - 'calls' => [ - 'sysibm_function', - 'sysfun_function', - 'userdefined_function' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SYSIBM\\.|', - 'hashname' => '__PATTERN1__', - 'description' => '/SYSIBM\\\\.|/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 625, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'sysibm_function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 625 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SYSFUN\\.|', - 'hashname' => '__PATTERN1__', - 'description' => '/SYSFUN\\\\.|/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'sysfun_function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 626 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'userdefined_function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_function', - 'vars' => '', - 'line' => 625 - }, 'Parse::RecDescent::Rule' ), - 'identifier' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 136 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'identifier', - 'vars' => '', - 'line' => 136 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause' => bless( { - 'impcount' => 0, - 'calls' => [ - 'asc_option', - 'desc_option' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'asc_option', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'desc_option', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'result_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 515 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'result_expression', - 'vars' => '', - 'line' => 515 - }, 'Parse::RecDescent::Rule' ), - 'scoped_reference_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 532 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 533, - 'code' => '{ # scoped, reference + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'subject_expression', + 'vars' => '', + 'line' => 598 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_desc_option' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULLS\\s+FIRST', + 'hashname' => '__PATTERN1__', + 'description' => '/NULLS\\\\s+FIRST/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULLS\\s+LAST', + 'hashname' => '__PATTERN1__', + 'description' => '/NULLS\\\\s+LAST/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_desc_option', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'view_name' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'SCHEMA', + 'NAME' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'SCHEMA', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 129 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '.', + 'hashname' => '__STRING1__', + 'description' => '\'.\'', + 'lookahead' => 0, + 'line' => 129 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 129 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 130, + 'code' => '{ $return = { schema => $item[1], name => $item[3] } }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 131 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 132, + 'code' => '{ $return = { name => $item[1] } }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => 131 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'view_name', + 'vars' => '', + 'line' => 129 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_cond' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'AND', + 'hashname' => '__PATTERN1__', + 'description' => '/AND/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'OR', + 'hashname' => '__PATTERN1__', + 'description' => '/OR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_cond', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'numbering_function' => bless( + { + 'impcount' => 2, + 'calls' => [ + 'window_partition_clause', + '_alternation_1_of_production_1_of_rule_numbering_function', + '_alternation_2_of_production_1_of_rule_numbering_function' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 3, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ROW_NUMBER|ROWNUMBER', + 'hashname' => '__PATTERN1__', + 'description' => '/ROW_NUMBER|ROWNUMBER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 546, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '()', + 'hashname' => '__STRING1__', + 'description' => '\'()\'', + 'lookahead' => 0, + 'line' => 546 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'pattern' => 'OVER', + 'hashname' => '__PATTERN2__', + 'description' => '/OVER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 546, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING2__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 546 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'window_partition_clause', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 546 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_numbering_function', + 'expected' => 'window_order_clause', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 548 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => '_alternation_2_of_production_1_of_rule_numbering_function', + 'expected' => + '/RANGE\\\\s+BETWEEN\\\\s+UNBOUNDED\\\\s+PRECEDING\\\\s+AND\\\\s+UNBBOUNDED\\\\s+FOLLOWING/i, or window_aggregation_group_clause', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 551 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING3__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 551 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'numbering_function', + 'vars' => '', + 'line' => 546 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ROWS', + 'hashname' => '__PATTERN1__', + 'description' => '/ROWS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RANGE', + 'hashname' => '__PATTERN1__', + 'description' => '/RANGE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 627, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'group_bound1' => bless( + { + 'impcount' => 0, + 'calls' => ['unsigned_constant'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UNBOUNDED\\s+PRECEDING', + 'hashname' => '__PATTERN1__', + 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 580, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'unsigned_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 581 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'PRECEDING', + 'hashname' => '__PATTERN1__', + 'description' => '/PRECEDING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 581, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 581 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'unsigned_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 582 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'FOLLOWING', + 'hashname' => '__PATTERN1__', + 'description' => '/FOLLOWING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 582, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 582 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CURRENT\\s+ROW', + 'hashname' => '__PATTERN1__', + 'description' => '/CURRENT\\\\s+ROW/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 583, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 583 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'group_bound1', + 'vars' => '', + 'line' => 580 + }, + 'Parse::RecDescent::Rule' + ), + 'OLAP_function' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'ranking_function', + 'numbering_function', + 'aggregation_function' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'ranking_function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 538 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'numbering_function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 539 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 539 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'aggregation_function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 540 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 540 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'OLAP_function', + 'vars' => '', + 'line' => 538 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_30_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DOUBLE', + 'hashname' => '__PATTERN1__', + 'description' => '/DOUBLE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DOUBLE_PRECISION', + 'hashname' => '__PATTERN1__', + 'description' => '/DOUBLE_PRECISION/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_30_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'FULL' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'full', + 'hashname' => '__PATTERN1__', + 'description' => '/full/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 113, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'FULL', + 'vars' => '', + 'line' => 113 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_2_of_production_1_of_rule_cast_specification' => bless( + { + 'impcount' => 1, + 'calls' => + ['_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SCOPE', + 'hashname' => '__PATTERN1__', + 'description' => '/SCOPE/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 625, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => + '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification', + 'matchrule' => 0, + 'implicit' => 'typed_table_name, or typed_view_name', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_2_of_production_1_of_rule_cast_specification', + 'vars' => '', + 'line' => 625 + }, + 'Parse::RecDescent::Rule' + ), + 'case_expression' => bless( + { + 'impcount' => 2, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_case_expression', + '_alternation_2_of_production_1_of_rule_case_expression' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CASE', + 'hashname' => '__PATTERN1__', + 'description' => '/CASE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 496, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_case_expression', + 'matchrule' => 0, + 'implicit' => 'searched_when_clause, or simple_when_clause', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 498 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => '_alternation_2_of_production_1_of_rule_case_expression', + 'expected' => '/ELSE\\\\s+NULL/i, or /ELSE/i', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 501 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => 'END', + 'hashname' => '__PATTERN2__', + 'description' => '/END/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 501, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'case_expression', + 'vars' => '', + 'line' => 496 + }, + 'Parse::RecDescent::Rule' + ), + 'operator' => bless( + { + 'impcount' => 0, + 'calls' => ['_alternation_1_of_production_1_of_rule_operator'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_operator', + 'matchrule' => 0, + 'implicit' => '/CONCAT/i, or \'||\'', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 321 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '/', + 'hashname' => '__STRING1__', + 'description' => '\'/\'', + 'lookahead' => 0, + 'line' => 321 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 321 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '*', + 'hashname' => '__STRING1__', + 'description' => '\'*\'', + 'lookahead' => 0, + 'line' => 321 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 321 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '+', + 'hashname' => '__STRING1__', + 'description' => '\'+\'', + 'lookahead' => 0, + 'line' => 321 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 321 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '-', + 'hashname' => '__STRING1__', + 'description' => '\'-\'', + 'lookahead' => 0, + 'line' => 321 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 321 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'operator', + 'vars' => '', + 'line' => 321 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_2_of_rule_type' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'INSERT', + 'hashname' => '__PATTERN1__', + 'description' => '/INSERT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DELETE', + 'hashname' => '__PATTERN1__', + 'description' => '/DELETE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UPDATE', + 'hashname' => '__PATTERN1__', + 'description' => '/UPDATE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_2_of_rule_type', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_8_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CONCAT', + 'hashname' => '__PATTERN1__', + 'description' => '/CONCAT/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '||', + 'hashname' => '__STRING1__', + 'description' => '\'||\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_8_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'sequence_reference' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'nextval_expression', + 'prevval_expression' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'nextval_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 608 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'prevval_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 609 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 609 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'sequence_reference', + 'vars' => '', + 'line' => 608 + }, + 'Parse::RecDescent::Rule' + ), + 'sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_sysibm_function', + '_alternation_1_of_production_8_of_rule_sysibm_function', + '_alternation_1_of_production_9_of_rule_sysibm_function', + '_alternation_1_of_production_12_of_rule_sysibm_function', + '_alternation_1_of_production_17_of_rule_sysibm_function', + '_alternation_1_of_production_30_of_rule_sysibm_function', + '_alternation_1_of_production_41_of_rule_sysibm_function', + '_alternation_1_of_production_42_of_rule_sysibm_function', + '_alternation_1_of_production_63_of_rule_sysibm_function', + '_alternation_1_of_production_83_of_rule_sysibm_function', + '_alternation_1_of_production_87_of_rule_sysibm_function' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/ABS/i, or /ABSVAL/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 332 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'AVG', + 'hashname' => '__PATTERN1__', + 'description' => '/AVG/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 333, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 333 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'BIGINT', + 'hashname' => '__PATTERN1__', + 'description' => '/BIGINT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 334, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 334 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'BLOB', + 'hashname' => '__PATTERN1__', + 'description' => '/BLOB/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 335, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 335 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CHAR', + 'hashname' => '__PATTERN1__', + 'description' => '/CHAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 336, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 336 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '5', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CLOB', + 'hashname' => '__PATTERN1__', + 'description' => '/CLOB/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 337, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 337 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '6', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'COALESCE', + 'hashname' => '__PATTERN1__', + 'description' => '/COALESCE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 338, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 338 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '7', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_8_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/CONCAT/, or \'||\'', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 339 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 339 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '8', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_9_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/CORRELATION/i, or /CORR/', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 340 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 340 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '9', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'COUNT', + 'hashname' => '__PATTERN1__', + 'description' => '/COUNT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 341, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 341 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '10', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'COUNT_BIG', + 'hashname' => '__PATTERN1__', + 'description' => '/COUNT_BIG/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 342, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 342 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '11', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_12_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/COVARIANCE/i, or /COVAR/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 343 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 343 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '12', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DATE', + 'hashname' => '__PATTERN1__', + 'description' => '/DATE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 344, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 344 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '13', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DAY', + 'hashname' => '__PATTERN1__', + 'description' => '/DAY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 345, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 345 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '14', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DAYS', + 'hashname' => '__PATTERN1__', + 'description' => '/DAYS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 346, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 346 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '15', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DBCLOB', + 'hashname' => '__PATTERN1__', + 'description' => '/DBCLOB/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 347, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 347 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '16', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_17_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/DECIMAL/i, or /DEC/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 348 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 348 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '17', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DECRYPT_BIN', + 'hashname' => '__PATTERN1__', + 'description' => '/DECRYPT_BIN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 349, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 349 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '18', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DECRYPT_CHAR', + 'hashname' => '__PATTERN1__', + 'description' => '/DECRYPT_CHAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 350, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 350 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '19', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DEREF', + 'hashname' => '__PATTERN1__', + 'description' => '/DEREF/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 351, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 351 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '20', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DIGITS', + 'hashname' => '__PATTERN1__', + 'description' => '/DIGITS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 352, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 352 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '21', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLCOMMENT', + 'hashname' => '__PATTERN1__', + 'description' => '/DLCOMMENT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 353, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 353 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '22', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLLINKTYPE', + 'hashname' => '__PATTERN1__', + 'description' => '/DLLINKTYPE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 354, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 354 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '23', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLURLCOMPLETE', + 'hashname' => '__PATTERN1__', + 'description' => '/DLURLCOMPLETE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 355, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 355 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '24', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLURLPATH', + 'hashname' => '__PATTERN1__', + 'description' => '/DLURLPATH/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 356, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 356 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '25', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLURLPATHONLY', + 'hashname' => '__PATTERN1__', + 'description' => '/DLURLPATHONLY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 357, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 357 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '26', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLURLSCHEME', + 'hashname' => '__PATTERN1__', + 'description' => '/DLURLSCHEME/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 358, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 358 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '27', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLURLSERVER', + 'hashname' => '__PATTERN1__', + 'description' => '/DLURLSERVER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 359, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 359 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '28', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DLVALUE', + 'hashname' => '__PATTERN1__', + 'description' => '/DLVALUE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 360, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 360 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '29', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_30_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/DOUBLE/i, or /DOUBLE_PRECISION/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 361 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 361 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '30', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ENCRYPT', + 'hashname' => '__PATTERN1__', + 'description' => '/ENCRYPT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 362, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 362 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '31', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'EVENT_MON_STATE', + 'hashname' => '__PATTERN1__', + 'description' => '/EVENT_MON_STATE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 363, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 363 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '32', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'FLOAT', + 'hashname' => '__PATTERN1__', + 'description' => '/FLOAT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 364, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 364 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '33', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'GETHINT', + 'hashname' => '__PATTERN1__', + 'description' => '/GETHINT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 365, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 365 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '34', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'GENERATE_UNIQUE', + 'hashname' => '__PATTERN1__', + 'description' => '/GENERATE_UNIQUE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 366, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 366 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '35', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'GRAPHIC', + 'hashname' => '__PATTERN1__', + 'description' => '/GRAPHIC/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 367, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 367 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '36', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'GROUPING', + 'hashname' => '__PATTERN1__', + 'description' => '/GROUPING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 368, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 368 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '37', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'HEX', + 'hashname' => '__PATTERN1__', + 'description' => '/HEX/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 369, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 369 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '38', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'HOUR', + 'hashname' => '__PATTERN1__', + 'description' => '/HOUR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 370, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 370 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '39', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'IDENTITY_VAL_LOCAL', + 'hashname' => '__PATTERN1__', + 'description' => '/IDENTITY_VAL_LOCAL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 371, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 371 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '40', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_41_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/INTEGER/i, or /INT/', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 372 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 372 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '41', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_42_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/LCASE/i, or /LOWER/', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 373 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 373 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '42', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LENGTH', + 'hashname' => '__PATTERN1__', + 'description' => '/LENGTH/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 374, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 374 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '43', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LONG_VARCHAR', + 'hashname' => '__PATTERN1__', + 'description' => '/LONG_VARCHAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 375, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 375 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '44', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LONG_VARGRAPHIC', + 'hashname' => '__PATTERN1__', + 'description' => '/LONG_VARGRAPHIC/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 376, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 376 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '45', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LTRIM', + 'hashname' => '__PATTERN1__', + 'description' => '/LTRIM/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 377, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 377 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '46', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MAX', + 'hashname' => '__PATTERN1__', + 'description' => '/MAX/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 378, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 378 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '47', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MICROSECOND', + 'hashname' => '__PATTERN1__', + 'description' => '/MICROSECOND/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 379, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 379 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '48', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MIN', + 'hashname' => '__PATTERN1__', + 'description' => '/MIN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 380, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 380 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '49', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MINUTE', + 'hashname' => '__PATTERN1__', + 'description' => '/MINUTE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 381, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 381 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '50', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MONTH', + 'hashname' => '__PATTERN1__', + 'description' => '/MONTH/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 382, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 382 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '51', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MULTIPLY_ACT', + 'hashname' => '__PATTERN1__', + 'description' => '/MULTIPLY_ACT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 383, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 383 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '52', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NODENUMBER', + 'hashname' => '__PATTERN1__', + 'description' => '/NODENUMBER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 384, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 384 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '53', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULLIF', + 'hashname' => '__PATTERN1__', + 'description' => '/NULLIF/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 385, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 385 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '54', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'PARTITON', + 'hashname' => '__PATTERN1__', + 'description' => '/PARTITON/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 386, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 386 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '55', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'POSSTR', + 'hashname' => '__PATTERN1__', + 'description' => '/POSSTR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 387, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 387 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '56', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RAISE_ERROR', + 'hashname' => '__PATTERN1__', + 'description' => '/RAISE_ERROR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 388, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 388 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '57', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REAL', + 'hashname' => '__PATTERN1__', + 'description' => '/REAL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 389, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 389 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '58', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REC2XML', + 'hashname' => '__PATTERN1__', + 'description' => '/REC2XML/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 390, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 390 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '59', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_AVGX', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_AVGX/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 391, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 391 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '60', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_AVGY', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_AVGY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 392, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 392 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '61', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_COUNT', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_COUNT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 393, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 393 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '62', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_63_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/REGR_INTERCEPT/i, or /REGR_ICPT/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 394 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 394 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '63', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_R2', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_R2/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 395, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 395 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '64', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_SLOPE', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_SLOPE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 396, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 396 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '65', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_SXX', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_SXX/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 397, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 397 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '66', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_SXY', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_SXY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 398, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 398 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '67', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_SYY', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_SYY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 399, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 399 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '68', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RTRIM', + 'hashname' => '__PATTERN1__', + 'description' => '/RTRIM/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 400, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 400 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '69', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SECOND', + 'hashname' => '__PATTERN1__', + 'description' => '/SECOND/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 401, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 401 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '70', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SMALLINT', + 'hashname' => '__PATTERN1__', + 'description' => '/SMALLINT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 402, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 402 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '71', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'STDDEV', + 'hashname' => '__PATTERN1__', + 'description' => '/STDDEV/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 403, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 403 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '72', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SUBSTR', + 'hashname' => '__PATTERN1__', + 'description' => '/SUBSTR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 404, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 404 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '73', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SUM', + 'hashname' => '__PATTERN1__', + 'description' => '/SUM/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 405, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 405 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '74', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TABLE_NAME', + 'hashname' => '__PATTERN1__', + 'description' => '/TABLE_NAME/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 406, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 406 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '75', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TABLE_SCHEMA', + 'hashname' => '__PATTERN1__', + 'description' => '/TABLE_SCHEMA/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 407, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 407 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '76', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TIME', + 'hashname' => '__PATTERN1__', + 'description' => '/TIME/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 408, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 408 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '77', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TIMESTAMP', + 'hashname' => '__PATTERN1__', + 'description' => '/TIMESTAMP/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 409, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 409 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '78', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TRANSLATE', + 'hashname' => '__PATTERN1__', + 'description' => '/TRANSLATE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 410, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 410 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '79', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TYPE_ID', + 'hashname' => '__PATTERN1__', + 'description' => '/TYPE_ID/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 411, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 411 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '80', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TYPE_NAME', + 'hashname' => '__PATTERN1__', + 'description' => '/TYPE_NAME/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 412, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 412 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '81', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TYPE_SCHEMA', + 'hashname' => '__PATTERN1__', + 'description' => '/TYPE_SCHEMA/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 413, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 413 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '82', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_83_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/UCASE/i, or /UPPER/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 414 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 414 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '83', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'VALUE', + 'hashname' => '__PATTERN1__', + 'description' => '/VALUE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 415, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 415 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '84', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'VARCHAR', + 'hashname' => '__PATTERN1__', + 'description' => '/VARCHAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 416, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 416 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '85', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'VARGRAPHIC', + 'hashname' => '__PATTERN1__', + 'description' => '/VARGRAPHIC/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 417, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 417 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '86', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_87_of_rule_sysibm_function', + 'matchrule' => 0, + 'implicit' => '/VARIANCE/i, or /VAR/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 418 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 418 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '87', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'YEAR', + 'hashname' => '__PATTERN1__', + 'description' => '/YEAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 419, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 419 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'sysibm_function', + 'vars' => '', + 'line' => 332 + }, + 'Parse::RecDescent::Rule' + ), + 'window_partition_clause' => bless( + { + 'impcount' => 0, + 'calls' => ['partitioning_expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'op' => [], + 'items' => [ + bless( + { + 'pattern' => 'PARTITION\\s+BY', + 'hashname' => '__PATTERN1__', + 'description' => '/PARTITION\\\\s+BY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 553, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'expected' => '', + 'min' => 1, + 'name' => '\'partitioning_expression(s)\'', + 'max' => 100000000, + 'leftarg' => bless( + { + 'subrule' => 'partitioning_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 553 + }, + 'Parse::RecDescent::Subrule' + ), + 'rightarg' => bless( + { + 'subrule' => 'partitioning_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 553 + }, + 'Parse::RecDescent::Subrule' + ), + 'hashname' => '__DIRECTIVE1__', + 'type' => 'leftop', + 'op' => bless( + { + 'pattern' => ',', + 'hashname' => '__PATTERN2__', + 'description' => '/,/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 553, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + }, + 'Parse::RecDescent::Operator' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'window_partition_clause', + 'vars' => '', + 'line' => 553 + }, + 'Parse::RecDescent::Rule' + ), + 'WHERE' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'where', + 'hashname' => '__PATTERN1__', + 'description' => '/where/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 117, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'WHERE', + 'vars' => '', + 'line' => 117 + }, + 'Parse::RecDescent::Rule' + ), + 'CREATE' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'create', + 'hashname' => '__PATTERN1__', + 'description' => '/create/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 101, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'CREATE', + 'vars' => '', + 'line' => 101 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_sysfun' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ABS', + 'hashname' => '__PATTERN1__', + 'description' => '/ABS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ABSVAL', + 'hashname' => '__PATTERN1__', + 'description' => '/ABSVAL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_sysfun', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_function' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'sysibm_function', + 'sysfun_function', + 'userdefined_function' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SYSIBM\\.|', + 'hashname' => '__PATTERN1__', + 'description' => '/SYSIBM\\\\.|/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 625, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'sysibm_function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 625 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SYSFUN\\.|', + 'hashname' => '__PATTERN1__', + 'description' => '/SYSFUN\\\\.|/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'sysfun_function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 626 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'userdefined_function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_function', + 'vars' => '', + 'line' => 625 + }, + 'Parse::RecDescent::Rule' + ), + 'identifier' => bless( + { + 'impcount' => 0, + 'calls' => ['NAME'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 136 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'identifier', + 'vars' => '', + 'line' => 136 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause' => + bless( + { + 'impcount' => 0, + 'calls' => [ + 'asc_option', + 'desc_option' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'asc_option', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'desc_option', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'result_expression' => bless( + { + 'impcount' => 0, + 'calls' => ['expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 515 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'result_expression', + 'vars' => '', + 'line' => 515 + }, + 'Parse::RecDescent::Rule' + ), + 'scoped_reference_expression' => bless( + { + 'impcount' => 0, + 'calls' => ['expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 532 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 533, + 'code' => '{ # scoped, reference }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'scoped_reference_expression', - 'vars' => '', - 'line' => 528 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification' => bless( { - 'impcount' => 0, - 'calls' => [ - 'typed_table_name', - 'typed_view_name' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'typed_table_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'typed_view_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'when_clause' => bless( { - 'impcount' => 0, - 'calls' => [ - 'search_condition' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => 'WHEN', - 'hashname' => '__PATTERN1__', - 'description' => '/WHEN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 261, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 261 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'search_condition', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 261 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 261 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 261, - 'code' => '{$return = $item[3]}' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'when_clause', - 'vars' => '', - 'line' => 259 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_asc_option' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULLS\\s+FIRST', - 'hashname' => '__PATTERN1__', - 'description' => '/NULLS\\\\s+FIRST/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULLS\\s+LAST', - 'hashname' => '__PATTERN1__', - 'description' => '/NULLS\\\\s+LAST/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_asc_option', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'sequence_name' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 615 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'sequence_name', - 'vars' => '', - 'line' => 615 - }, 'Parse::RecDescent::Rule' ), - 'ld_duration' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'YEARS?', - 'hashname' => '__PATTERN1__', - 'description' => '/YEARS?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 488, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MONTHS?', - 'hashname' => '__PATTERN1__', - 'description' => '/MONTHS?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 489, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 489 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DAYS?', - 'hashname' => '__PATTERN1__', - 'description' => '/DAYS?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 490, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 490 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'HOURS?', - 'hashname' => '__PATTERN1__', - 'description' => '/HOURS?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 491, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 491 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MINUTES?', - 'hashname' => '__PATTERN1__', - 'description' => '/MINUTES?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 492, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 492 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '5', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SECONDS?', - 'hashname' => '__PATTERN1__', - 'description' => '/SECONDS?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 493, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 493 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '6', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MICROSECONDS?', - 'hashname' => '__PATTERN1__', - 'description' => '/MICROSECONDS?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 494, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 494 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'ld_duration', - 'vars' => '', - 'line' => 488 - }, 'Parse::RecDescent::Rule' ), - 'reference_a' => bless( { - 'impcount' => 0, - 'calls' => [ - 'old_new_corr', - 'old_new_table' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => 'REFERENCING', - 'hashname' => '__PATTERN1__', - 'description' => '/REFERENCING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 283, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'old_new_corr', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 2, - 'matchrule' => 0, - 'repspec' => '0..2', - 'lookahead' => 0, - 'line' => 283 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'old_new_table', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 2, - 'matchrule' => 0, - 'repspec' => '0..2', - 'lookahead' => 0, - 'line' => 283 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 284, - 'code' => '{ $return = join(\' \', $item[1], join(\' \', @{$item[2]}), join(\' \', @{$item[3]}) ) }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'reference_a', - 'vars' => '', - 'line' => 283 - }, 'Parse::RecDescent::Rule' ), - 'cast_specification' => bless( { - 'impcount' => 2, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_cast_specification', - 'data_type', - '_alternation_2_of_production_1_of_rule_cast_specification' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CAST', - 'hashname' => '__PATTERN1__', - 'description' => '/CAST/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 517, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 517 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_cast_specification', - 'matchrule' => 0, - 'implicit' => 'expression, or /NULL/i, or parameter_marker', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 520 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'AS', - 'hashname' => '__PATTERN2__', - 'description' => '/AS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 520, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'data_type', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 520 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_2_of_production_1_of_rule_cast_specification', - 'expected' => '/SCOPE/', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 524 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 524 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'cast_specification', - 'vars' => '', - 'line' => 517 - }, 'Parse::RecDescent::Rule' ), - 'type' => bless( { - 'impcount' => 1, - 'calls' => [ - 'column_name', - '_alternation_1_of_production_2_of_rule_type' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 3, - 'actcount' => 1, - 'op' => [], - 'items' => [ - bless( { - 'pattern' => 'UPDATE', - 'hashname' => '__PATTERN1__', - 'description' => '/UPDATE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 272, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => 'OF', - 'hashname' => '__PATTERN2__', - 'description' => '/OF/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 272, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'expected' => '', - 'min' => 1, - 'name' => '\'column_name(s)\'', - 'max' => 100000000, - 'leftarg' => bless( { - 'subrule' => 'column_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 272 - }, 'Parse::RecDescent::Subrule' ), - 'rightarg' => bless( { - 'subrule' => 'column_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 272 - }, 'Parse::RecDescent::Subrule' ), - 'hashname' => '__DIRECTIVE1__', - 'type' => 'leftop', - 'op' => bless( { - 'pattern' => ',', - 'hashname' => '__PATTERN3__', - 'description' => '/,/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 272, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - }, 'Parse::RecDescent::Operator' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 273, - 'code' => '{ $return = { event => \'update_on\', + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'scoped_reference_expression', + 'vars' => '', + 'line' => 528 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification' => + bless( + { + 'impcount' => 0, + 'calls' => [ + 'typed_table_name', + 'typed_view_name' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'typed_table_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'typed_view_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => + '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cast_specification', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'when_clause' => bless( + { + 'impcount' => 0, + 'calls' => ['search_condition'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => 'WHEN', + 'hashname' => '__PATTERN1__', + 'description' => '/WHEN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 261, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 261 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'search_condition', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 261 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 261 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 261, + 'code' => '{$return = $item[3]}' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'when_clause', + 'vars' => '', + 'line' => 259 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_asc_option' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULLS\\s+FIRST', + 'hashname' => '__PATTERN1__', + 'description' => '/NULLS\\\\s+FIRST/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULLS\\s+LAST', + 'hashname' => '__PATTERN1__', + 'description' => '/NULLS\\\\s+LAST/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_asc_option', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'sequence_name' => bless( + { + 'impcount' => 0, + 'calls' => ['NAME'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 615 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'sequence_name', + 'vars' => '', + 'line' => 615 + }, + 'Parse::RecDescent::Rule' + ), + 'ld_duration' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'YEARS?', + 'hashname' => '__PATTERN1__', + 'description' => '/YEARS?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 488, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MONTHS?', + 'hashname' => '__PATTERN1__', + 'description' => '/MONTHS?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 489, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 489 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DAYS?', + 'hashname' => '__PATTERN1__', + 'description' => '/DAYS?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 490, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 490 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'HOURS?', + 'hashname' => '__PATTERN1__', + 'description' => '/HOURS?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 491, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 491 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MINUTES?', + 'hashname' => '__PATTERN1__', + 'description' => '/MINUTES?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 492, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 492 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '5', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SECONDS?', + 'hashname' => '__PATTERN1__', + 'description' => '/SECONDS?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 493, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 493 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '6', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MICROSECONDS?', + 'hashname' => '__PATTERN1__', + 'description' => '/MICROSECONDS?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 494, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 494 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'ld_duration', + 'vars' => '', + 'line' => 488 + }, + 'Parse::RecDescent::Rule' + ), + 'reference_a' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'old_new_corr', + 'old_new_table' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => 'REFERENCING', + 'hashname' => '__PATTERN1__', + 'description' => '/REFERENCING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 283, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'old_new_corr', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 2, + 'matchrule' => 0, + 'repspec' => '0..2', + 'lookahead' => 0, + 'line' => 283 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => 'old_new_table', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 2, + 'matchrule' => 0, + 'repspec' => '0..2', + 'lookahead' => 0, + 'line' => 283 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 284, + 'code' => + '{ $return = join(\' \', $item[1], join(\' \', @{$item[2]}), join(\' \', @{$item[3]}) ) }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'reference_a', + 'vars' => '', + 'line' => 283 + }, + 'Parse::RecDescent::Rule' + ), + 'cast_specification' => bless( + { + 'impcount' => 2, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_cast_specification', + 'data_type', + '_alternation_2_of_production_1_of_rule_cast_specification' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CAST', + 'hashname' => '__PATTERN1__', + 'description' => '/CAST/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 517, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 517 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_cast_specification', + 'matchrule' => 0, + 'implicit' => 'expression, or /NULL/i, or parameter_marker', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 520 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'AS', + 'hashname' => '__PATTERN2__', + 'description' => '/AS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 520, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'data_type', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 520 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => '_alternation_2_of_production_1_of_rule_cast_specification', + 'expected' => '/SCOPE/', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 524 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 524 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'cast_specification', + 'vars' => '', + 'line' => 517 + }, + 'Parse::RecDescent::Rule' + ), + 'type' => bless( + { + 'impcount' => 1, + 'calls' => [ + 'column_name', + '_alternation_1_of_production_2_of_rule_type' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 3, + 'actcount' => 1, + 'op' => [], + 'items' => [ + bless( + { + 'pattern' => 'UPDATE', + 'hashname' => '__PATTERN1__', + 'description' => '/UPDATE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 272, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => 'OF', + 'hashname' => '__PATTERN2__', + 'description' => '/OF/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 272, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'expected' => '', + 'min' => 1, + 'name' => '\'column_name(s)\'', + 'max' => 100000000, + 'leftarg' => bless( + { + 'subrule' => 'column_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 272 + }, + 'Parse::RecDescent::Subrule' + ), + 'rightarg' => bless( + { + 'subrule' => 'column_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 272 + }, + 'Parse::RecDescent::Subrule' + ), + 'hashname' => '__DIRECTIVE1__', + 'type' => 'leftop', + 'op' => bless( + { + 'pattern' => ',', + 'hashname' => '__PATTERN3__', + 'description' => '/,/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 272, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + }, + 'Parse::RecDescent::Operator' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 273, + 'code' => '{ $return = { event => \'update_on\', fields => $item[3] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_2_of_rule_type', - 'matchrule' => 0, - 'implicit' => '/INSERT/i, or /DELETE/i, or /UPDATE/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 277 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 278, - 'code' => '{ $return = { event => $item[1] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'type', - 'vars' => '', - 'line' => 272 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_12_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'COVARIANCE', - 'hashname' => '__PATTERN1__', - 'description' => '/COVARIANCE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'COVAR', - 'hashname' => '__PATTERN1__', - 'description' => '/COVAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_12_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'scalar_fullselect' => bless( { - 'impcount' => 0, - 'calls' => [ - 'fullselect' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 478 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'fullselect', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 478 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 478 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'scalar_fullselect', - 'vars' => '', - 'line' => 478 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_options' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CASCADED', - 'hashname' => '__PATTERN1__', - 'description' => '/CASCADED/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LOCAL', - 'hashname' => '__PATTERN1__', - 'description' => '/LOCAL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_options', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'func_args' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 330 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'func_args', - 'vars' => '', - 'line' => 330 - }, 'Parse::RecDescent::Rule' ), - 'trigger_name' => bless( { - 'impcount' => 0, - 'calls' => [ - 'SCHEMA', - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'SCHEMA', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 119 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '.', - 'hashname' => '__STRING1__', - 'description' => '\'.\'', - 'lookahead' => 0, - 'line' => 119 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 119 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 120, - 'code' => '{ $return = { schema => $item[1], name => $item[3] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 121 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 122, - 'code' => '{ $return = { name => $item[1] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 121 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'trigger_name', - 'vars' => '', - 'line' => 119 - }, 'Parse::RecDescent::Rule' ), - '_alternation_2_of_production_1_of_rule_numbering_function' => bless( { - 'impcount' => 0, - 'calls' => [ - 'window_aggregation_group_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING', - 'hashname' => '__PATTERN1__', - 'description' => '/RANGE\\\\s+BETWEEN\\\\s+UNBOUNDED\\\\s+PRECEDING\\\\s+AND\\\\s+UNBBOUNDED\\\\s+FOLLOWING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'window_aggregation_group_clause', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_2_of_production_1_of_rule_numbering_function', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'method_name' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 602 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 603, - 'code' => '{ # must be a method of subject_expression + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_2_of_rule_type', + 'matchrule' => 0, + 'implicit' => '/INSERT/i, or /DELETE/i, or /UPDATE/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 277 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 278, + 'code' => '{ $return = { event => $item[1] } }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'type', + 'vars' => '', + 'line' => 272 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_12_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'COVARIANCE', + 'hashname' => '__PATTERN1__', + 'description' => '/COVARIANCE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'COVAR', + 'hashname' => '__PATTERN1__', + 'description' => '/COVAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_12_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'scalar_fullselect' => bless( + { + 'impcount' => 0, + 'calls' => ['fullselect'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 478 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'fullselect', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 478 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 478 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'scalar_fullselect', + 'vars' => '', + 'line' => 478 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_options' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CASCADED', + 'hashname' => '__PATTERN1__', + 'description' => '/CASCADED/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LOCAL', + 'hashname' => '__PATTERN1__', + 'description' => '/LOCAL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_options', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'func_args' => bless( + { + 'impcount' => 0, + 'calls' => ['expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 330 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'func_args', + 'vars' => '', + 'line' => 330 + }, + 'Parse::RecDescent::Rule' + ), + 'trigger_name' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'SCHEMA', + 'NAME' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'SCHEMA', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 119 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '.', + 'hashname' => '__STRING1__', + 'description' => '\'.\'', + 'lookahead' => 0, + 'line' => 119 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 119 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 120, + 'code' => '{ $return = { schema => $item[1], name => $item[3] } }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 121 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 122, + 'code' => '{ $return = { name => $item[1] } }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => 121 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'trigger_name', + 'vars' => '', + 'line' => 119 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_2_of_production_1_of_rule_numbering_function' => bless( + { + 'impcount' => 0, + 'calls' => ['window_aggregation_group_clause'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RANGE\\s+BETWEEN\\s+UNBOUNDED\\s+PRECEDING\\s+AND\\s+UNBBOUNDED\\s+FOLLOWING', + 'hashname' => '__PATTERN1__', + 'description' => + '/RANGE\\\\s+BETWEEN\\\\s+UNBOUNDED\\\\s+PRECEDING\\\\s+AND\\\\s+UNBBOUNDED\\\\s+FOLLOWING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'window_aggregation_group_clause', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_2_of_production_1_of_rule_numbering_function', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'method_name' => bless( + { + 'impcount' => 0, + 'calls' => ['NAME'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 602 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 603, + 'code' => '{ # must be a method of subject_expression }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'method_name', - 'vars' => '', - 'line' => 602 - }, 'Parse::RecDescent::Rule' ), - 'quantified_p' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression1', - 'fullselect' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'expression1', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)', - 'hashname' => '__PATTERN1__', - 'description' => '/(=|<>|<|>|<=|=>|\\\\^=|\\\\^<|\\\\^>|\\\\!=)/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => 'SOME|ANY|ALL', - 'hashname' => '__PATTERN2__', - 'description' => '/SOME|ANY|ALL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'fullselect', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'quantified_p', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'common_table_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'table_name', - 'column_list', - 'get_bracketed', - 'fullselect' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'table_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'column_list', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'AS', - 'hashname' => '__PATTERN1__', - 'description' => '/AS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 162, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'get_bracketed', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 162 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 163, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'method_name', + 'vars' => '', + 'line' => 602 + }, + 'Parse::RecDescent::Rule' + ), + 'quantified_p' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'expression1', + 'fullselect' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'expression1', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)', + 'hashname' => '__PATTERN1__', + 'description' => '/(=|<>|<|>|<=|=>|\\\\^=|\\\\^<|\\\\^>|\\\\!=)/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => 'SOME|ANY|ALL', + 'hashname' => '__PATTERN2__', + 'description' => '/SOME|ANY|ALL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'fullselect', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'quantified_p', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'common_table_expression' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'table_name', + 'column_list', + 'get_bracketed', + 'fullselect' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'table_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 162 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'column_list', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 162 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'AS', + 'hashname' => '__PATTERN1__', + 'description' => '/AS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 162, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'get_bracketed', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 162 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 163, + 'code' => '{ $return = { name => $item{table_name}{name}, query => $item[4] }; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'table_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'column_list', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'AS', - 'hashname' => '__PATTERN1__', - 'description' => '/AS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 174, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'fullselect', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 174 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'common_table_expression', - 'vars' => '', - 'line' => 160 - }, 'Parse::RecDescent::Rule' ), - 'after' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'AFTER', - 'hashname' => '__PATTERN1__', - 'description' => '/AFTER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 270, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'after', - 'vars' => '', - 'line' => 270 - }, 'Parse::RecDescent::Rule' ), - 'predicate' => bless( { - 'impcount' => 0, - 'calls' => [ - 'basic_p', - 'quantified_p', - 'between_p', - 'exists_p', - 'in_p', - 'like_p', - 'null_p', - 'type_p' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'basic_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'quantified_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'between_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'exists_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'in_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '5', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'like_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '6', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'null_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '7', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'type_p', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'predicate', - 'vars' => '', - 'line' => 622 - }, 'Parse::RecDescent::Rule' ), - 'column_name' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 134 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'column_name', - 'vars' => '', - 'line' => 134 - }, 'Parse::RecDescent::Rule' ), - 'method_invocation' => bless( { - 'impcount' => 1, - 'calls' => [ - 'subject_expression', - 'method_name', - '_alternation_1_of_production_1_of_rule_method_invocation' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'subject_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 593 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '..', - 'hashname' => '__STRING1__', - 'description' => '\'..\'', - 'lookahead' => 0, - 'line' => 593 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'method_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 593 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_method_invocation', - 'expected' => '\'(\'', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 596 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'method_invocation', - 'vars' => '', - 'line' => 593 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_dereference_operation' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'expression', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_dereference_operation', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_searched_when_clause' => bless( { - 'impcount' => 1, - 'calls' => [ - 'search_condition', - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'WHEN', - 'hashname' => '__PATTERN1__', - 'description' => '/WHEN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 624, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'search_condition', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 624 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'THEN', - 'hashname' => '__PATTERN2__', - 'description' => '/THEN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 624, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause', - 'matchrule' => 0, - 'implicit' => 'result_expression, or /NULL/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_searched_when_clause', - 'vars' => '', - 'line' => 624 - }, 'Parse::RecDescent::Rule' ), - 'group_bound2' => bless( { - 'impcount' => 0, - 'calls' => [ - 'unsigned_constant' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UNBOUNDED\\s+PRECEDING', - 'hashname' => '__PATTERN1__', - 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 585, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'unsigned_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 586 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'PRECEDING', - 'hashname' => '__PATTERN1__', - 'description' => '/PRECEDING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 586, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 586 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'unsigned_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 587 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'FOLLOWING', - 'hashname' => '__PATTERN1__', - 'description' => '/FOLLOWING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 587, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 587 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CURRENT\\s+ROW', - 'hashname' => '__PATTERN1__', - 'description' => '/CURRENT\\\\s+ROW/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 588, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 588 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'group_bound2', - 'vars' => '', - 'line' => 585 - }, 'Parse::RecDescent::Rule' ), - 'searched_when_clause' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_searched_when_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_searched_when_clause', - 'expected' => '/WHEN/i', - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 507 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'searched_when_clause', - 'vars' => '', - 'line' => 503 - }, 'Parse::RecDescent::Rule' ), - 'basic_p' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 624 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)', - 'hashname' => '__PATTERN1__', - 'description' => '/(=|<>|<|>|<=|=>|\\\\^=|\\\\^<|\\\\^>|\\\\!=)/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 624, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 624 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'basic_p', - 'vars' => '', - 'line' => 624 - }, 'Parse::RecDescent::Rule' ), - 'asc_option' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_asc_option' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ASC', - 'hashname' => '__PATTERN1__', - 'description' => '/ASC/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 562, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_asc_option', - 'expected' => '/NULLS\\\\s+FIRST/i, or /NULLS\\\\s+LAST/i', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 562 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'asc_option', - 'vars' => '', - 'line' => 562 - }, 'Parse::RecDescent::Rule' ), - 'search_condition' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_2_of_rule_search_condition', - 'cond' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '[^)]+', - 'hashname' => '__PATTERN1__', - 'description' => '/[^)]+/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 297, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NOT|', - 'hashname' => '__PATTERN1__', - 'description' => '/NOT|/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 618, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_2_of_rule_search_condition', - 'matchrule' => 0, - 'implicit' => 'predicate, or \'(\'', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 618 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'cond', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's?', - 'lookahead' => 0, - 'line' => 618 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'search_condition', - 'vars' => '', - 'line' => 296 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_operator' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CONCAT', - 'hashname' => '__PATTERN1__', - 'description' => '/CONCAT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '||', - 'hashname' => '__STRING1__', - 'description' => '\'||\'', - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_operator', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'simple_when_clause' => bless( { - 'impcount' => 1, - 'calls' => [ - 'expression', - '_alternation_1_of_production_1_of_rule_simple_when_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 509 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_simple_when_clause', - 'expected' => '/WHEN/i', - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 513 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'simple_when_clause', - 'vars' => '', - 'line' => 509 - }, 'Parse::RecDescent::Rule' ), - 'INNER' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'inner', - 'hashname' => '__PATTERN1__', - 'description' => '/inner/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 107, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'INNER', - 'vars' => '', - 'line' => 107 - }, 'Parse::RecDescent::Rule' ), - 'eofile' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '^\\Z', - 'hashname' => '__PATTERN1__', - 'description' => '/^\\\\Z/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 20, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'eofile', - 'vars' => '', - 'line' => 20 - }, 'Parse::RecDescent::Rule' ), - 'cond' => bless( { - 'impcount' => 2, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_cond', - '_alternation_2_of_production_1_of_rule_cond' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_cond', - 'matchrule' => 0, - 'implicit' => '/AND/i, or /OR/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 620 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'NOT|', - 'hashname' => '__PATTERN1__', - 'description' => '/NOT|/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 620, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_2_of_production_1_of_rule_cond', - 'matchrule' => 0, - 'implicit' => 'predicate, or \'(\'', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 620 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'cond', - 'vars' => '', - 'line' => 620 - }, 'Parse::RecDescent::Rule' ), - 'ld_type' => bless( { - 'impcount' => 0, - 'calls' => [ - 'function', - 'expression', - 'constant', - 'column_name', - 'host_variable' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 482 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 483 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 483 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 483 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 483 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 484 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 484 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'column_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 485 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 485 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'host_variable', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 486 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 486 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'ld_type', - 'vars' => '', - 'line' => 482 - }, 'Parse::RecDescent::Rule' ), - 'RIGHT' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'right', - 'hashname' => '__PATTERN1__', - 'description' => '/right/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 111, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'RIGHT', - 'vars' => '', - 'line' => 111 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_method_invocation' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'expression', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_method_invocation', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'LEFT' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'left', - 'hashname' => '__PATTERN1__', - 'description' => '/left/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 109, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'LEFT', - 'vars' => '', - 'line' => 109 - }, 'Parse::RecDescent::Rule' ), - 'table_name' => bless( { - 'impcount' => 0, - 'calls' => [ - 'SCHEMA', - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'SCHEMA', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 124 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '.', - 'hashname' => '__STRING1__', - 'description' => '\'.\'', - 'lookahead' => 0, - 'line' => 124 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 124 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 125, - 'code' => '{ $return = { schema => $item[1], name => $item[3] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 126 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 127, - 'code' => '{ $return = { name => $item[1] } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 126 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'table_name', - 'vars' => '', - 'line' => 124 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_53_of_rule_sysfun' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TRUNCATE', - 'hashname' => '__PATTERN1__', - 'description' => '/TRUNCATE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TRUNC', - 'hashname' => '__PATTERN1__', - 'description' => '/TRUNC/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_53_of_rule_sysfun', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'options' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_options' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'WITH', - 'hashname' => '__PATTERN1__', - 'description' => '/WITH/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 150, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_options', - 'matchrule' => 0, - 'implicit' => '/CASCADED/i, or /LOCAL/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 150 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'CHECK\\s+OPTION', - 'hashname' => '__PATTERN2__', - 'description' => '/CHECK\\\\s+OPTION/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 150, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'options', - 'vars' => '', - 'line' => 150 - }, 'Parse::RecDescent::Rule' ), - 'function' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_function', - 'func_args' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'op' => [], - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_function', - 'matchrule' => 0, - 'implicit' => '/SYSIBM\\\\.|/i, or /SYSFUN\\\\.|/i, or userdefined_function', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 326 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 326 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'expected' => '', - 'min' => 1, - 'name' => '\'func_args(s)\'', - 'max' => 100000000, - 'leftarg' => bless( { - 'subrule' => 'func_args', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 326 - }, 'Parse::RecDescent::Subrule' ), - 'rightarg' => bless( { - 'subrule' => 'func_args', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 326 - }, 'Parse::RecDescent::Subrule' ), - 'hashname' => '__DIRECTIVE1__', - 'type' => 'leftop', - 'op' => bless( { - 'pattern' => ',', - 'hashname' => '__PATTERN1__', - 'description' => '/,/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 326, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - }, 'Parse::RecDescent::Operator' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 326 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'function', - 'vars' => '', - 'line' => 323 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_41_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'INTEGER', - 'hashname' => '__PATTERN1__', - 'description' => '/INTEGER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'INT', - 'hashname' => '__PATTERN1__', - 'description' => '/INT/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_41_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_case_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'searched_when_clause', - 'simple_when_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'searched_when_clause', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'simple_when_clause', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_case_expression', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_window_order_clause' => bless( { - 'impcount' => 1, - 'calls' => [ - 'sort_key_expression', - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'sort_key_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 624 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause', - 'expected' => 'asc_option, or desc_option', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_window_order_clause', - 'vars' => '', - 'line' => 624 - }, 'Parse::RecDescent::Rule' ), - 'create' => bless( { - 'impcount' => 0, - 'calls' => [ - 'CREATE', - 'TRIGGER', - 'trigger_name', - 'before', - 'type', - 'table_name', - 'reference_b', - 'triggered_action', - 'after', - 'reference_a', - 'VIEW', - 'view_name', - 'column_list', - 'with_expression', - 'SQL_procedure_statement' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'CREATE', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'TRIGGER', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'trigger_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'before', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'type', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'ON', - 'hashname' => '__PATTERN1__', - 'description' => '/ON/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 36, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'table_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'reference_b', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => 'FOR EACH ROW', - 'hashname' => '__PATTERN2__', - 'description' => '/FOR EACH ROW/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 36, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => 'MODE DB2SQL', - 'hashname' => '__STRING1__', - 'description' => '\'MODE DB2SQL\'', - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'triggered_action', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 36 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 37, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'table_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 174 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'column_list', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 174 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'AS', + 'hashname' => '__PATTERN1__', + 'description' => '/AS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 174, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 174 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'fullselect', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 174 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 174 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'common_table_expression', + 'vars' => '', + 'line' => 160 + }, + 'Parse::RecDescent::Rule' + ), + 'after' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'AFTER', + 'hashname' => '__PATTERN1__', + 'description' => '/AFTER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 270, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'after', + 'vars' => '', + 'line' => 270 + }, + 'Parse::RecDescent::Rule' + ), + 'predicate' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'basic_p', + 'quantified_p', + 'between_p', + 'exists_p', + 'in_p', + 'like_p', + 'null_p', + 'type_p' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'basic_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'quantified_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'between_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'exists_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'in_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '5', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'like_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '6', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'null_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '7', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'type_p', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'predicate', + 'vars' => '', + 'line' => 622 + }, + 'Parse::RecDescent::Rule' + ), + 'column_name' => bless( + { + 'impcount' => 0, + 'calls' => ['NAME'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 134 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'column_name', + 'vars' => '', + 'line' => 134 + }, + 'Parse::RecDescent::Rule' + ), + 'method_invocation' => bless( + { + 'impcount' => 1, + 'calls' => [ + 'subject_expression', + 'method_name', + '_alternation_1_of_production_1_of_rule_method_invocation' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'subject_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 593 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '..', + 'hashname' => '__STRING1__', + 'description' => '\'..\'', + 'lookahead' => 0, + 'line' => 593 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'method_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 593 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_method_invocation', + 'expected' => '\'(\'', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 596 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'method_invocation', + 'vars' => '', + 'line' => 593 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_dereference_operation' => bless( + { + 'impcount' => 0, + 'calls' => ['expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'expression', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_dereference_operation', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_searched_when_clause' => bless( + { + 'impcount' => 1, + 'calls' => [ + 'search_condition', + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'WHEN', + 'hashname' => '__PATTERN1__', + 'description' => '/WHEN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 624, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'search_condition', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 624 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'THEN', + 'hashname' => '__PATTERN2__', + 'description' => '/THEN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 624, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause', + 'matchrule' => 0, + 'implicit' => 'result_expression, or /NULL/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_searched_when_clause', + 'vars' => '', + 'line' => 624 + }, + 'Parse::RecDescent::Rule' + ), + 'group_bound2' => bless( + { + 'impcount' => 0, + 'calls' => ['unsigned_constant'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UNBOUNDED\\s+PRECEDING', + 'hashname' => '__PATTERN1__', + 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 585, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'unsigned_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 586 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'PRECEDING', + 'hashname' => '__PATTERN1__', + 'description' => '/PRECEDING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 586, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 586 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'unsigned_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 587 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'FOLLOWING', + 'hashname' => '__PATTERN1__', + 'description' => '/FOLLOWING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 587, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 587 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CURRENT\\s+ROW', + 'hashname' => '__PATTERN1__', + 'description' => '/CURRENT\\\\s+ROW/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 588, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 588 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'group_bound2', + 'vars' => '', + 'line' => 585 + }, + 'Parse::RecDescent::Rule' + ), + 'searched_when_clause' => bless( + { + 'impcount' => 1, + 'calls' => ['_alternation_1_of_production_1_of_rule_searched_when_clause'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_searched_when_clause', + 'expected' => '/WHEN/i', + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 507 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'searched_when_clause', + 'vars' => '', + 'line' => 503 + }, + 'Parse::RecDescent::Rule' + ), + 'basic_p' => bless( + { + 'impcount' => 0, + 'calls' => ['expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 624 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '(=|<>|<|>|<=|=>|\\^=|\\^<|\\^>|\\!=)', + 'hashname' => '__PATTERN1__', + 'description' => '/(=|<>|<|>|<=|=>|\\\\^=|\\\\^<|\\\\^>|\\\\!=)/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 624, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 624 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'basic_p', + 'vars' => '', + 'line' => 624 + }, + 'Parse::RecDescent::Rule' + ), + 'asc_option' => bless( + { + 'impcount' => 1, + 'calls' => ['_alternation_1_of_production_1_of_rule_asc_option'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ASC', + 'hashname' => '__PATTERN1__', + 'description' => '/ASC/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 562, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_asc_option', + 'expected' => '/NULLS\\\\s+FIRST/i, or /NULLS\\\\s+LAST/i', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 562 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'asc_option', + 'vars' => '', + 'line' => 562 + }, + 'Parse::RecDescent::Rule' + ), + 'search_condition' => bless( + { + 'impcount' => 1, + 'calls' => [ + '_alternation_1_of_production_2_of_rule_search_condition', + 'cond' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '[^)]+', + 'hashname' => '__PATTERN1__', + 'description' => '/[^)]+/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 297, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NOT|', + 'hashname' => '__PATTERN1__', + 'description' => '/NOT|/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 618, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_2_of_rule_search_condition', + 'matchrule' => 0, + 'implicit' => 'predicate, or \'(\'', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 618 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'cond', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's?', + 'lookahead' => 0, + 'line' => 618 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'search_condition', + 'vars' => '', + 'line' => 296 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_operator' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CONCAT', + 'hashname' => '__PATTERN1__', + 'description' => '/CONCAT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '||', + 'hashname' => '__STRING1__', + 'description' => '\'||\'', + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_operator', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'simple_when_clause' => bless( + { + 'impcount' => 1, + 'calls' => [ + 'expression', + '_alternation_1_of_production_1_of_rule_simple_when_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 509 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_simple_when_clause', + 'expected' => '/WHEN/i', + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 513 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'simple_when_clause', + 'vars' => '', + 'line' => 509 + }, + 'Parse::RecDescent::Rule' + ), + 'INNER' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'inner', + 'hashname' => '__PATTERN1__', + 'description' => '/inner/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 107, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'INNER', + 'vars' => '', + 'line' => 107 + }, + 'Parse::RecDescent::Rule' + ), + 'eofile' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '^\\Z', + 'hashname' => '__PATTERN1__', + 'description' => '/^\\\\Z/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 20, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'eofile', + 'vars' => '', + 'line' => 20 + }, + 'Parse::RecDescent::Rule' + ), + 'cond' => bless( + { + 'impcount' => 2, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_cond', + '_alternation_2_of_production_1_of_rule_cond' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_cond', + 'matchrule' => 0, + 'implicit' => '/AND/i, or /OR/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 620 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'NOT|', + 'hashname' => '__PATTERN1__', + 'description' => '/NOT|/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 620, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => '_alternation_2_of_production_1_of_rule_cond', + 'matchrule' => 0, + 'implicit' => 'predicate, or \'(\'', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 620 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'cond', + 'vars' => '', + 'line' => 620 + }, + 'Parse::RecDescent::Rule' + ), + 'ld_type' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'function', + 'expression', + 'constant', + 'column_name', + 'host_variable' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 482 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 483 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 483 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 483 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 483 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 484 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 484 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'column_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 485 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 485 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'host_variable', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 486 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 486 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'ld_type', + 'vars' => '', + 'line' => 482 + }, + 'Parse::RecDescent::Rule' + ), + 'RIGHT' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'right', + 'hashname' => '__PATTERN1__', + 'description' => '/right/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 111, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'RIGHT', + 'vars' => '', + 'line' => 111 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_method_invocation' => bless( + { + 'impcount' => 0, + 'calls' => ['expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'expression', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_method_invocation', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'LEFT' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'left', + 'hashname' => '__PATTERN1__', + 'description' => '/left/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 109, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'LEFT', + 'vars' => '', + 'line' => 109 + }, + 'Parse::RecDescent::Rule' + ), + 'table_name' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'SCHEMA', + 'NAME' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'SCHEMA', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 124 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '.', + 'hashname' => '__STRING1__', + 'description' => '\'.\'', + 'lookahead' => 0, + 'line' => 124 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 124 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 125, + 'code' => '{ $return = { schema => $item[1], name => $item[3] } }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 126 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 127, + 'code' => '{ $return = { name => $item[1] } }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => 126 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'table_name', + 'vars' => '', + 'line' => 124 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_53_of_rule_sysfun' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TRUNCATE', + 'hashname' => '__PATTERN1__', + 'description' => '/TRUNCATE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TRUNC', + 'hashname' => '__PATTERN1__', + 'description' => '/TRUNC/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_53_of_rule_sysfun', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'options' => bless( + { + 'impcount' => 1, + 'calls' => ['_alternation_1_of_production_1_of_rule_options'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'WITH', + 'hashname' => '__PATTERN1__', + 'description' => '/WITH/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 150, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_options', + 'matchrule' => 0, + 'implicit' => '/CASCADED/i, or /LOCAL/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 150 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'CHECK\\s+OPTION', + 'hashname' => '__PATTERN2__', + 'description' => '/CHECK\\\\s+OPTION/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 150, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'options', + 'vars' => '', + 'line' => 150 + }, + 'Parse::RecDescent::Rule' + ), + 'function' => bless( + { + 'impcount' => 1, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_function', + 'func_args' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'op' => [], + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_function', + 'matchrule' => 0, + 'implicit' => '/SYSIBM\\\\.|/i, or /SYSFUN\\\\.|/i, or userdefined_function', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 326 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 326 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'expected' => '', + 'min' => 1, + 'name' => '\'func_args(s)\'', + 'max' => 100000000, + 'leftarg' => bless( + { + 'subrule' => 'func_args', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 326 + }, + 'Parse::RecDescent::Subrule' + ), + 'rightarg' => bless( + { + 'subrule' => 'func_args', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 326 + }, + 'Parse::RecDescent::Subrule' + ), + 'hashname' => '__DIRECTIVE1__', + 'type' => 'leftop', + 'op' => bless( + { + 'pattern' => ',', + 'hashname' => '__PATTERN1__', + 'description' => '/,/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 326, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + }, + 'Parse::RecDescent::Operator' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 326 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'function', + 'vars' => '', + 'line' => 323 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_41_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'INTEGER', + 'hashname' => '__PATTERN1__', + 'description' => '/INTEGER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'INT', + 'hashname' => '__PATTERN1__', + 'description' => '/INT/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_41_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_case_expression' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'searched_when_clause', + 'simple_when_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'searched_when_clause', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'simple_when_clause', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_case_expression', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_window_order_clause' => bless( + { + 'impcount' => 1, + 'calls' => [ + 'sort_key_expression', + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'sort_key_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 624 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_window_order_clause', + 'expected' => 'asc_option, or desc_option', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_window_order_clause', + 'vars' => '', + 'line' => 624 + }, + 'Parse::RecDescent::Rule' + ), + 'create' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'CREATE', + 'TRIGGER', + 'trigger_name', + 'before', + 'type', + 'table_name', + 'reference_b', + 'triggered_action', + 'after', + 'reference_a', + 'VIEW', + 'view_name', + 'column_list', + 'with_expression', + 'SQL_procedure_statement' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'CREATE', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'TRIGGER', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'trigger_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'before', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'type', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'ON', + 'hashname' => '__PATTERN1__', + 'description' => '/ON/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 36, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'table_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'reference_b', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => 'FOR EACH ROW', + 'hashname' => '__PATTERN2__', + 'description' => '/FOR EACH ROW/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 36, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => 'MODE DB2SQL', + 'hashname' => '__STRING1__', + 'description' => '\'MODE DB2SQL\'', + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'triggered_action', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 36 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 37, + 'code' => '{ my $table_name = $item{\'table_name\'}{\'name\'}; $return = { table => $table_name, @@ -43658,118 +42469,157 @@ package SQL::Translator::Parser::DB2::Grammar; sub new { my $self = bless( { push @triggers, $return; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'CREATE', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'TRIGGER', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'trigger_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'after', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'type', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'ON', - 'hashname' => '__PATTERN1__', - 'description' => '/ON/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 55, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'table_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'reference_a', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => 'FOR EACH ROW|FOR EACH STATEMENT', - 'hashname' => '__PATTERN2__', - 'description' => '/FOR EACH ROW|FOR EACH STATEMENT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 55, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => 'MODE DB2SQL', - 'hashname' => '__STRING1__', - 'description' => '\'MODE DB2SQL\'', - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'triggered_action', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 55 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 56, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'CREATE', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'TRIGGER', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'trigger_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'after', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'type', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'ON', + 'hashname' => '__PATTERN1__', + 'description' => '/ON/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 55, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'table_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'reference_a', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => 'FOR EACH ROW|FOR EACH STATEMENT', + 'hashname' => '__PATTERN2__', + 'description' => '/FOR EACH ROW|FOR EACH STATEMENT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 55, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => 'MODE DB2SQL', + 'hashname' => '__STRING1__', + 'description' => '\'MODE DB2SQL\'', + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'triggered_action', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 55 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 56, + 'code' => '{ my $table_name = $item{\'table_name\'}{\'name\'}; $return = { table => $table_name, @@ -43786,98 +42636,128 @@ package SQL::Translator::Parser::DB2::Grammar; sub new { my $self = bless( { push @triggers, $return; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'CREATE', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'FEDERATED|', - 'hashname' => '__PATTERN1__', - 'description' => '/FEDERATED|/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 74, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'VIEW', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'view_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'column_list', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'pattern' => 'AS', - 'hashname' => '__PATTERN2__', - 'description' => '/AS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 74, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'with_expression', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'SQL_procedure_statement', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 74 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 75, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'CREATE', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 74 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'FEDERATED|', + 'hashname' => '__PATTERN1__', + 'description' => '/FEDERATED|/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 74, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'VIEW', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 74 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'view_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 74 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'column_list', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 74 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'pattern' => 'AS', + 'hashname' => '__PATTERN2__', + 'description' => '/AS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 74, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'with_expression', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 74 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => 'SQL_procedure_statement', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 74 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 75, + 'code' => '{ $return = { name => $item{view_name}{name}, sql => $item{SQL_procedure_statement}, @@ -43886,4070 +42766,5204 @@ package SQL::Translator::Parser::DB2::Grammar; sub new { my $self = bless( { }; push @views, $return; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'create', - 'vars' => '', - 'line' => 36 - }, 'Parse::RecDescent::Rule' ), - 'sysfun' => bless( { - 'impcount' => 0, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_sysfun', - '_alternation_1_of_production_7_of_rule_sysfun', - 'I', - '_alternation_1_of_production_53_of_rule_sysfun' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_sysfun', - 'matchrule' => 0, - 'implicit' => '/ABS/i, or /ABSVAL/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 421 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ACOS', - 'hashname' => '__PATTERN1__', - 'description' => '/ACOS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 422, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 422 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ASCII', - 'hashname' => '__PATTERN1__', - 'description' => '/ASCII/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 423, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 423 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ASIN', - 'hashname' => '__PATTERN1__', - 'description' => '/ASIN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 424, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 424 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ATAN', - 'hashname' => '__PATTERN1__', - 'description' => '/ATAN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 425, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 425 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '5', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ATAN2', - 'hashname' => '__PATTERN1__', - 'description' => '/ATAN2/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 426, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 426 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '6', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_7_of_rule_sysfun', - 'matchrule' => 0, - 'implicit' => '/CEIL/i, or /CEILING/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 427 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 427 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '7', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CHAR', - 'hashname' => '__PATTERN1__', - 'description' => '/CHAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 428, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 428 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '8', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CHR', - 'hashname' => '__PATTERN1__', - 'description' => '/CHR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 429, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 429 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '9', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'COS', - 'hashname' => '__PATTERN1__', - 'description' => '/COS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 430, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 430 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '10', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'COT', - 'hashname' => '__PATTERN1__', - 'description' => '/COT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 431, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 431 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '11', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DAYNAME', - 'hashname' => '__PATTERN1__', - 'description' => '/DAYNAME/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 432, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 432 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '12', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DAYOFWEEK', - 'hashname' => '__PATTERN1__', - 'description' => '/DAYOFWEEK/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 433, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 433 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '13', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DAYOFWEEK_ISO', - 'hashname' => '__PATTERN1__', - 'description' => '/DAYOFWEEK_ISO/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 434, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 434 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '14', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DAYOFYEAR', - 'hashname' => '__PATTERN1__', - 'description' => '/DAYOFYEAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 435, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 435 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '15', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DEGREES', - 'hashname' => '__PATTERN1__', - 'description' => '/DEGREES/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 436, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 436 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '16', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DIFFERENCE', - 'hashname' => '__PATTERN1__', - 'description' => '/DIFFERENCE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 437, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 437 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '17', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DOUBLE', - 'hashname' => '__PATTERN1__', - 'description' => '/DOUBLE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 438, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 438 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '18', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'EXP', - 'hashname' => '__PATTERN1__', - 'description' => '/EXP/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 439, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 439 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '19', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'FLOOR', - 'hashname' => '__PATTERN1__', - 'description' => '/FLOOR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 440, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 440 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '20', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'GET_ROUTINE_SAR', - 'hashname' => '__PATTERN1__', - 'description' => '/GET_ROUTINE_SAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 441, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 441 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '21', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'INSERT', - 'hashname' => '__PATTERN1__', - 'description' => '/INSERT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 442, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 442 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '22', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'JULIAN_DAY', - 'hashname' => '__PATTERN1__', - 'description' => '/JULIAN_DAY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 443, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 443 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '23', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LCASE', - 'hashname' => '__PATTERN1__', - 'description' => '/LCASE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 444, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 444 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '24', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LEFT', - 'hashname' => '__PATTERN1__', - 'description' => '/LEFT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 445, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 445 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '25', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LN', - 'hashname' => '__PATTERN1__', - 'description' => '/LN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 446, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 446 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '26', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LOCATE', - 'hashname' => '__PATTERN1__', - 'description' => '/LOCATE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 447, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 447 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '27', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LOG', - 'hashname' => '__PATTERN1__', - 'description' => '/LOG/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 448, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 448 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '28', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LOG10', - 'hashname' => '__PATTERN1__', - 'description' => '/LOG10/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 449, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 449 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '29', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LTRIM', - 'hashname' => '__PATTERN1__', - 'description' => '/LTRIM/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 450, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 450 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '30', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MIDNIGHT_SECONDS', - 'hashname' => '__PATTERN1__', - 'description' => '/MIDNIGHT_SECONDS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 451, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 451 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '31', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MOD', - 'hashname' => '__PATTERN1__', - 'description' => '/MOD/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 452, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 452 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '32', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'MONTHNAME', - 'hashname' => '__PATTERN1__', - 'description' => '/MONTHNAME/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 453, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 453 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '33', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'POWER', - 'hashname' => '__PATTERN1__', - 'description' => '/POWER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 454, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 454 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '34', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'PUT_ROUTINE_SAR', - 'hashname' => '__PATTERN1__', - 'description' => '/PUT_ROUTINE_SAR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 455, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 455 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '35', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'QUARTER', - 'hashname' => '__PATTERN1__', - 'description' => '/QUARTER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 456, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 456 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '36', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RADIANS', - 'hashname' => '__PATTERN1__', - 'description' => '/RADIANS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 457, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 457 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '37', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RAND', - 'hashname' => '__PATTERN1__', - 'description' => '/RAND/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 458, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 458 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '38', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REPEAT', - 'hashname' => '__PATTERN1__', - 'description' => '/REPEAT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 459, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 459 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '39', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REPLACE', - 'hashname' => '__PATTERN1__', - 'description' => '/REPLACE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 460, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 460 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '40', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RIGHT', - 'hashname' => '__PATTERN1__', - 'description' => '/RIGHT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 461, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 461 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '41', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ROUND', - 'hashname' => '__PATTERN1__', - 'description' => '/ROUND/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 462, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 462 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '42', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RTRIM', - 'hashname' => '__PATTERN1__', - 'description' => '/RTRIM/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 463, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'I', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 463 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 463 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '43', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SIGN', - 'hashname' => '__PATTERN1__', - 'description' => '/SIGN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 464, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 464 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '44', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SIN', - 'hashname' => '__PATTERN1__', - 'description' => '/SIN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 465, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 465 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '45', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SOUNDEX', - 'hashname' => '__PATTERN1__', - 'description' => '/SOUNDEX/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 466, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 466 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '46', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SPACE', - 'hashname' => '__PATTERN1__', - 'description' => '/SPACE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 467, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 467 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '47', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SQLCACHE_SNAPSHOT', - 'hashname' => '__PATTERN1__', - 'description' => '/SQLCACHE_SNAPSHOT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 468, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 468 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '48', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SQRT', - 'hashname' => '__PATTERN1__', - 'description' => '/SQRT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 469, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 469 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '49', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TAN', - 'hashname' => '__PATTERN1__', - 'description' => '/TAN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 470, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 470 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '50', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TIMESTAMP_ISO', - 'hashname' => '__PATTERN1__', - 'description' => '/TIMESTAMP_ISO/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 471, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 471 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '51', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TIMESTAMPDIFF', - 'hashname' => '__PATTERN1__', - 'description' => '/TIMESTAMPDIFF/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 472, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 472 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '52', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_53_of_rule_sysfun', - 'matchrule' => 0, - 'implicit' => '/TRUNCATE/i, or /TRUNC/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 473 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 473 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '53', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UCASE', - 'hashname' => '__PATTERN1__', - 'description' => '/UCASE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 474, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 474 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '54', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'WEEK', - 'hashname' => '__PATTERN1__', - 'description' => '/WEEK/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 475, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 475 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '55', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'WEEK_ISO', - 'hashname' => '__PATTERN1__', - 'description' => '/WEEK_ISO/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 476, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 476 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'sysfun', - 'vars' => '', - 'line' => 421 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond' => bless( { - 'impcount' => 0, - 'calls' => [ - 'numeric_constant' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SELECTIVITY', - 'hashname' => '__PATTERN1__', - 'description' => '/SELECTIVITY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'numeric_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'NAME' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '\\w+', - 'hashname' => '__PATTERN1__', - 'description' => '/\\\\w+/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 146, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '\\w{1,18}', - 'hashname' => '__PATTERN1__', - 'description' => '/\\\\w\\{1,18\\}/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 148, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'NAME', - 'vars' => '', - 'line' => 146 - }, 'Parse::RecDescent::Rule' ), - 'constant' => bless( { - 'impcount' => 0, - 'calls' => [ - 'int_const', - 'float_const', - 'dec_const', - 'char_const', - 'hex_const', - 'grastr_const' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'int_const', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 328 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'float_const', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 328 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 328 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'dec_const', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 328 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 328 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'char_const', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 328 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 328 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'hex_const', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 328 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 328 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '5', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'grastr_const', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 328 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 328 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'constant', - 'vars' => '', - 'line' => 328 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_ranking_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'RANK', - 'hashname' => '__PATTERN1__', - 'description' => '/RANK/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '()', - 'hashname' => '__STRING1__', - 'description' => '\'()\'', - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DENSE_RANK|DENSERANK', - 'hashname' => '__PATTERN1__', - 'description' => '/DENSE_RANK|DENSERANK/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 627, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '()', - 'hashname' => '__STRING1__', - 'description' => '\'()\'', - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_ranking_function', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'window_aggregation_group_clause' => bless( { - 'impcount' => 2, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause', - '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause', - 'matchrule' => 0, - 'implicit' => '/ROWS/i, or /RANGE/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 568 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause', - 'matchrule' => 0, - 'implicit' => 'group_start, or group_between, or group_end', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 572 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'window_aggregation_group_clause', - 'vars' => '', - 'line' => 566 - }, 'Parse::RecDescent::Rule' ), - '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause' => bless( { - 'impcount' => 0, - 'calls' => [ - 'group_start', - 'group_between', - 'group_end' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'group_start', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 625 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'group_between', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 626 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'group_end', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause', - 'vars' => '', - 'line' => 625 - }, 'Parse::RecDescent::Rule' ), - 'VIEW' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'view', - 'hashname' => '__PATTERN1__', - 'description' => '/view/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 105, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'VIEW', - 'vars' => '', - 'line' => 105 - }, 'Parse::RecDescent::Rule' ), - 'with_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'common_table_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'op' => [], - 'items' => [ - bless( { - 'pattern' => 'WITH', - 'hashname' => '__PATTERN1__', - 'description' => '/WITH/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 89, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'expected' => '', - 'min' => 1, - 'name' => '\'common_table_expression(s)\'', - 'max' => 100000000, - 'leftarg' => bless( { - 'subrule' => 'common_table_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 89 - }, 'Parse::RecDescent::Subrule' ), - 'rightarg' => bless( { - 'subrule' => 'common_table_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 89 - }, 'Parse::RecDescent::Subrule' ), - 'hashname' => '__DIRECTIVE1__', - 'type' => 'leftop', - 'op' => bless( { - 'pattern' => ',', - 'hashname' => '__PATTERN2__', - 'description' => '/,/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 89, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - }, 'Parse::RecDescent::Operator' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 90, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'create', + 'vars' => '', + 'line' => 36 + }, + 'Parse::RecDescent::Rule' + ), + 'sysfun' => bless( + { + 'impcount' => 0, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_sysfun', + '_alternation_1_of_production_7_of_rule_sysfun', + 'I', + '_alternation_1_of_production_53_of_rule_sysfun' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_sysfun', + 'matchrule' => 0, + 'implicit' => '/ABS/i, or /ABSVAL/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 421 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ACOS', + 'hashname' => '__PATTERN1__', + 'description' => '/ACOS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 422, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 422 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ASCII', + 'hashname' => '__PATTERN1__', + 'description' => '/ASCII/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 423, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 423 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ASIN', + 'hashname' => '__PATTERN1__', + 'description' => '/ASIN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 424, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 424 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ATAN', + 'hashname' => '__PATTERN1__', + 'description' => '/ATAN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 425, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 425 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '5', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ATAN2', + 'hashname' => '__PATTERN1__', + 'description' => '/ATAN2/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 426, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 426 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '6', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_7_of_rule_sysfun', + 'matchrule' => 0, + 'implicit' => '/CEIL/i, or /CEILING/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 427 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 427 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '7', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CHAR', + 'hashname' => '__PATTERN1__', + 'description' => '/CHAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 428, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 428 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '8', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CHR', + 'hashname' => '__PATTERN1__', + 'description' => '/CHR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 429, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 429 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '9', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'COS', + 'hashname' => '__PATTERN1__', + 'description' => '/COS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 430, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 430 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '10', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'COT', + 'hashname' => '__PATTERN1__', + 'description' => '/COT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 431, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 431 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '11', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DAYNAME', + 'hashname' => '__PATTERN1__', + 'description' => '/DAYNAME/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 432, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 432 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '12', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DAYOFWEEK', + 'hashname' => '__PATTERN1__', + 'description' => '/DAYOFWEEK/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 433, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 433 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '13', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DAYOFWEEK_ISO', + 'hashname' => '__PATTERN1__', + 'description' => '/DAYOFWEEK_ISO/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 434, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 434 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '14', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DAYOFYEAR', + 'hashname' => '__PATTERN1__', + 'description' => '/DAYOFYEAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 435, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 435 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '15', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DEGREES', + 'hashname' => '__PATTERN1__', + 'description' => '/DEGREES/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 436, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 436 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '16', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DIFFERENCE', + 'hashname' => '__PATTERN1__', + 'description' => '/DIFFERENCE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 437, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 437 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '17', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DOUBLE', + 'hashname' => '__PATTERN1__', + 'description' => '/DOUBLE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 438, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 438 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '18', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'EXP', + 'hashname' => '__PATTERN1__', + 'description' => '/EXP/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 439, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 439 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '19', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'FLOOR', + 'hashname' => '__PATTERN1__', + 'description' => '/FLOOR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 440, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 440 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '20', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'GET_ROUTINE_SAR', + 'hashname' => '__PATTERN1__', + 'description' => '/GET_ROUTINE_SAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 441, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 441 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '21', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'INSERT', + 'hashname' => '__PATTERN1__', + 'description' => '/INSERT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 442, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 442 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '22', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'JULIAN_DAY', + 'hashname' => '__PATTERN1__', + 'description' => '/JULIAN_DAY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 443, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 443 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '23', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LCASE', + 'hashname' => '__PATTERN1__', + 'description' => '/LCASE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 444, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 444 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '24', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LEFT', + 'hashname' => '__PATTERN1__', + 'description' => '/LEFT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 445, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 445 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '25', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LN', + 'hashname' => '__PATTERN1__', + 'description' => '/LN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 446, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 446 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '26', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LOCATE', + 'hashname' => '__PATTERN1__', + 'description' => '/LOCATE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 447, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 447 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '27', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LOG', + 'hashname' => '__PATTERN1__', + 'description' => '/LOG/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 448, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 448 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '28', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LOG10', + 'hashname' => '__PATTERN1__', + 'description' => '/LOG10/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 449, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 449 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '29', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LTRIM', + 'hashname' => '__PATTERN1__', + 'description' => '/LTRIM/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 450, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 450 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '30', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MIDNIGHT_SECONDS', + 'hashname' => '__PATTERN1__', + 'description' => '/MIDNIGHT_SECONDS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 451, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 451 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '31', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MOD', + 'hashname' => '__PATTERN1__', + 'description' => '/MOD/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 452, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 452 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '32', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'MONTHNAME', + 'hashname' => '__PATTERN1__', + 'description' => '/MONTHNAME/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 453, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 453 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '33', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'POWER', + 'hashname' => '__PATTERN1__', + 'description' => '/POWER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 454, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 454 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '34', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'PUT_ROUTINE_SAR', + 'hashname' => '__PATTERN1__', + 'description' => '/PUT_ROUTINE_SAR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 455, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 455 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '35', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'QUARTER', + 'hashname' => '__PATTERN1__', + 'description' => '/QUARTER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 456, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 456 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '36', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RADIANS', + 'hashname' => '__PATTERN1__', + 'description' => '/RADIANS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 457, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 457 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '37', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RAND', + 'hashname' => '__PATTERN1__', + 'description' => '/RAND/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 458, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 458 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '38', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REPEAT', + 'hashname' => '__PATTERN1__', + 'description' => '/REPEAT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 459, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 459 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '39', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REPLACE', + 'hashname' => '__PATTERN1__', + 'description' => '/REPLACE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 460, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 460 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '40', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RIGHT', + 'hashname' => '__PATTERN1__', + 'description' => '/RIGHT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 461, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 461 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '41', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ROUND', + 'hashname' => '__PATTERN1__', + 'description' => '/ROUND/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 462, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 462 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '42', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RTRIM', + 'hashname' => '__PATTERN1__', + 'description' => '/RTRIM/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 463, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'I', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 463 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 463 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '43', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SIGN', + 'hashname' => '__PATTERN1__', + 'description' => '/SIGN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 464, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 464 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '44', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SIN', + 'hashname' => '__PATTERN1__', + 'description' => '/SIN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 465, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 465 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '45', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SOUNDEX', + 'hashname' => '__PATTERN1__', + 'description' => '/SOUNDEX/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 466, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 466 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '46', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SPACE', + 'hashname' => '__PATTERN1__', + 'description' => '/SPACE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 467, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 467 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '47', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SQLCACHE_SNAPSHOT', + 'hashname' => '__PATTERN1__', + 'description' => '/SQLCACHE_SNAPSHOT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 468, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 468 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '48', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SQRT', + 'hashname' => '__PATTERN1__', + 'description' => '/SQRT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 469, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 469 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '49', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TAN', + 'hashname' => '__PATTERN1__', + 'description' => '/TAN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 470, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 470 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '50', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TIMESTAMP_ISO', + 'hashname' => '__PATTERN1__', + 'description' => '/TIMESTAMP_ISO/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 471, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 471 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '51', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TIMESTAMPDIFF', + 'hashname' => '__PATTERN1__', + 'description' => '/TIMESTAMPDIFF/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 472, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 472 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '52', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_53_of_rule_sysfun', + 'matchrule' => 0, + 'implicit' => '/TRUNCATE/i, or /TRUNC/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 473 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 473 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '53', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UCASE', + 'hashname' => '__PATTERN1__', + 'description' => '/UCASE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 474, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 474 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '54', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'WEEK', + 'hashname' => '__PATTERN1__', + 'description' => '/WEEK/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 475, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 475 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '55', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'WEEK_ISO', + 'hashname' => '__PATTERN1__', + 'description' => '/WEEK_ISO/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 476, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 476 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'sysfun', + 'vars' => '', + 'line' => 421 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond' => bless( + { + 'impcount' => 0, + 'calls' => ['numeric_constant'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SELECTIVITY', + 'hashname' => '__PATTERN1__', + 'description' => '/SELECTIVITY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'numeric_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule__alternation_2_of_production_1_of_rule_cond', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'NAME' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '\\w+', + 'hashname' => '__PATTERN1__', + 'description' => '/\\\\w+/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 146, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '\\w{1,18}', + 'hashname' => '__PATTERN1__', + 'description' => '/\\\\w\\{1,18\\}/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 148, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'NAME', + 'vars' => '', + 'line' => 146 + }, + 'Parse::RecDescent::Rule' + ), + 'constant' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'int_const', + 'float_const', + 'dec_const', + 'char_const', + 'hex_const', + 'grastr_const' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'int_const', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 328 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'float_const', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 328 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 328 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'dec_const', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 328 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 328 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'char_const', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 328 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 328 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'hex_const', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 328 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 328 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '5', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'grastr_const', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 328 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 328 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'constant', + 'vars' => '', + 'line' => 328 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_ranking_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'RANK', + 'hashname' => '__PATTERN1__', + 'description' => '/RANK/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '()', + 'hashname' => '__STRING1__', + 'description' => '\'()\'', + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DENSE_RANK|DENSERANK', + 'hashname' => '__PATTERN1__', + 'description' => '/DENSE_RANK|DENSERANK/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 627, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '()', + 'hashname' => '__STRING1__', + 'description' => '\'()\'', + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_ranking_function', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'window_aggregation_group_clause' => bless( + { + 'impcount' => 2, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause', + '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_window_aggregation_group_clause', + 'matchrule' => 0, + 'implicit' => '/ROWS/i, or /RANGE/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 568 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause', + 'matchrule' => 0, + 'implicit' => 'group_start, or group_between, or group_end', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 572 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'window_aggregation_group_clause', + 'vars' => '', + 'line' => 566 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'group_start', + 'group_between', + 'group_end' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'group_start', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 625 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'group_between', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 626 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'group_end', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_2_of_production_1_of_rule_window_aggregation_group_clause', + 'vars' => '', + 'line' => 625 + }, + 'Parse::RecDescent::Rule' + ), + 'VIEW' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'view', + 'hashname' => '__PATTERN1__', + 'description' => '/view/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 105, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'VIEW', + 'vars' => '', + 'line' => 105 + }, + 'Parse::RecDescent::Rule' + ), + 'with_expression' => bless( + { + 'impcount' => 0, + 'calls' => ['common_table_expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'op' => [], + 'items' => [ + bless( + { + 'pattern' => 'WITH', + 'hashname' => '__PATTERN1__', + 'description' => '/WITH/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 89, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'expected' => '', + 'min' => 1, + 'name' => '\'common_table_expression(s)\'', + 'max' => 100000000, + 'leftarg' => bless( + { + 'subrule' => 'common_table_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 89 + }, + 'Parse::RecDescent::Subrule' + ), + 'rightarg' => bless( + { + 'subrule' => 'common_table_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 89 + }, + 'Parse::RecDescent::Subrule' + ), + 'hashname' => '__DIRECTIVE1__', + 'type' => 'leftop', + 'op' => bless( + { + 'pattern' => ',', + 'hashname' => '__PATTERN2__', + 'description' => '/,/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 89, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + }, + 'Parse::RecDescent::Operator' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 90, + 'code' => '{ $return = $item{\'common_table_expression\'}; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'with_expression', - 'vars' => '', - 'line' => 87 - }, 'Parse::RecDescent::Rule' ), - 'numeric_constant' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '\\d+', - 'hashname' => '__PATTERN1__', - 'description' => '/\\\\d+/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 140, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'numeric_constant', - 'vars' => '', - 'line' => 140 - }, 'Parse::RecDescent::Rule' ), - 'old_new_table' => bless( { - 'impcount' => 0, - 'calls' => [ - 'identifier' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => 'OLD_TABLE', - 'hashname' => '__PATTERN1__', - 'description' => '/OLD_TABLE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 291, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(AS)?', - 'hashname' => '__PATTERN2__', - 'description' => '/(AS)?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 291, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'identifier', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 291 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 292, - 'code' => '{ $return = join(\' \', @item[1..3] ) }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => 'NEW_TABLE', - 'hashname' => '__PATTERN1__', - 'description' => '/NEW_TABLE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 293, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(AS)?', - 'hashname' => '__PATTERN2__', - 'description' => '/(AS)?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 293, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'identifier', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 293 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 294, - 'code' => '{ $return = join(\' \', @item[1..3] ) }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 293 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'old_new_table', - 'vars' => '', - 'line' => 291 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_numbering_function' => bless( { - 'impcount' => 0, - 'calls' => [ - 'window_order_clause', - 'window_aggregation_group_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'window_order_clause', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'window_aggregation_group_clause', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_numbering_function', - 'vars' => '', - 'line' => 627 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause' => bless( { - 'impcount' => 0, - 'calls' => [ - 'result_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'result_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULL', - 'hashname' => '__PATTERN1__', - 'description' => '/NULL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 627, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause', - 'vars' => '', - 'line' => 626 - }, 'Parse::RecDescent::Rule' ), - 'old_new_corr' => bless( { - 'impcount' => 0, - 'calls' => [ - 'correlation_name' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => 'OLD', - 'hashname' => '__PATTERN1__', - 'description' => '/OLD/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 286, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(AS)?', - 'hashname' => '__PATTERN2__', - 'description' => '/(AS)?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 286, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'correlation_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 286 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 287, - 'code' => '{ $return = join(\' \', @item[1..3] ) }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => 'NEW', - 'hashname' => '__PATTERN1__', - 'description' => '/NEW/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 288, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(AS)?', - 'hashname' => '__PATTERN2__', - 'description' => '/(AS)?/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 288, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'correlation_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 288 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 289, - 'code' => '{ $return = join(\' \', @item[1..3] ) }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => 288 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'old_new_corr', - 'vars' => '', - 'line' => 286 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_42_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LCASE', - 'hashname' => '__PATTERN1__', - 'description' => '/LCASE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'LOWER', - 'hashname' => '__PATTERN1__', - 'description' => '/LOWER/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_42_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'subtype_treatment' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression', - 'data_type' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'TREAT', - 'hashname' => '__PATTERN1__', - 'description' => '/TREAT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 606, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 606 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 606 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'AS', - 'hashname' => '__PATTERN2__', - 'description' => '/AS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 606, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'data_type', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 606 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 606 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'subtype_treatment', - 'vars' => '', - 'line' => 606 - }, 'Parse::RecDescent::Rule' ), - 'expression' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_expression' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'op' => [], - 'items' => [ - bless( { - 'expected' => '', - 'min' => 1, - 'name' => '\'_alternation_1_of_production_1_of_rule_expression(s)\'', - 'max' => 100000000, - 'leftarg' => bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_expression', - 'matchrule' => 0, - 'implicit' => '\'+\', or \'-\'', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 319 - }, 'Parse::RecDescent::Subrule' ), - 'rightarg' => bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_expression', - 'matchrule' => 0, - 'implicit' => '\'+\', or \'-\'', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 319 - }, 'Parse::RecDescent::Subrule' ), - 'hashname' => '__DIRECTIVE1__', - 'type' => 'leftop', - 'op' => bless( { - 'pattern' => 'operator', - 'hashname' => '__PATTERN1__', - 'description' => '/operator/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 319, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - }, 'Parse::RecDescent::Operator' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'expression', - 'vars' => '', - 'line' => 299 - }, 'Parse::RecDescent::Rule' ), - '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'function', - 'expression', - 'constant', - 'column_name', - 'host_variable', - 'special_register', - 'scalar_fullselect', - 'labeled_duration', - 'case_expression', - 'cast_specification', - 'OLAP_function', - 'method_invocation', - 'subtype_treatment', - 'sequence_reference' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 613 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 614 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 614 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 614 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 614 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 615 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 615 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '3', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'column_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 616 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 616 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '4', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'host_variable', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 617 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 617 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '5', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'special_register', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 618 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 618 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '6', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 619 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'scalar_fullselect', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 619 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 619 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => 619 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '7', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'labeled_duration', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 620 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 620 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '8', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'case_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 621 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 621 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '9', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'cast_specification', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 622 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 622 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '10', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'OLAP_function', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 624 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 623 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '11', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'method_invocation', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 625 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 625 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '12', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'subtype_treatment', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 626 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 626 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '13', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'sequence_reference', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', - 'vars' => '', - 'line' => 613 - }, 'Parse::RecDescent::Rule' ), - 'startrule' => bless( { - 'impcount' => 0, - 'calls' => [ - 'statement', - 'eofile' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 1, - 'items' => [ - bless( { - 'subrule' => 'statement', - 'expected' => undef, - 'min' => 1, - 'argcode' => undef, - 'max' => 100000000, - 'matchrule' => 0, - 'repspec' => 's', - 'lookahead' => 0, - 'line' => 12 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'eofile', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 12 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 12, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'with_expression', + 'vars' => '', + 'line' => 87 + }, + 'Parse::RecDescent::Rule' + ), + 'numeric_constant' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '\\d+', + 'hashname' => '__PATTERN1__', + 'description' => '/\\\\d+/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 140, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'numeric_constant', + 'vars' => '', + 'line' => 140 + }, + 'Parse::RecDescent::Rule' + ), + 'old_new_table' => bless( + { + 'impcount' => 0, + 'calls' => ['identifier'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => 'OLD_TABLE', + 'hashname' => '__PATTERN1__', + 'description' => '/OLD_TABLE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 291, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(AS)?', + 'hashname' => '__PATTERN2__', + 'description' => '/(AS)?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 291, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'identifier', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 291 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 292, + 'code' => '{ $return = join(\' \', @item[1..3] ) }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => 'NEW_TABLE', + 'hashname' => '__PATTERN1__', + 'description' => '/NEW_TABLE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 293, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(AS)?', + 'hashname' => '__PATTERN2__', + 'description' => '/(AS)?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 293, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'identifier', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 293 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 294, + 'code' => '{ $return = join(\' \', @item[1..3] ) }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => 293 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'old_new_table', + 'vars' => '', + 'line' => 291 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_numbering_function' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'window_order_clause', + 'window_aggregation_group_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'window_order_clause', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'window_aggregation_group_clause', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_numbering_function', + 'vars' => '', + 'line' => 627 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause' => + bless( + { + 'impcount' => 0, + 'calls' => ['result_expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'result_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULL', + 'hashname' => '__PATTERN1__', + 'description' => '/NULL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 627, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_searched_when_clause', + 'vars' => '', + 'line' => 626 + }, + 'Parse::RecDescent::Rule' + ), + 'old_new_corr' => bless( + { + 'impcount' => 0, + 'calls' => ['correlation_name'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => 'OLD', + 'hashname' => '__PATTERN1__', + 'description' => '/OLD/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 286, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(AS)?', + 'hashname' => '__PATTERN2__', + 'description' => '/(AS)?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 286, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'correlation_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 286 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 287, + 'code' => '{ $return = join(\' \', @item[1..3] ) }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => 'NEW', + 'hashname' => '__PATTERN1__', + 'description' => '/NEW/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 288, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(AS)?', + 'hashname' => '__PATTERN2__', + 'description' => '/(AS)?/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 288, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'correlation_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 288 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 289, + 'code' => '{ $return = join(\' \', @item[1..3] ) }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => 288 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'old_new_corr', + 'vars' => '', + 'line' => 286 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_42_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LCASE', + 'hashname' => '__PATTERN1__', + 'description' => '/LCASE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'LOWER', + 'hashname' => '__PATTERN1__', + 'description' => '/LOWER/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_42_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'subtype_treatment' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'expression', + 'data_type' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'TREAT', + 'hashname' => '__PATTERN1__', + 'description' => '/TREAT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 606, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 606 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 606 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'AS', + 'hashname' => '__PATTERN2__', + 'description' => '/AS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 606, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'data_type', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 606 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 606 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'subtype_treatment', + 'vars' => '', + 'line' => 606 + }, + 'Parse::RecDescent::Rule' + ), + 'expression' => bless( + { + 'impcount' => 1, + 'calls' => ['_alternation_1_of_production_1_of_rule_expression'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'op' => [], + 'items' => [ + bless( + { + 'expected' => '', + 'min' => 1, + 'name' => '\'_alternation_1_of_production_1_of_rule_expression(s)\'', + 'max' => 100000000, + 'leftarg' => bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_expression', + 'matchrule' => 0, + 'implicit' => '\'+\', or \'-\'', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 319 + }, + 'Parse::RecDescent::Subrule' + ), + 'rightarg' => bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_expression', + 'matchrule' => 0, + 'implicit' => '\'+\', or \'-\'', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 319 + }, + 'Parse::RecDescent::Subrule' + ), + 'hashname' => '__DIRECTIVE1__', + 'type' => 'leftop', + 'op' => bless( + { + 'pattern' => 'operator', + 'hashname' => '__PATTERN1__', + 'description' => '/operator/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 319, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + }, + 'Parse::RecDescent::Operator' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'expression', + 'vars' => '', + 'line' => 299 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'function', + 'expression', + 'constant', + 'column_name', + 'host_variable', + 'special_register', + 'scalar_fullselect', + 'labeled_duration', + 'case_expression', + 'cast_specification', + 'OLAP_function', + 'method_invocation', + 'subtype_treatment', + 'sequence_reference' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 613 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 614 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 614 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 614 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 614 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 615 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 615 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '3', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'column_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 616 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 616 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '4', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'host_variable', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 617 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 617 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '5', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'special_register', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 618 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 618 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '6', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 619 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'scalar_fullselect', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 619 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 619 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => 619 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '7', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'labeled_duration', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 620 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 620 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '8', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'case_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 621 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 621 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '9', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'cast_specification', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 622 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 622 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '10', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'OLAP_function', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 624 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 623 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '11', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'method_invocation', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 625 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 625 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '12', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'subtype_treatment', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 626 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 626 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '13', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'sequence_reference', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_2_of_production_1_of_rule__alternation_1_of_production_1_of_rule_expression', + 'vars' => '', + 'line' => 613 + }, + 'Parse::RecDescent::Rule' + ), + 'startrule' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'statement', + 'eofile' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 1, + 'items' => [ + bless( + { + 'subrule' => 'statement', + 'expected' => undef, + 'min' => 1, + 'argcode' => undef, + 'max' => 100000000, + 'matchrule' => 0, + 'repspec' => 's', + 'lookahead' => 0, + 'line' => 12 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => 'eofile', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 12 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 12, + 'code' => '{ $return = { tables => \\%tables, views => \\@views, triggers => \\@triggers, } }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'startrule', - 'vars' => '', - 'line' => 11 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_cast_specification' => bless( { - 'impcount' => 0, - 'calls' => [ - 'expression', - 'parameter_marker' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 625 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NULL', - 'hashname' => '__PATTERN1__', - 'description' => '/NULL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 626, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 626 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'parameter_marker', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => 627 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_cast_specification', - 'vars' => '', - 'line' => 625 - }, 'Parse::RecDescent::Rule' ), - 'before' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NO CASCADE BEFORE', - 'hashname' => '__PATTERN1__', - 'description' => '/NO CASCADE BEFORE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 268, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'before', - 'vars' => '', - 'line' => 268 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_83_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UCASE', - 'hashname' => '__PATTERN1__', - 'description' => '/UCASE/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UPPER', - 'hashname' => '__PATTERN1__', - 'description' => '/UPPER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_83_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'ranking_function' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_ranking_function', - 'window_partition_clause', - 'window_order_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_ranking_function', - 'matchrule' => 0, - 'implicit' => '/RANK/, or /DENSE_RANK|DENSERANK/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 544 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'OVER', - 'hashname' => '__PATTERN1__', - 'description' => '/OVER/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 544, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 544 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'window_partition_clause', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 544 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'subrule' => 'window_order_clause', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 544 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 544 - }, 'Parse::RecDescent::Literal' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'ranking_function', - 'vars' => '', - 'line' => 542 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition' => bless( { - 'impcount' => 0, - 'calls' => [ - 'numeric_constant' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'SELECTIVITY', - 'hashname' => '__PATTERN1__', - 'description' => '/SELECTIVITY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'numeric_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 628 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ABS', - 'hashname' => '__PATTERN1__', - 'description' => '/ABS/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'ABSVAL', - 'hashname' => '__PATTERN1__', - 'description' => '/ABSVAL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'reference_b' => bless( { - 'impcount' => 0, - 'calls' => [ - 'old_new_corr' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => 'REFERENCING', - 'hashname' => '__PATTERN1__', - 'description' => '/REFERENCING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 280, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'old_new_corr', - 'expected' => undef, - 'min' => 0, - 'argcode' => undef, - 'max' => 2, - 'matchrule' => 0, - 'repspec' => '0..2', - 'lookahead' => 0, - 'line' => 280 - }, 'Parse::RecDescent::Repetition' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 281, - 'code' => '{ $return = join(\' \', $item[1], join(\' \', @{$item[2]}) ) }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'reference_b', - 'vars' => '', - 'line' => 280 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_1_of_rule_simple_when_clause' => bless( { - 'impcount' => 1, - 'calls' => [ - 'search_condition', - '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'WHEN', - 'hashname' => '__PATTERN1__', - 'description' => '/WHEN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 624, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'search_condition', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 624 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'THEN', - 'hashname' => '__PATTERN2__', - 'description' => '/THEN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 624, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause', - 'matchrule' => 0, - 'implicit' => 'result_expression, or /NULL/i', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 627 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_1_of_rule_simple_when_clause', - 'vars' => '', - 'line' => 624 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_9_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CORRELATION', - 'hashname' => '__PATTERN1__', - 'description' => '/CORRELATION/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CORR', - 'hashname' => '__PATTERN1__', - 'description' => '/CORR/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_9_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_7_of_rule_sysfun' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CEIL', - 'hashname' => '__PATTERN1__', - 'description' => '/CEIL/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CEILING', - 'hashname' => '__PATTERN1__', - 'description' => '/CEILING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_7_of_rule_sysfun', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'prevval_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'sequence_name' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'PREVVAL\\s+FOR', - 'hashname' => '__PATTERN1__', - 'description' => '/PREVVAL\\\\s+FOR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 613, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'sequence_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 613 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'prevval_expression', - 'vars' => '', - 'line' => 613 - }, 'Parse::RecDescent::Rule' ), - 'where_clause' => bless( { - 'impcount' => 0, - 'calls' => [ - 'WHERE', - 'search_condition' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'WHERE', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 218 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => 'search_condition', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 218 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'where_clause', - 'vars' => '', - 'line' => 216 - }, 'Parse::RecDescent::Rule' ), - 'group_start' => bless( { - 'impcount' => 0, - 'calls' => [ - 'unsigned_constant' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'UNBOUNDED\\s+PRECEDING', - 'hashname' => '__PATTERN1__', - 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 574, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'unsigned_constant', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 575 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'PRECEDING', - 'hashname' => '__PATTERN1__', - 'description' => '/PRECEDING/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 575, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 575 - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '2', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'CURRENT\\s+ROW', - 'hashname' => '__PATTERN1__', - 'description' => '/CURRENT\\\\s+ROW/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 576, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 576 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'group_start', - 'vars' => '', - 'line' => 574 - }, 'Parse::RecDescent::Rule' ), - 'correlation_name' => bless( { - 'impcount' => 0, - 'calls' => [ - 'NAME' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'NAME', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 138 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'correlation_name', - 'vars' => '', - 'line' => 138 - }, 'Parse::RecDescent::Rule' ), - 'SQL_procedure_statement' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '[^;]*', - 'hashname' => '__PATTERN1__', - 'description' => '/[^;]*/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 94, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'pattern' => '(;|\\z)', - 'hashname' => '__PATTERN2__', - 'description' => '/(;|\\\\z)/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 94, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 94, - 'code' => '{ $return = $item[1] . $item[2] }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'SQL_procedure_statement', - 'vars' => '', - 'line' => 94 - }, 'Parse::RecDescent::Rule' ), - 'group_between' => bless( { - 'impcount' => 0, - 'calls' => [ - 'group_bound1', - 'group_bound2' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'BETWEEN', - 'hashname' => '__PATTERN1__', - 'description' => '/BETWEEN/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 578, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'group_bound1', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 578 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => 'AND', - 'hashname' => '__PATTERN2__', - 'description' => '/AND/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 578, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'group_bound2', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 578 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'group_between', - 'vars' => '', - 'line' => 578 - }, 'Parse::RecDescent::Rule' ), - 'nextval_expression' => bless( { - 'impcount' => 0, - 'calls' => [ - 'sequence_name' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'NEXTVAL\\s+FOR', - 'hashname' => '__PATTERN1__', - 'description' => '/NEXTVAL\\\\s+FOR/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 611, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => 'sequence_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 611 - }, 'Parse::RecDescent::Subrule' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'nextval_expression', - 'vars' => '', - 'line' => 611 - }, 'Parse::RecDescent::Rule' ), - 'desc_option' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_desc_option' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'DESC', - 'hashname' => '__PATTERN1__', - 'description' => '/DESC/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 564, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_desc_option', - 'expected' => '/NULLS\\\\s+FIRST/i, or /NULLS\\\\s+LAST/i', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 564 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'desc_option', - 'vars' => '', - 'line' => 564 - }, 'Parse::RecDescent::Rule' ), - 'column_list' => bless( { - 'impcount' => 0, - 'calls' => [ - 'column_name' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 2, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'op' => [], - 'items' => [ - bless( { - 'pattern' => '(', - 'hashname' => '__STRING1__', - 'description' => '\'(\'', - 'lookahead' => 0, - 'line' => 96 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'expected' => '', - 'min' => 1, - 'name' => '\'column_name(s)\'', - 'max' => 100000000, - 'leftarg' => bless( { - 'subrule' => 'column_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 96 - }, 'Parse::RecDescent::Subrule' ), - 'rightarg' => bless( { - 'subrule' => 'column_name', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 96 - }, 'Parse::RecDescent::Subrule' ), - 'hashname' => '__DIRECTIVE1__', - 'type' => 'leftop', - 'op' => bless( { - 'pattern' => ',', - 'hashname' => '__PATTERN1__', - 'description' => '/,/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 96, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - }, 'Parse::RecDescent::Operator' ), - bless( { - 'pattern' => ')', - 'hashname' => '__STRING2__', - 'description' => '\')\'', - 'lookahead' => 0, - 'line' => 96 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 97, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'startrule', + 'vars' => '', + 'line' => 11 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_cast_specification' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'expression', + 'parameter_marker' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 625 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NULL', + 'hashname' => '__PATTERN1__', + 'description' => '/NULL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 626, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 626 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'parameter_marker', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => 627 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_cast_specification', + 'vars' => '', + 'line' => 625 + }, + 'Parse::RecDescent::Rule' + ), + 'before' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NO CASCADE BEFORE', + 'hashname' => '__PATTERN1__', + 'description' => '/NO CASCADE BEFORE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 268, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'before', + 'vars' => '', + 'line' => 268 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_83_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UCASE', + 'hashname' => '__PATTERN1__', + 'description' => '/UCASE/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UPPER', + 'hashname' => '__PATTERN1__', + 'description' => '/UPPER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_83_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'ranking_function' => bless( + { + 'impcount' => 1, + 'calls' => [ + '_alternation_1_of_production_1_of_rule_ranking_function', + 'window_partition_clause', + 'window_order_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_ranking_function', + 'matchrule' => 0, + 'implicit' => '/RANK/, or /DENSE_RANK|DENSERANK/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 544 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'OVER', + 'hashname' => '__PATTERN1__', + 'description' => '/OVER/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 544, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 544 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'window_partition_clause', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 544 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'subrule' => 'window_order_clause', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 544 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 544 + }, + 'Parse::RecDescent::Literal' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'ranking_function', + 'vars' => '', + 'line' => 542 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition' => bless( + { + 'impcount' => 0, + 'calls' => ['numeric_constant'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'SELECTIVITY', + 'hashname' => '__PATTERN1__', + 'description' => '/SELECTIVITY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'numeric_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 628 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_2_of_rule_search_condition', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ABS', + 'hashname' => '__PATTERN1__', + 'description' => '/ABS/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'ABSVAL', + 'hashname' => '__PATTERN1__', + 'description' => '/ABSVAL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'reference_b' => bless( + { + 'impcount' => 0, + 'calls' => ['old_new_corr'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => 'REFERENCING', + 'hashname' => '__PATTERN1__', + 'description' => '/REFERENCING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 280, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'old_new_corr', + 'expected' => undef, + 'min' => 0, + 'argcode' => undef, + 'max' => 2, + 'matchrule' => 0, + 'repspec' => '0..2', + 'lookahead' => 0, + 'line' => 280 + }, + 'Parse::RecDescent::Repetition' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 281, + 'code' => '{ $return = join(\' \', $item[1], join(\' \', @{$item[2]}) ) }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'reference_b', + 'vars' => '', + 'line' => 280 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_1_of_rule_simple_when_clause' => bless( + { + 'impcount' => 1, + 'calls' => [ + 'search_condition', + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'WHEN', + 'hashname' => '__PATTERN1__', + 'description' => '/WHEN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 624, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'search_condition', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 624 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'THEN', + 'hashname' => '__PATTERN2__', + 'description' => '/THEN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 624, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => + '_alternation_1_of_production_1_of_rule__alternation_1_of_production_1_of_rule_simple_when_clause', + 'matchrule' => 0, + 'implicit' => 'result_expression, or /NULL/i', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 627 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_1_of_rule_simple_when_clause', + 'vars' => '', + 'line' => 624 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_9_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CORRELATION', + 'hashname' => '__PATTERN1__', + 'description' => '/CORRELATION/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CORR', + 'hashname' => '__PATTERN1__', + 'description' => '/CORR/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_9_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_7_of_rule_sysfun' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CEIL', + 'hashname' => '__PATTERN1__', + 'description' => '/CEIL/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CEILING', + 'hashname' => '__PATTERN1__', + 'description' => '/CEILING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_7_of_rule_sysfun', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'prevval_expression' => bless( + { + 'impcount' => 0, + 'calls' => ['sequence_name'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'PREVVAL\\s+FOR', + 'hashname' => '__PATTERN1__', + 'description' => '/PREVVAL\\\\s+FOR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 613, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'sequence_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 613 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'prevval_expression', + 'vars' => '', + 'line' => 613 + }, + 'Parse::RecDescent::Rule' + ), + 'where_clause' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'WHERE', + 'search_condition' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'WHERE', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 218 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => 'search_condition', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 218 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'where_clause', + 'vars' => '', + 'line' => 216 + }, + 'Parse::RecDescent::Rule' + ), + 'group_start' => bless( + { + 'impcount' => 0, + 'calls' => ['unsigned_constant'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'UNBOUNDED\\s+PRECEDING', + 'hashname' => '__PATTERN1__', + 'description' => '/UNBOUNDED\\\\s+PRECEDING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 574, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'unsigned_constant', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 575 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'PRECEDING', + 'hashname' => '__PATTERN1__', + 'description' => '/PRECEDING/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 575, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 575 + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '2', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'CURRENT\\s+ROW', + 'hashname' => '__PATTERN1__', + 'description' => '/CURRENT\\\\s+ROW/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 576, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 576 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'group_start', + 'vars' => '', + 'line' => 574 + }, + 'Parse::RecDescent::Rule' + ), + 'correlation_name' => bless( + { + 'impcount' => 0, + 'calls' => ['NAME'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'NAME', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 138 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'correlation_name', + 'vars' => '', + 'line' => 138 + }, + 'Parse::RecDescent::Rule' + ), + 'SQL_procedure_statement' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => '[^;]*', + 'hashname' => '__PATTERN1__', + 'description' => '/[^;]*/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 94, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'pattern' => '(;|\\z)', + 'hashname' => '__PATTERN2__', + 'description' => '/(;|\\\\z)/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 94, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 94, + 'code' => '{ $return = $item[1] . $item[2] }' + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'SQL_procedure_statement', + 'vars' => '', + 'line' => 94 + }, + 'Parse::RecDescent::Rule' + ), + 'group_between' => bless( + { + 'impcount' => 0, + 'calls' => [ + 'group_bound1', + 'group_bound2' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'BETWEEN', + 'hashname' => '__PATTERN1__', + 'description' => '/BETWEEN/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 578, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'group_bound1', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 578 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => 'AND', + 'hashname' => '__PATTERN2__', + 'description' => '/AND/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 578, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'group_bound2', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 578 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'group_between', + 'vars' => '', + 'line' => 578 + }, + 'Parse::RecDescent::Rule' + ), + 'nextval_expression' => bless( + { + 'impcount' => 0, + 'calls' => ['sequence_name'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'NEXTVAL\\s+FOR', + 'hashname' => '__PATTERN1__', + 'description' => '/NEXTVAL\\\\s+FOR/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 611, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => 'sequence_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 611 + }, + 'Parse::RecDescent::Subrule' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'nextval_expression', + 'vars' => '', + 'line' => 611 + }, + 'Parse::RecDescent::Rule' + ), + 'desc_option' => bless( + { + 'impcount' => 1, + 'calls' => ['_alternation_1_of_production_1_of_rule_desc_option'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'DESC', + 'hashname' => '__PATTERN1__', + 'description' => '/DESC/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 564, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_desc_option', + 'expected' => '/NULLS\\\\s+FIRST/i, or /NULLS\\\\s+LAST/i', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 564 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'desc_option', + 'vars' => '', + 'line' => 564 + }, + 'Parse::RecDescent::Rule' + ), + 'column_list' => bless( + { + 'impcount' => 0, + 'calls' => ['column_name'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 2, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'op' => [], + 'items' => [ + bless( + { + 'pattern' => '(', + 'hashname' => '__STRING1__', + 'description' => '\'(\'', + 'lookahead' => 0, + 'line' => 96 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'expected' => '', + 'min' => 1, + 'name' => '\'column_name(s)\'', + 'max' => 100000000, + 'leftarg' => bless( + { + 'subrule' => 'column_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 96 + }, + 'Parse::RecDescent::Subrule' + ), + 'rightarg' => bless( + { + 'subrule' => 'column_name', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 96 + }, + 'Parse::RecDescent::Subrule' + ), + 'hashname' => '__DIRECTIVE1__', + 'type' => 'leftop', + 'op' => bless( + { + 'pattern' => ',', + 'hashname' => '__PATTERN1__', + 'description' => '/,/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 96, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + }, + 'Parse::RecDescent::Operator' + ), + bless( + { + 'pattern' => ')', + 'hashname' => '__STRING2__', + 'description' => '\')\'', + 'lookahead' => 0, + 'line' => 96 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 97, + 'code' => '{ $return = join(\' \', \'(\', @{$item[2]}, \')\'); }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'column_list', - 'vars' => '', - 'line' => 96 - }, 'Parse::RecDescent::Rule' ), - '_alternation_1_of_production_63_of_rule_sysibm_function' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_INTERCEPT', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_INTERCEPT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ), - bless( { - 'number' => '1', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'REGR_ICPT', - 'hashname' => '__PATTERN1__', - 'description' => '/REGR_ICPT/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 628, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => 628 - }, 'Parse::RecDescent::Production' ) - ], - 'name' => '_alternation_1_of_production_63_of_rule_sysibm_function', - 'vars' => '', - 'line' => 628 - }, 'Parse::RecDescent::Rule' ), - 'dereference_operation' => bless( { - 'impcount' => 1, - 'calls' => [ - 'scoped_reference_expression', - 'name1', - '_alternation_1_of_production_1_of_rule_dereference_operation' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 1, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 0, - 'actcount' => 0, - 'items' => [ - bless( { - 'subrule' => 'scoped_reference_expression', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 526 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'pattern' => '->', - 'hashname' => '__STRING1__', - 'description' => '\'->\'', - 'lookahead' => 0, - 'line' => 526 - }, 'Parse::RecDescent::Literal' ), - bless( { - 'subrule' => 'name1', - 'matchrule' => 0, - 'implicit' => undef, - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 526 - }, 'Parse::RecDescent::Subrule' ), - bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_dereference_operation', - 'expected' => '\'(\'', - 'min' => 0, - 'argcode' => undef, - 'max' => 1, - 'matchrule' => 0, - 'repspec' => '?', - 'lookahead' => 0, - 'line' => 527 - }, 'Parse::RecDescent::Repetition' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'dereference_operation', - 'vars' => '', - 'line' => 526 - }, 'Parse::RecDescent::Rule' ), - 'OUTER' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'outer', - 'hashname' => '__PATTERN1__', - 'description' => '/outer/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 115, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'OUTER', - 'vars' => '', - 'line' => 115 - }, 'Parse::RecDescent::Rule' ), - 'window_order_clause' => bless( { - 'impcount' => 1, - 'calls' => [ - '_alternation_1_of_production_1_of_rule_window_order_clause' - ], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 1, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 2, - 'actcount' => 0, - 'op' => [], - 'items' => [ - bless( { - 'pattern' => 'ORDER\\s+BY', - 'hashname' => '__PATTERN1__', - 'description' => '/ORDER\\\\s+BY/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 555, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'expected' => '', - 'min' => 1, - 'name' => '\'_alternation_1_of_production_1_of_rule_window_order_clause(s)\'', - 'max' => 100000000, - 'leftarg' => bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_window_order_clause', - 'matchrule' => 0, - 'implicit' => 'sort_key_expression', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 560 - }, 'Parse::RecDescent::Subrule' ), - 'rightarg' => bless( { - 'subrule' => '_alternation_1_of_production_1_of_rule_window_order_clause', - 'matchrule' => 0, - 'implicit' => 'sort_key_expression', - 'argcode' => undef, - 'lookahead' => 0, - 'line' => 560 - }, 'Parse::RecDescent::Subrule' ), - 'hashname' => '__DIRECTIVE1__', - 'type' => 'leftop', - 'op' => bless( { - 'pattern' => ',', - 'hashname' => '__PATTERN2__', - 'description' => '/,/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 560, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - }, 'Parse::RecDescent::Operator' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'window_order_clause', - 'vars' => '', - 'line' => 555 - }, 'Parse::RecDescent::Rule' ), - 'TRIGGER' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 0, - 'items' => [ - bless( { - 'pattern' => 'trigger', - 'hashname' => '__PATTERN1__', - 'description' => '/trigger/i', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 103, - 'mod' => 'i', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'TRIGGER', - 'vars' => '', - 'line' => 103 - }, 'Parse::RecDescent::Rule' ), - 'comment' => bless( { - 'impcount' => 0, - 'calls' => [], - 'changed' => 0, - 'opcount' => 0, - 'prods' => [ - bless( { - 'number' => '0', - 'strcount' => 0, - 'dircount' => 0, - 'uncommit' => undef, - 'error' => undef, - 'patcount' => 1, - 'actcount' => 1, - 'items' => [ - bless( { - 'pattern' => '^\\s*-{2}.*\\n', - 'hashname' => '__PATTERN1__', - 'description' => '/^\\\\s*-\\{2\\}.*\\\\n/', - 'lookahead' => 0, - 'rdelim' => '/', - 'line' => 27, - 'mod' => '', - 'ldelim' => '/' - }, 'Parse::RecDescent::Token' ), - bless( { - 'hashname' => '__ACTION1__', - 'lookahead' => 0, - 'line' => 28, - 'code' => '{ + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'column_list', + 'vars' => '', + 'line' => 96 + }, + 'Parse::RecDescent::Rule' + ), + '_alternation_1_of_production_63_of_rule_sysibm_function' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_INTERCEPT', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_INTERCEPT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ), + bless( + { + 'number' => '1', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'REGR_ICPT', + 'hashname' => '__PATTERN1__', + 'description' => '/REGR_ICPT/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 628, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => 628 + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => '_alternation_1_of_production_63_of_rule_sysibm_function', + 'vars' => '', + 'line' => 628 + }, + 'Parse::RecDescent::Rule' + ), + 'dereference_operation' => bless( + { + 'impcount' => 1, + 'calls' => [ + 'scoped_reference_expression', + 'name1', + '_alternation_1_of_production_1_of_rule_dereference_operation' + ], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 1, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 0, + 'actcount' => 0, + 'items' => [ + bless( + { + 'subrule' => 'scoped_reference_expression', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 526 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'pattern' => '->', + 'hashname' => '__STRING1__', + 'description' => '\'->\'', + 'lookahead' => 0, + 'line' => 526 + }, + 'Parse::RecDescent::Literal' + ), + bless( + { + 'subrule' => 'name1', + 'matchrule' => 0, + 'implicit' => undef, + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 526 + }, + 'Parse::RecDescent::Subrule' + ), + bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_dereference_operation', + 'expected' => '\'(\'', + 'min' => 0, + 'argcode' => undef, + 'max' => 1, + 'matchrule' => 0, + 'repspec' => '?', + 'lookahead' => 0, + 'line' => 527 + }, + 'Parse::RecDescent::Repetition' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'dereference_operation', + 'vars' => '', + 'line' => 526 + }, + 'Parse::RecDescent::Rule' + ), + 'OUTER' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'outer', + 'hashname' => '__PATTERN1__', + 'description' => '/outer/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 115, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'OUTER', + 'vars' => '', + 'line' => 115 + }, + 'Parse::RecDescent::Rule' + ), + 'window_order_clause' => bless( + { + 'impcount' => 1, + 'calls' => ['_alternation_1_of_production_1_of_rule_window_order_clause'], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 1, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 2, + 'actcount' => 0, + 'op' => [], + 'items' => [ + bless( + { + 'pattern' => 'ORDER\\s+BY', + 'hashname' => '__PATTERN1__', + 'description' => '/ORDER\\\\s+BY/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 555, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'expected' => '', + 'min' => 1, + 'name' => '\'_alternation_1_of_production_1_of_rule_window_order_clause(s)\'', + 'max' => 100000000, + 'leftarg' => bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_window_order_clause', + 'matchrule' => 0, + 'implicit' => 'sort_key_expression', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 560 + }, + 'Parse::RecDescent::Subrule' + ), + 'rightarg' => bless( + { + 'subrule' => '_alternation_1_of_production_1_of_rule_window_order_clause', + 'matchrule' => 0, + 'implicit' => 'sort_key_expression', + 'argcode' => undef, + 'lookahead' => 0, + 'line' => 560 + }, + 'Parse::RecDescent::Subrule' + ), + 'hashname' => '__DIRECTIVE1__', + 'type' => 'leftop', + 'op' => bless( + { + 'pattern' => ',', + 'hashname' => '__PATTERN2__', + 'description' => '/,/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 560, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + }, + 'Parse::RecDescent::Operator' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'window_order_clause', + 'vars' => '', + 'line' => 555 + }, + 'Parse::RecDescent::Rule' + ), + 'TRIGGER' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 0, + 'items' => [ + bless( + { + 'pattern' => 'trigger', + 'hashname' => '__PATTERN1__', + 'description' => '/trigger/i', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 103, + 'mod' => 'i', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'TRIGGER', + 'vars' => '', + 'line' => 103 + }, + 'Parse::RecDescent::Rule' + ), + 'comment' => bless( + { + 'impcount' => 0, + 'calls' => [], + 'changed' => 0, + 'opcount' => 0, + 'prods' => [ + bless( + { + 'number' => '0', + 'strcount' => 0, + 'dircount' => 0, + 'uncommit' => undef, + 'error' => undef, + 'patcount' => 1, + 'actcount' => 1, + 'items' => [ + bless( + { + 'pattern' => '^\\s*-{2}.*\\n', + 'hashname' => '__PATTERN1__', + 'description' => '/^\\\\s*-\\{2\\}.*\\\\n/', + 'lookahead' => 0, + 'rdelim' => '/', + 'line' => 27, + 'mod' => '', + 'ldelim' => '/' + }, + 'Parse::RecDescent::Token' + ), + bless( + { + 'hashname' => '__ACTION1__', + 'lookahead' => 0, + 'line' => 28, + 'code' => '{ my $comment = $item[1]; $comment =~ s/^\\s*(-{2})\\s*//; $comment =~ s/\\s*$//; $return = $comment; }' - }, 'Parse::RecDescent::Action' ) - ], - 'line' => undef - }, 'Parse::RecDescent::Production' ) - ], - 'name' => 'comment', - 'vars' => '', - 'line' => 27 - }, 'Parse::RecDescent::Rule' ) - } - }, 'Parse::RecDescent' ); -} \ No newline at end of file + }, + 'Parse::RecDescent::Action' + ) + ], + 'line' => undef + }, + 'Parse::RecDescent::Production' + ) + ], + 'name' => 'comment', + 'vars' => '', + 'line' => 27 + }, + 'Parse::RecDescent::Rule' + ) + } + }, + 'Parse::RecDescent' + ); +} diff --git a/lib/SQL/Translator/Parser/DBI.pm b/lib/SQL/Translator/Parser/DBI.pm index 10be89bac..d353bc57a 100644 --- a/lib/SQL/Translator/Parser/DBI.pm +++ b/lib/SQL/Translator/Parser/DBI.pm @@ -105,13 +105,13 @@ our @EXPORT; our $VERSION = '1.64'; use constant DRIVERS => { - mysql => 'MySQL', - odbc => 'SQLServer', - oracle => 'Oracle', - pg => 'PostgreSQL', - sqlite => 'SQLite', - sybase => 'Sybase', - db2 => 'DB2', + mysql => 'MySQL', + odbc => 'SQLServer', + oracle => 'Oracle', + pg => 'PostgreSQL', + sqlite => 'SQLite', + sybase => 'Sybase', + db2 => 'DB2', }; use Exporter; @@ -125,48 +125,50 @@ use base qw(Exporter); # Passed a SQL::Translator instance and a string containing the data # sub parse { - my ( $tr, $data ) = @_; - - my $args = $tr->parser_args; - my $dbh = $args->{'dbh'}; - my $dsn = $args->{'dsn'}; - my $db_user = $args->{'db_user'}; - my $db_password = $args->{'db_password'}; - - my $dbh_is_local; - unless ( $dbh ) { - die 'No DSN' unless $dsn; - $dbh = DBI->connect( $dsn, $db_user, $db_password, - { - FetchHashKeyName => 'NAME_lc', - LongReadLen => 3000, - LongTruncOk => 1, - RaiseError => 1, - } - ); - $dbh_is_local = 1; - } + my ($tr, $data) = @_; + + my $args = $tr->parser_args; + my $dbh = $args->{'dbh'}; + my $dsn = $args->{'dsn'}; + my $db_user = $args->{'db_user'}; + my $db_password = $args->{'db_password'}; + + my $dbh_is_local; + unless ($dbh) { + die 'No DSN' unless $dsn; + $dbh = DBI->connect( + $dsn, $db_user, + $db_password, + { + FetchHashKeyName => 'NAME_lc', + LongReadLen => 3000, + LongTruncOk => 1, + RaiseError => 1, + } + ); + $dbh_is_local = 1; + } - die 'No database handle' unless defined $dbh; + die 'No database handle' unless defined $dbh; - my $db_type = $dbh->{'Driver'}{'Name'} or die 'Cannot determine DBI type'; - my $driver = DRIVERS->{ lc $db_type } or die "$db_type not supported"; - my $pkg = "SQL::Translator::Parser::DBI::$driver"; - my $sub = $pkg.'::parse'; + my $db_type = $dbh->{'Driver'}{'Name'} or die 'Cannot determine DBI type'; + my $driver = DRIVERS->{ lc $db_type } or die "$db_type not supported"; + my $pkg = "SQL::Translator::Parser::DBI::$driver"; + my $sub = $pkg . '::parse'; - SQL::Translator::load( $pkg ); + SQL::Translator::load($pkg); - my $s = eval { - no strict 'refs'; - &{ $sub }( $tr, $dbh ) or die "No result from $pkg"; - }; - my $err = $@; + my $s = eval { + no strict 'refs'; + &{$sub}($tr, $dbh) or die "No result from $pkg"; + }; + my $err = $@; - eval { $dbh->disconnect } if (defined $dbh and $dbh_is_local); + eval { $dbh->disconnect } if (defined $dbh and $dbh_is_local); - die $err if $err; + die $err if $err; - return $s; + return $s; } 1; diff --git a/lib/SQL/Translator/Parser/DBI/DB2.pm b/lib/SQL/Translator/Parser/DBI/DB2.pm index 029307e28..5aa1ea4f6 100644 --- a/lib/SQL/Translator/Parser/DBI/DB2.pm +++ b/lib/SQL/Translator/Parser/DBI/DB2.pm @@ -22,27 +22,28 @@ use Data::Dumper; use SQL::Translator::Parser::DB2; use SQL::Translator::Schema::Constants; -our ($DEBUG, $VERSION, @EXPORT_OK ); +our ($DEBUG, $VERSION, @EXPORT_OK); + # $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; sub parse { - my ( $tr, $dbh ) = @_; + my ($tr, $dbh) = @_; - my $schema = $tr->schema; + my $schema = $tr->schema; - my ($sth, @tables, $columns); - my $stuff; + my ($sth, @tables, $columns); + my $stuff; - if ($dbh->{FetchHashKeyName} ne 'NAME_uc') { - $dbh->{FetchHashKeyName} = 'NAME_uc'; - } + if ($dbh->{FetchHashKeyName} ne 'NAME_uc') { + $dbh->{FetchHashKeyName} = 'NAME_uc'; + } - if ($dbh->{ChopBlanks} != 1) { - $dbh->{ChopBlanks} = 1; - } + if ($dbh->{ChopBlanks} != 1) { + $dbh->{ChopBlanks} = 1; + } - my $tabsth = $dbh->prepare(<prepare(<table_info(); -# @tables = @{$sth->fetchall_arrayref({})}; - my $colsth = $dbh->prepare(<table_info(); + # @tables = @{$sth->fetchall_arrayref({})}; + + my $colsth = $dbh->prepare(<prepare(<prepare(<prepare(<prepare(<prepare(<prepare(<execute(); - @tables = @{$tabsth->fetchall_arrayref({})}; - - foreach my $table_info (@tables) { - next - unless (defined($table_info->{TYPE})); - -# Why are we not getting system tables, maybe a parameter should decide? - - if ($table_info->{TYPE} eq 'T'&& - $table_info->{TABSCHEMA} !~ /^SYS/) { - print Dumper($table_info) if($DEBUG); - print $table_info->{TABNAME} if($DEBUG); - my $table = $schema->add_table( - name => $table_info->{TABNAME}, - type => 'TABLE', - ) || die $schema->error; - $table->options("TABLESPACE", $table_info->{TBSPACE}); - - $colsth->execute($table_info->{TABNAME}); - my $cols = $colsth->fetchall_hashref("COLNAME"); - - foreach my $c (values %{$cols}) { - print Dumper($c) if $DEBUG; - print $c->{COLNAME} if($DEBUG); - my $f = $table->add_field( - name => $c->{COLNAME}, - default_value => $c->{DEFAULT}, - data_type => $c->{TYPENAME}, - order => $c->{COLNO}, - size => $c->{LENGTH}, - ) || die $table->error; - - - $f->is_nullable($c->{NULLS} eq 'Y'); - } - - $consth->execute($table_info->{TABNAME}); - my $cons = $consth->fetchall_hashref("COLNAME"); - next if(!%$cons); - - my @fields = map { $_->{COLNAME} } (values %{$cons}); - my $c = $cons->{$fields[0]}; - - print $c->{CONSTNAME} if($DEBUG); - my $con = $table->add_constraint( - name => $c->{CONSTNAME}, - fields => \@fields, - type => $c->{TYPE} eq 'P' ? - PRIMARY_KEY : $c->{TYPE} eq 'F' ? - FOREIGN_KEY : UNIQUE - ) || die $table->error; - - - $con->deferrable($c->{CHECKEXISTINGDATA} eq 'D'); - - $indsth->execute($table_info->{TABNAME}); - my $inds = $indsth->fetchall_hashref("INDNAME"); - print Dumper($inds) if($DEBUG); - next if(!%$inds); - - foreach my $ind (keys %$inds) - { - print $ind if($DEBUG); - $indsth->execute($table_info->{TABNAME}); - my $indcols = $indsth->fetchall_hashref("COLNAME"); - next if($inds->{$ind}{UNIQUERULE} eq 'P'); - - print Dumper($indcols) if($DEBUG); - - my @fields = map { $_->{INDNAME} eq $ind ? $_->{COLNAME} : () } - (values %{$indcols}); - - my $index = $indcols->{$fields[0]}; - - my $inew = $table->add_index( - name => $index->{INDNAME}, - fields => \@fields, - type => $index->{UNIQUERULE} eq 'U' ? - UNIQUE : NORMAL - ) || die $table->error; - - - } - - $trigsth->execute($table_info->{TABNAME}); - my $trigs = $trigsth->fetchall_hashref("TRIGNAME"); - print Dumper($trigs); - next if(!%$trigs); - - foreach my $t (values %$trigs) - { - print $t->{TRIGNAME} if($DEBUG); - my $trig = $schema->add_trigger( - name => $t->{TRIGNAME}, - # fields => \@fields, - perform_action_when => $t->{TRIGTIME} eq 'A' ? 'after' : - $t->{TRIGTIME} eq 'B' ? 'before': - 'instead', - database_event => $t->{TRIGEVENT} eq 'I' ? 'insert' - : $t->{TRIGEVENT} eq 'D' ? 'delete' - : 'update', - action => $t->{TEXT}, - on_table => $t->{TABNAME} - ) || die $schema->error; - -# $trig->extra( reference => $def->{'reference'}, -# condition => $def->{'condition'}, -# granularity => $def->{'granularity'} ); - } - - } + $tabsth->execute(); + @tables = @{ $tabsth->fetchall_arrayref({}) }; + + foreach my $table_info (@tables) { + next + unless (defined($table_info->{TYPE})); + + # Why are we not getting system tables, maybe a parameter should decide? + + if ( $table_info->{TYPE} eq 'T' + && $table_info->{TABSCHEMA} !~ /^SYS/) { + print Dumper($table_info) if ($DEBUG); + print $table_info->{TABNAME} if ($DEBUG); + my $table = $schema->add_table( + name => $table_info->{TABNAME}, + type => 'TABLE', + ) || die $schema->error; + $table->options("TABLESPACE", $table_info->{TBSPACE}); + + $colsth->execute($table_info->{TABNAME}); + my $cols = $colsth->fetchall_hashref("COLNAME"); + + foreach my $c (values %{$cols}) { + print Dumper($c) if $DEBUG; + print $c->{COLNAME} if ($DEBUG); + my $f = $table->add_field( + name => $c->{COLNAME}, + default_value => $c->{DEFAULT}, + data_type => $c->{TYPENAME}, + order => $c->{COLNO}, + size => $c->{LENGTH}, + ) || die $table->error; + + $f->is_nullable($c->{NULLS} eq 'Y'); + } + + $consth->execute($table_info->{TABNAME}); + my $cons = $consth->fetchall_hashref("COLNAME"); + next if (!%$cons); + + my @fields = map { $_->{COLNAME} } (values %{$cons}); + my $c = $cons->{ $fields[0] }; + + print $c->{CONSTNAME} if ($DEBUG); + my $con = $table->add_constraint( + name => $c->{CONSTNAME}, + fields => \@fields, + type => $c->{TYPE} eq 'P' ? PRIMARY_KEY + : $c->{TYPE} eq 'F' ? FOREIGN_KEY + : UNIQUE + ) + || die $table->error; + + $con->deferrable($c->{CHECKEXISTINGDATA} eq 'D'); + + $indsth->execute($table_info->{TABNAME}); + my $inds = $indsth->fetchall_hashref("INDNAME"); + print Dumper($inds) if ($DEBUG); + next if (!%$inds); + + foreach my $ind (keys %$inds) { + print $ind if ($DEBUG); + $indsth->execute($table_info->{TABNAME}); + my $indcols = $indsth->fetchall_hashref("COLNAME"); + next if ($inds->{$ind}{UNIQUERULE} eq 'P'); + + print Dumper($indcols) if ($DEBUG); + + my @fields = map { $_->{INDNAME} eq $ind ? $_->{COLNAME} : () } (values %{$indcols}); + + my $index = $indcols->{ $fields[0] }; + + my $inew = $table->add_index( + name => $index->{INDNAME}, + fields => \@fields, + type => $index->{UNIQUERULE} eq 'U' ? UNIQUE : NORMAL + ) || die $table->error; + + } + + $trigsth->execute($table_info->{TABNAME}); + my $trigs = $trigsth->fetchall_hashref("TRIGNAME"); + print Dumper($trigs); + next if (!%$trigs); + + foreach my $t (values %$trigs) { + print $t->{TRIGNAME} if ($DEBUG); + my $trig = $schema->add_trigger( + name => $t->{TRIGNAME}, + + # fields => \@fields, + perform_action_when => $t->{TRIGTIME} eq 'A' ? 'after' + : $t->{TRIGTIME} eq 'B' ? 'before' + : 'instead', + database_event => $t->{TRIGEVENT} eq 'I' ? 'insert' + : $t->{TRIGEVENT} eq 'D' ? 'delete' + : 'update', + action => $t->{TEXT}, + on_table => $t->{TABNAME} + ) + || die $schema->error; + + # $trig->extra( reference => $def->{'reference'}, + # condition => $def->{'condition'}, + # granularity => $def->{'granularity'} ); + } + } + } - return 1; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DBI/MySQL.pm b/lib/SQL/Translator/Parser/DBI/MySQL.pm index 7c5c9ae0a..7ac32aa63 100644 --- a/lib/SQL/Translator/Parser/DBI/MySQL.pm +++ b/lib/SQL/Translator/Parser/DBI/MySQL.pm @@ -23,32 +23,33 @@ use Data::Dumper; use SQL::Translator::Schema::Constants; use SQL::Translator::Parser::MySQL; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; sub parse { - my ( $tr, $dbh ) = @_; - my $schema = $tr->schema; - my @table_names = @{ $dbh->selectcol_arrayref('show tables') }; - my @skip_tables = defined $tr->parser_args->{skip} - ? split(/,/, $tr->parser_args->{skip}) - : (); - - $dbh->{'FetchHashKeyName'} = 'NAME_lc'; - - my $create = q{}; - for my $table_name ( @table_names ) { - next if (grep /^$table_name$/, @skip_tables); - my $sth = $dbh->prepare("show create table " . $dbh->quote_identifier($table_name)); - $sth->execute; - my $table = $sth->fetchrow_hashref; - $create .= ($table->{'create table'} || $table->{'create view'}) . ";\n\n"; - } - - SQL::Translator::Parser::MySQL::parse( $tr, $create ); - - return 1; + my ($tr, $dbh) = @_; + my $schema = $tr->schema; + my @table_names = @{ $dbh->selectcol_arrayref('show tables') }; + my @skip_tables + = defined $tr->parser_args->{skip} + ? split(/,/, $tr->parser_args->{skip}) + : (); + + $dbh->{'FetchHashKeyName'} = 'NAME_lc'; + + my $create = q{}; + for my $table_name (@table_names) { + next if (grep /^$table_name$/, @skip_tables); + my $sth = $dbh->prepare("show create table " . $dbh->quote_identifier($table_name)); + $sth->execute; + my $table = $sth->fetchrow_hashref; + $create .= ($table->{'create table'} || $table->{'create view'}) . ";\n\n"; + } + + SQL::Translator::Parser::MySQL::parse($tr, $create); + + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DBI/Oracle.pm b/lib/SQL/Translator/Parser/DBI/Oracle.pm index ea3861932..1da108821 100644 --- a/lib/SQL/Translator/Parser/DBI/Oracle.pm +++ b/lib/SQL/Translator/Parser/DBI/Oracle.pm @@ -25,92 +25,74 @@ use SQL::Translator::Schema::Constraint; our $VERSION = '1.64'; sub parse { - my ( $tr, $dbh ) = @_; - - my $schema = $tr->schema; - - my $db_user = uc $tr->parser_args()->{db_user}; - my $sth = $dbh->table_info(undef, $db_user, '%', 'TABLE'); - - while(my $table_info = $sth->fetchrow_hashref('NAME_uc')) { - next if ($table_info->{TABLE_NAME} =~ /\$/); - - # create the table - - my $table = $schema->add_table( - name => $table_info->{TABLE_NAME}, - type => $table_info->{TABLE_TYPE}, - ); - - # add the fields (columns) for this table - - my $sth; - - $sth = $dbh->column_info( - undef, - $table_info->{TABLE_SCHEM}, - $table_info->{TABLE_NAME}, - '%' - ); - - while(my $column = $sth->fetchrow_hashref('NAME_uc')) { - my $f = $table->add_field( - name => $column->{COLUMN_NAME}, - default_value => $column->{COLUMN_DEF}, - data_type => $column->{TYPE_NAME}, - order => $column->{ORDINAL_POSITION}, - size => $column->{COLUMN_SIZE}, - ) || die $table->error; - - $f->is_nullable( $column->{NULLABLE} == 1 ); - } - - # add the primary key info - - $sth = $dbh->primary_key_info( - undef, - $table_info->{TABLE_SCHEM}, - $table_info->{TABLE_NAME}, - ); - - while(my $primary_key = $sth->fetchrow_hashref('NAME_uc')) { - my $f = $table->get_field( $primary_key->{COLUMN_NAME} ); - $f->is_primary_key(1); - } - - # add the foreign key info (constraints) - - $sth = $dbh->foreign_key_info( - undef, - undef, - undef, - undef, - $table_info->{TABLE_SCHEM}, - $table_info->{TABLE_NAME}, - ); - - my $cons = {}; - while(my $foreign_key = $sth->fetchrow_hashref('NAME_uc')) { - my $name = $foreign_key->{FK_NAME}; - $cons->{$name}->{reference_table} = $foreign_key->{UK_TABLE_NAME}; - push @{ $cons->{$name}->{fields} }, - $foreign_key->{FK_COLUMN_NAME}; - push @{ $cons->{$name}->{reference_fields} }, - $foreign_key->{UK_COLUMN_NAME}; - } - - for my $name ( keys %$cons ) { - my $c = $table->add_constraint( - type => FOREIGN_KEY, - name => $name, - fields => $cons->{$name}->{fields}, - reference_fields => $cons->{$name}->{reference_fields}, - reference_table => $cons->{$name}->{reference_table}, - ) || die $table->error; - } + my ($tr, $dbh) = @_; + + my $schema = $tr->schema; + + my $db_user = uc $tr->parser_args()->{db_user}; + my $sth = $dbh->table_info(undef, $db_user, '%', 'TABLE'); + + while (my $table_info = $sth->fetchrow_hashref('NAME_uc')) { + next if ($table_info->{TABLE_NAME} =~ /\$/); + + # create the table + + my $table = $schema->add_table( + name => $table_info->{TABLE_NAME}, + type => $table_info->{TABLE_TYPE}, + ); + + # add the fields (columns) for this table + + my $sth; + + $sth = $dbh->column_info(undef, $table_info->{TABLE_SCHEM}, $table_info->{TABLE_NAME}, '%'); + + while (my $column = $sth->fetchrow_hashref('NAME_uc')) { + my $f = $table->add_field( + name => $column->{COLUMN_NAME}, + default_value => $column->{COLUMN_DEF}, + data_type => $column->{TYPE_NAME}, + order => $column->{ORDINAL_POSITION}, + size => $column->{COLUMN_SIZE}, + ) || die $table->error; + + $f->is_nullable($column->{NULLABLE} == 1); + } + + # add the primary key info + + $sth = $dbh->primary_key_info(undef, $table_info->{TABLE_SCHEM}, $table_info->{TABLE_NAME},); + + while (my $primary_key = $sth->fetchrow_hashref('NAME_uc')) { + my $f = $table->get_field($primary_key->{COLUMN_NAME}); + $f->is_primary_key(1); + } + + # add the foreign key info (constraints) + + $sth = $dbh->foreign_key_info(undef, undef, undef, undef, $table_info->{TABLE_SCHEM}, $table_info->{TABLE_NAME},); + + my $cons = {}; + while (my $foreign_key = $sth->fetchrow_hashref('NAME_uc')) { + my $name = $foreign_key->{FK_NAME}; + $cons->{$name}->{reference_table} = $foreign_key->{UK_TABLE_NAME}; + push @{ $cons->{$name}->{fields} }, $foreign_key->{FK_COLUMN_NAME}; + push @{ $cons->{$name}->{reference_fields} }, $foreign_key->{UK_COLUMN_NAME}; + } + + for my $name (keys %$cons) { + my $c = $table->add_constraint( + type => FOREIGN_KEY, + name => $name, + fields => $cons->{$name}->{fields}, + reference_fields => $cons->{$name}->{reference_fields}, + reference_table => $cons->{$name}->{reference_table}, + ) || die $table->error; } + } - return 1; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm b/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm index 0261f4059..5fefd6e27 100644 --- a/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/DBI/PostgreSQL.pm @@ -47,25 +47,26 @@ use DBI; use Data::Dumper; use SQL::Translator::Schema::Constants; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; -my $actions = {c => 'cascade', - r => 'restrict', - a => 'no action', - n => 'set null', - d => 'set default', - }; +my $actions = { + c => 'cascade', + r => 'restrict', + a => 'no action', + n => 'set null', + d => 'set default', +}; sub parse { - my ( $tr, $dbh ) = @_; + my ($tr, $dbh) = @_; - my $schema = $tr->schema; - my $deconstruct_enum_types = $tr->parser_args->{deconstruct_enum_types}; + my $schema = $tr->schema; + my $deconstruct_enum_types = $tr->parser_args->{deconstruct_enum_types}; - my $column_select = $dbh->prepare( - "SELECT a.attname, a.atttypid, t.typtype, format_type(t.oid, a.atttypmod) as typname, a.attnum, + my $column_select = $dbh->prepare( + "SELECT a.attname, a.atttypid, t.typtype, format_type(t.oid, a.atttypmod) as typname, a.attnum, a.atttypmod as length, a.attnotnull, a.atthasdef, pg_get_expr(ad.adbin, ad.adrelid) as adsrc, d.description FROM pg_type t, pg_attribute a @@ -74,27 +75,27 @@ sub parse { WHERE a.attrelid=? AND attnum>0 AND a.atttypid=t.oid ORDER BY a.attnum" - ); + ); - my $index_select = $dbh->prepare( - "SELECT oid, c.relname, i.indkey, i.indnatts, i.indisunique, + my $index_select = $dbh->prepare( + "SELECT oid, c.relname, i.indkey, i.indnatts, i.indisunique, i.indisprimary, pg_get_indexdef(oid) AS create_string FROM pg_class c,pg_index i WHERE c.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname='public') AND c.relkind='i' AND c.oid=i.indexrelid AND i.indrelid=?" - ); + ); - my $table_select = $dbh->prepare( - "SELECT c.oid, c.relname, d.description + my $table_select = $dbh->prepare( + "SELECT c.oid, c.relname, d.description FROM pg_class c LEFT JOIN pg_description d ON c.oid=d.objoid AND d.objsubid=0 WHERE relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname='public') AND relkind='r';" - ); + ); - my $fk_select = $dbh->prepare( - q/ + my $fk_select = $dbh->prepare( + q/ SELECT r.conname, c.relname, d.relname AS frelname, @@ -130,127 +131,134 @@ WHERE pg_catalog.pg_table_is_visible(c.oid) AND n.nspname = ? AND c.relname = ? ORDER BY 1; - /) or die "Can't prepare: $@"; - - my %enum_types; - if ($deconstruct_enum_types) { - my $enum_select = $dbh->prepare( - 'SELECT enumtypid, enumlabel FROM pg_enum ORDER BY oid, enumsortorder' - ) or die "Can't prepare: $@"; - $enum_select->execute(); - while ( my $enumval = $enum_select->fetchrow_hashref ) { - push @{$enum_types{ $enumval->{enumtypid} }}, $enumval->{enumlabel}; - } + / + ) or die "Can't prepare: $@"; + + my %enum_types; + if ($deconstruct_enum_types) { + my $enum_select = $dbh->prepare('SELECT enumtypid, enumlabel FROM pg_enum ORDER BY oid, enumsortorder') + or die "Can't prepare: $@"; + $enum_select->execute(); + while (my $enumval = $enum_select->fetchrow_hashref) { + push @{ $enum_types{ $enumval->{enumtypid} } }, $enumval->{enumlabel}; } + } - $table_select->execute(); - - while ( my $tablehash = $table_select->fetchrow_hashref ) { - - my $table_name = $$tablehash{'relname'}; - my $table_oid = $$tablehash{'oid'}; - my $table = $schema->add_table( - name => $table_name, - #what is type? type => $table_info->{TABLE_TYPE}, - ) || die $schema->error; - - $table->comments($$tablehash{'description'}) if $$tablehash{'description'}; - - $column_select->execute($table_oid); - - my %column_by_attrid; - while (my $columnhash = $column_select->fetchrow_hashref ) { - my $type = $$columnhash{'typname'}; - # For the case of character varying(50), atttypmod will be 54 and the (50) - # will be listed as part of the type. For numeric(8,5) the atttypmod will - # be a meaningless large number. To make this compatible with the - # rest of SQL::Translator, remove the size from the type and change the - # size to whatever was removed from the type. - my @size= ($type =~ s/\(([0-9,]+)\)$//)? (split /,/, $1) : (); - my $col = $table->add_field( - name => $$columnhash{'attname'}, - data_type => $type, - order => $$columnhash{'attnum'}, - ) || die $table->error; - $col->size(\@size) if @size; - # default values are a DDL expression. Convert the obvious ones like '...'::text - # to a plain value and let the rest be scalarrefs. - my $default= $$columnhash{'adsrc'}; - if (defined $default) { - if ($default =~ /^[0-9.]+$/) { $col->default_value($default) } - elsif ($default =~ /^'(.*?)'(::\Q$type\E)?$/) { - my $str= $1; - $str =~ s/''/'/g; - $col->default_value($str); - } - else { $col->default_value(\$default) } - } - if ($deconstruct_enum_types && $enum_types{$columnhash->{atttypid}}) { - $col->extra->{custom_type_name} = $col->data_type; - $col->extra->{list} = [ @{ $enum_types{$columnhash->{atttypid}} } ]; - $col->data_type('enum'); - } - $col->is_nullable( $$columnhash{'attnotnull'} ? 0 : 1 ); - $col->comments($$columnhash{'description'}) if $$columnhash{'description'}; - $column_by_attrid{$$columnhash{'attnum'}}= $$columnhash{'attname'}; + $table_select->execute(); + + while (my $tablehash = $table_select->fetchrow_hashref) { + + my $table_name = $$tablehash{'relname'}; + my $table_oid = $$tablehash{'oid'}; + my $table = $schema->add_table( + name => $table_name, + + #what is type? type => $table_info->{TABLE_TYPE}, + ) || die $schema->error; + + $table->comments($$tablehash{'description'}) + if $$tablehash{'description'}; + + $column_select->execute($table_oid); + + my %column_by_attrid; + while (my $columnhash = $column_select->fetchrow_hashref) { + my $type = $$columnhash{'typname'}; + + # For the case of character varying(50), atttypmod will be 54 and the (50) + # will be listed as part of the type. For numeric(8,5) the atttypmod will + # be a meaningless large number. To make this compatible with the + # rest of SQL::Translator, remove the size from the type and change the + # size to whatever was removed from the type. + my @size = ($type =~ s/\(([0-9,]+)\)$//) ? (split /,/, $1) : (); + my $col = $table->add_field( + name => $$columnhash{'attname'}, + data_type => $type, + order => $$columnhash{'attnum'}, + ) || die $table->error; + $col->size(\@size) if @size; + +# default values are a DDL expression. Convert the obvious ones like '...'::text +# to a plain value and let the rest be scalarrefs. + my $default = $$columnhash{'adsrc'}; + if (defined $default) { + if ($default =~ /^[0-9.]+$/) { $col->default_value($default) } + elsif ($default =~ /^'(.*?)'(::\Q$type\E)?$/) { + my $str = $1; + $str =~ s/''/'/g; + $col->default_value($str); + } else { + $col->default_value(\$default); } + } + if ( $deconstruct_enum_types + && $enum_types{ $columnhash->{atttypid} }) { + $col->extra->{custom_type_name} = $col->data_type; + $col->extra->{list} = [ @{ $enum_types{ $columnhash->{atttypid} } } ]; + $col->data_type('enum'); + } + $col->is_nullable($$columnhash{'attnotnull'} ? 0 : 1); + $col->comments($$columnhash{'description'}) + if $$columnhash{'description'}; + $column_by_attrid{ $$columnhash{'attnum'} } = $$columnhash{'attname'}; + } - $index_select->execute($table_oid); - - while (my $indexhash = $index_select->fetchrow_hashref ) { - #don't deal with function indexes at the moment - next if ($$indexhash{'indkey'} eq '' - or !defined($$indexhash{'indkey'}) ); - - my @columns = map $column_by_attrid{$_}, split /\s+/, $$indexhash{'indkey'}; + $index_select->execute($table_oid); - my $type; - if ($$indexhash{'indisprimary'}) { - $type = UNIQUE; #PRIMARY_KEY; + while (my $indexhash = $index_select->fetchrow_hashref) { - #tell sqlt that this is the primary key: - for my $column (@columns) { - $table->get_field($column)->{is_primary_key}=1; - } + #don't deal with function indexes at the moment + next + if ($$indexhash{'indkey'} eq '' + or !defined($$indexhash{'indkey'})); - } elsif ($$indexhash{'indisunique'}) { - $type = UNIQUE; - } else { - $type = NORMAL; - } + my @columns = map $column_by_attrid{$_}, split /\s+/, $$indexhash{'indkey'}; + my $type; + if ($$indexhash{'indisprimary'}) { + $type = UNIQUE; #PRIMARY_KEY; - $table->add_index( - name => $$indexhash{'relname'}, - type => $type, - fields => \@columns, - ) || die $table->error; + #tell sqlt that this is the primary key: + for my $column (@columns) { + $table->get_field($column)->{is_primary_key} = 1; } - $fk_select->execute('public',$table_name) or die "Can't execute: $@"; - my $fkeys = $fk_select->fetchall_arrayref({}); - $DEBUG and print Dumper $fkeys; - for my $con (@$fkeys){ - my $con_name = $con->{conname}; - my $fields = $con->{fields}; - my $reference_fields = $con->{reference_fields}; - my $reference_table = $con->{frelname}; - my $on_upd = $con->{confupdtype}; - my $on_del = $con->{confdeltype}; - $table->add_constraint( - name => $con_name, - type => 'foreign_key', - fields => $fields, - reference_fields => $reference_fields, - reference_table => $reference_table, - on_update => $actions->{$on_upd}, - on_delete => $actions->{$on_del}, - ); - } + } elsif ($$indexhash{'indisunique'}) { + $type = UNIQUE; + } else { + $type = NORMAL; + } + + $table->add_index( + name => $$indexhash{'relname'}, + type => $type, + fields => \@columns, + ) || die $table->error; } + $fk_select->execute('public', $table_name) or die "Can't execute: $@"; + my $fkeys = $fk_select->fetchall_arrayref({}); + $DEBUG and print Dumper $fkeys; + for my $con (@$fkeys) { + my $con_name = $con->{conname}; + my $fields = $con->{fields}; + my $reference_fields = $con->{reference_fields}; + my $reference_table = $con->{frelname}; + my $on_upd = $con->{confupdtype}; + my $on_del = $con->{confdeltype}; + $table->add_constraint( + name => $con_name, + type => 'foreign_key', + fields => $fields, + reference_fields => $reference_fields, + reference_table => $reference_table, + on_update => $actions->{$on_upd}, + on_delete => $actions->{$on_del}, + ); + } + } - return 1; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DBI/SQLServer.pm b/lib/SQL/Translator/Parser/DBI/SQLServer.pm index ee69185b8..0f1ba3bdb 100644 --- a/lib/SQL/Translator/Parser/DBI/SQLServer.pm +++ b/lib/SQL/Translator/Parser/DBI/SQLServer.pm @@ -20,54 +20,50 @@ use DBI; use SQL::Translator::Schema; use Data::Dumper; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; no strict 'refs'; sub parse { - my ( $tr, $dbh ) = @_; + my ($tr, $dbh) = @_; - if ($dbh->{FetchHashKeyName} ne 'NAME_uc') { - warn "setting dbh attribute {FetchHashKeyName} to NAME_uc"; - $dbh->{FetchHashKeyName} = 'NAME_uc'; - } + if ($dbh->{FetchHashKeyName} ne 'NAME_uc') { + warn "setting dbh attribute {FetchHashKeyName} to NAME_uc"; + $dbh->{FetchHashKeyName} = 'NAME_uc'; + } - if ($dbh->{ChopBlanks} != 1) { - warn "setting dbh attribute {ChopBlanks} to 1"; - $dbh->{ChopBlanks} = 1; - } + if ($dbh->{ChopBlanks} != 1) { + warn "setting dbh attribute {ChopBlanks} to 1"; + $dbh->{ChopBlanks} = 1; + } - my $schema = $tr->schema; + my $schema = $tr->schema; - my ($sth, @tables, $columns); - my $stuff; + my ($sth, @tables, $columns); + my $stuff; - ### Columns + ### Columns - # it is much quicker to slurp back everything all at once rather - # than make repeated calls + # it is much quicker to slurp back everything all at once rather + # than make repeated calls - $sth = $dbh->column_info(undef, undef, undef, undef); + $sth = $dbh->column_info(undef, undef, undef, undef); + foreach my $c (@{ $sth->fetchall_arrayref({}) }) { + $columns->{ $c->{TABLE_CAT} }->{ $c->{TABLE_SCHEM} } + ->{ $c->{TABLE_NAME} }->{columns}->{ $c->{COLUMN_NAME} } = $c; + } - foreach my $c (@{$sth->fetchall_arrayref({})}) { - $columns - ->{$c->{TABLE_CAT}} - ->{$c->{TABLE_SCHEM}} - ->{$c->{TABLE_NAME}} - ->{columns} - ->{$c->{COLUMN_NAME}}= $c; - } + ### Tables and views - ### Tables and views + # Get a list of the tables and views. + $sth = $dbh->table_info(); + @tables = @{ $sth->fetchall_arrayref({}) }; - # Get a list of the tables and views. - $sth = $dbh->table_info(); - @tables = @{$sth->fetchall_arrayref({})}; - - my $h = $dbh->selectall_arrayref(q{ + my $h = $dbh->selectall_arrayref( + q{ SELECT o.name, colid,c.text FROM syscomments c JOIN sysobjects o @@ -76,71 +72,70 @@ SELECT o.name, colid,c.text ORDER BY o.name, c.colid } -); + ); - # View text - # I had always thought there was something 'hard' about - # reconstructing text from syscomments .. - # this seems to work fine and is certainly not complicated! + # View text + # I had always thought there was something 'hard' about + # reconstructing text from syscomments .. + # this seems to work fine and is certainly not complicated! - foreach (@{$h}) { - $stuff->{view}->{$_->[0]}->{text} .= $_->[2]; - } + foreach (@{$h}) { + $stuff->{view}->{ $_->[0] }->{text} .= $_->[2]; + } - #### objects with indexes. - map { - $stuff->{indexes}->{$_->[0]}++ - if defined; - } @{$dbh->selectall_arrayref("SELECT DISTINCT object_name(id) + #### objects with indexes. + map { $stuff->{indexes}->{ $_->[0] }++ if defined; } @{ + $dbh->selectall_arrayref( + "SELECT DISTINCT object_name(id) FROM sysindexes WHERE indid > 0 and indid < 255 and - name not like '_WA_Sys%'")}; + name not like '_WA_Sys%'" + ) + }; - ## slurp objects - map { - $stuff->{$_->[1]}->{$_->[0]} = $_; - } @{$dbh->selectall_arrayref("SELECT name,type, id FROM sysobjects")}; + ## slurp objects + map { $stuff->{ $_->[1] }->{ $_->[0] } = $_; } @{ $dbh->selectall_arrayref("SELECT name,type, id FROM sysobjects") }; + ### Procedures - ### Procedures +# This gets legitimate procedures by used the 'supported' API: sp_stored_procedures + map { + my $n = $_->{PROCEDURE_NAME}; + $n =~ s/;\d+$//; # Ignore versions for now + $_->{name} = $n; + $stuff->{procedures}->{$n} = $_; + } values %{ $dbh->selectall_hashref("sp_stored_procedures", 'PROCEDURE_NAME') }; - # This gets legitimate procedures by used the 'supported' API: sp_stored_procedures - map { - my $n = $_->{PROCEDURE_NAME}; - $n =~ s/;\d+$//; # Ignore versions for now - $_->{name} = $n; - $stuff->{procedures}->{$n} = $_; - } values %{$dbh->selectall_hashref("sp_stored_procedures", 'PROCEDURE_NAME')}; + # And this blasts in the text of 'legit' stored procedures. Do + # this rather than calling sp_helptext in a loop. - - # And this blasts in the text of 'legit' stored procedures. Do - # this rather than calling sp_helptext in a loop. - - $h = $dbh->selectall_arrayref(q{ + $h = $dbh->selectall_arrayref( + q{ SELECT o.name, colid,c.text FROM syscomments c JOIN sysobjects o ON c.id = o.id WHERE o.type in ('P', 'FN', 'TF', 'IF') } -); + ); - foreach (@{$h}) { - $stuff->{procedures}->{$_->[0]}->{text} .= $_->[2] - if (defined($stuff->{procedures}->{$_->[0]})); - } + foreach (@{$h}) { + $stuff->{procedures}->{ $_->[0] }->{text} .= $_->[2] + if (defined($stuff->{procedures}->{ $_->[0] })); + } - ### Defaults - ### Rules - ### Bind Defaults - ### Bind Rules + ### Defaults + ### Rules + ### Bind Defaults + ### Bind Rules - ### Triggers - # Since the 'target' of the trigger is defined in the text, we will - # just create them independently for now rather than associating them - # with a table. + ### Triggers + # Since the 'target' of the trigger is defined in the text, we will + # just create them independently for now rather than associating them + # with a table. - $h = $dbh->selectall_arrayref(q{ + $h = $dbh->selectall_arrayref( + q{ SELECT o.name, colid,c.text FROM syscomments c JOIN sysobjects o @@ -151,174 +146,167 @@ SELECT o.name, colid,c.text ORDER BY o.name, c.colid } -); - foreach (@{$h}) { - $stuff->{triggers}->{$_->[0]}->{text} .= $_->[2]; - } - - ### References - ### Keys - - ### Types - # Not sure what to do with these? - $stuff->{type_info_all} = $dbh->type_info_all; - - ### Tables - # According to the DBI docs, these can be - - # "TABLE" - # "VIEW" - # "SYSTEM TABLE" - # "GLOBAL TEMPORARY", - # "LOCAL TEMPORARY" - # "ALIAS" - # "SYNONYM" - - foreach my $table_info (@tables) { - next - unless (defined($table_info->{TABLE_TYPE})); - - if ($table_info->{TABLE_TYPE} eq "TABLE") { - my $table = $schema->add_table( - name => -$table_info->{TABLE_NAME}, - type => -$table_info->{TABLE_TYPE}, - ) || die $schema->error; - - # find the associated columns - - my $cols = - $columns->{$table_info->{TABLE_CAT}} - ->{$table_info->{TABLE_SCHEM}} - ->{$table_info->{TABLE_NAME}} - ->{columns}; - - foreach my $c (values %{$cols}) { - my $is_auto_increment = $c->{TYPE_NAME} =~ s#(\(\))? identity##i; - my $f = $table->add_field( - name => $c->{COLUMN_NAME}, - data_type => $c->{TYPE_NAME}, - order => $c->{ORDINAL_POSITION}, - size => [$c->{COLUMN_SIZE},$c->{DECIMAL_DIGITS}], - ) || die $table->error; - $f->is_nullable($c->{NULLABLE} == 1); - $f->is_auto_increment($is_auto_increment); - if ( defined $c->{COLUMN_DEF}) { - $c->{COLUMN_DEF} =~ s#\('?(.*?)'?\)#$1#; - $f->default_value($c->{COLUMN_DEF}); - } - } - - # add in primary key - my $h = $dbh->selectall_hashref("sp_pkeys -[$table_info->{TABLE_NAME}]", 'COLUMN_NAME'); - if (scalar keys %{$h} >= 1) { - my @c = map { - $_->{COLUMN_NAME} - } sort { - $a->{KEY_SEQ} <=> $b->{KEY_SEQ} - } values %{$h}; - - $table->primary_key(@c) - if (scalar @c); - } - - # add in foreign keys - $h = $dbh->selectall_hashref("sp_fkeys NULL, -\@fktable_name = '[$table_info->{TABLE_NAME}]'", 'FK_NAME'); - foreach my $fk ( values %{$h} ) { - my $constraint = $table->add_constraint( name => $fk->{FK_NAME}, - fields => [$fk->{FKCOLUMN_NAME}], - ); - $constraint->type("FOREIGN_KEY"); - $constraint->on_delete( - $fk->{DELETE_RULE} == 0 ? "CASCADE" : - $fk->{DELETE_RULE} == 1 ? "NO ACTION" : "SET_NULL" - ); - $constraint->on_update( - $fk->{UPDATE_RULE} == 0 ? "CASCADE" : - $fk->{UPDATE_RULE} == 1 ? "NO ACTION" : "SET_NULL" - ); - $constraint->reference_table($fk->{PKTABLE_NAME}); - } - - # add in any indexes ... how do we tell if the index has - # already been created as part of a primary key or other - # constraint? - - if (defined($stuff->{indexes}->{$table_info->{TABLE_NAME}})){ - my $h = $dbh->selectall_hashref("sp_helpindex -[$table_info->{TABLE_NAME}]", 'INDEX_NAME'); - foreach (values %{$h}) { - my $fields = $_->{'INDEX_KEYS'}; - $fields =~ s/\s*//g; - my $i = $table->add_index( - name => -$_->{INDEX_NAME}, - fields => $fields, - ); - if ($_->{'INDEX_DESCRIPTION'} =~ /unique/i) { - $i->type('unique'); - - # we could make this a primary key if there - # isn't already one defined and if there - # aren't any nullable columns in thisindex. - - if (!defined($table->primary_key())) { - $table->primary_key($fields) - unless grep { - $table->get_field($_)->is_nullable() - } split(/,\s*/, $fields); - } - } - } + ); + foreach (@{$h}) { + $stuff->{triggers}->{ $_->[0] }->{text} .= $_->[2]; + } + + ### References + ### Keys + + ### Types + # Not sure what to do with these? + $stuff->{type_info_all} = $dbh->type_info_all; + + ### Tables + # According to the DBI docs, these can be + + # "TABLE" + # "VIEW" + # "SYSTEM TABLE" + # "GLOBAL TEMPORARY", + # "LOCAL TEMPORARY" + # "ALIAS" + # "SYNONYM" + + foreach my $table_info (@tables) { + next + unless (defined($table_info->{TABLE_TYPE})); + + if ($table_info->{TABLE_TYPE} eq "TABLE") { + my $table = $schema->add_table( + name => $table_info->{TABLE_NAME}, + type => $table_info->{TABLE_TYPE}, + ) || die $schema->error; + + # find the associated columns + + my $cols = $columns->{ $table_info->{TABLE_CAT} } + ->{ $table_info->{TABLE_SCHEM} }->{ $table_info->{TABLE_NAME} } + ->{columns}; + + foreach my $c (values %{$cols}) { + my $is_auto_increment = $c->{TYPE_NAME} =~ s#(\(\))? identity##i; + my $f = $table->add_field( + name => $c->{COLUMN_NAME}, + data_type => $c->{TYPE_NAME}, + order => $c->{ORDINAL_POSITION}, + size => [ $c->{COLUMN_SIZE}, $c->{DECIMAL_DIGITS} ], + ) || die $table->error; + $f->is_nullable($c->{NULLABLE} == 1); + $f->is_auto_increment($is_auto_increment); + if (defined $c->{COLUMN_DEF}) { + $c->{COLUMN_DEF} =~ s#\('?(.*?)'?\)#$1#; + $f->default_value($c->{COLUMN_DEF}); + } + } + + # add in primary key + my $h = $dbh->selectall_hashref( + "sp_pkeys +[$table_info->{TABLE_NAME}]", 'COLUMN_NAME' + ); + if (scalar keys %{$h} >= 1) { + my @c = map { $_->{COLUMN_NAME} } + sort { $a->{KEY_SEQ} <=> $b->{KEY_SEQ} } values %{$h}; + + $table->primary_key(@c) + if (scalar @c); + } + + # add in foreign keys + $h = $dbh->selectall_hashref( + "sp_fkeys NULL, +\@fktable_name = '[$table_info->{TABLE_NAME}]'", 'FK_NAME' + ); + foreach my $fk (values %{$h}) { + my $constraint = $table->add_constraint( + name => $fk->{FK_NAME}, + fields => [ $fk->{FKCOLUMN_NAME} ], + ); + $constraint->type("FOREIGN_KEY"); + $constraint->on_delete( + $fk->{DELETE_RULE} == 0 ? "CASCADE" + : $fk->{DELETE_RULE} == 1 ? "NO ACTION" + : "SET_NULL" + ); + $constraint->on_update( + $fk->{UPDATE_RULE} == 0 ? "CASCADE" + : $fk->{UPDATE_RULE} == 1 ? "NO ACTION" + : "SET_NULL" + ); + $constraint->reference_table($fk->{PKTABLE_NAME}); + } + + # add in any indexes ... how do we tell if the index has + # already been created as part of a primary key or other + # constraint? + + if (defined($stuff->{indexes}->{ $table_info->{TABLE_NAME} })) { + my $h = $dbh->selectall_hashref( + "sp_helpindex +[$table_info->{TABLE_NAME}]", 'INDEX_NAME' + ); + foreach (values %{$h}) { + my $fields = $_->{'INDEX_KEYS'}; + $fields =~ s/\s*//g; + my $i = $table->add_index( + name => $_->{INDEX_NAME}, + fields => $fields, + ); + if ($_->{'INDEX_DESCRIPTION'} =~ /unique/i) { + $i->type('unique'); + + # we could make this a primary key if there + # isn't already one defined and if there + # aren't any nullable columns in thisindex. + + if (!defined($table->primary_key())) { + $table->primary_key($fields) + unless grep { $table->get_field($_)->is_nullable() } + split(/,\s*/, $fields); } - } elsif ($table_info->{TABLE_TYPE} eq 'VIEW') { - next if $table_info->{TABLE_NAME} eq 'sysconstraints' - || $table_info->{TABLE_NAME} eq 'syssegments'; - next if !$stuff->{view}->{$table_info->{TABLE_NAME}}->{text}; - my $view = $schema->add_view( - name => -$table_info->{TABLE_NAME}, - ); - - - my $cols = - $columns->{$table_info->{TABLE_CAT}} - ->{$table_info->{TABLE_SCHEM}} - ->{$table_info->{TABLE_NAME}} - ->{columns}; - - $view->fields(map { - $_->{COLUMN_NAME} - } sort { - $a->{ORDINAL_POSITION} <=> $b->{ORDINAL_POSITION} - } values %{$cols} - ); - - $view->sql($stuff->{view}->{$table_info->{TABLE_NAME}}->{text}) - if (defined($stuff->{view}->{$table_info->{TABLE_NAME}}->{text})); + } } + } + } elsif ($table_info->{TABLE_TYPE} eq 'VIEW') { + next + if $table_info->{TABLE_NAME} eq 'sysconstraints' + || $table_info->{TABLE_NAME} eq 'syssegments'; + next if !$stuff->{view}->{ $table_info->{TABLE_NAME} }->{text}; + my $view = $schema->add_view(name => $table_info->{TABLE_NAME},); + + my $cols = $columns->{ $table_info->{TABLE_CAT} } + ->{ $table_info->{TABLE_SCHEM} }->{ $table_info->{TABLE_NAME} } + ->{columns}; + + $view->fields( + map { $_->{COLUMN_NAME} } + sort { $a->{ORDINAL_POSITION} <=> $b->{ORDINAL_POSITION} } values %{$cols} + ); + + $view->sql($stuff->{view}->{ $table_info->{TABLE_NAME} }->{text}) + if (defined($stuff->{view}->{ $table_info->{TABLE_NAME} }->{text})); } - - foreach my $p (values %{$stuff->{procedures}}) { - next if !$p->{text}; - my $proc = $schema->add_procedure( - name => $p->{name}, - owner => $p->{PROCEDURE_OWNER}, - comments => $p->{REMARKS}, - sql => $p->{text}, - ); - - } - - ### Permissions - ### Groups - ### Users - ### Aliases - ### Logins - return 1; + } + + foreach my $p (values %{ $stuff->{procedures} }) { + next if !$p->{text}; + my $proc = $schema->add_procedure( + name => $p->{name}, + owner => $p->{PROCEDURE_OWNER}, + comments => $p->{REMARKS}, + sql => $p->{text}, + ); + + } + + ### Permissions + ### Groups + ### Users + ### Aliases + ### Logins + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DBI/SQLite.pm b/lib/SQL/Translator/Parser/DBI/SQLite.pm index 7f8ceae9b..a112303d0 100644 --- a/lib/SQL/Translator/Parser/DBI/SQLite.pm +++ b/lib/SQL/Translator/Parser/DBI/SQLite.pm @@ -25,24 +25,21 @@ use DBI; use SQL::Translator::Parser::SQLite; use Data::Dumper; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; sub parse { - my ( $tr, $dbh ) = @_; + my ($tr, $dbh) = @_; - my $create = join(";\n", - map { $_ || () } - @{ $dbh->selectcol_arrayref('select sql from sqlite_master') }, - ); - $create .= ";"; - $tr->debug( "create =\n$create\n" ); + my $create = join(";\n", map { $_ || () } @{ $dbh->selectcol_arrayref('select sql from sqlite_master') },); + $create .= ";"; + $tr->debug("create =\n$create\n"); - my $schema = $tr->schema; + my $schema = $tr->schema; - SQL::Translator::Parser::SQLite::parse( $tr, $create ); - return 1; + SQL::Translator::Parser::SQLite::parse($tr, $create); + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/DBI/Sybase.pm b/lib/SQL/Translator/Parser/DBI/Sybase.pm index 7e6a28430..981f95ca8 100644 --- a/lib/SQL/Translator/Parser/DBI/Sybase.pm +++ b/lib/SQL/Translator/Parser/DBI/Sybase.pm @@ -20,54 +20,50 @@ use DBI; use SQL::Translator::Schema; use Data::Dumper; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; no strict 'refs'; sub parse { - my ( $tr, $dbh ) = @_; + my ($tr, $dbh) = @_; - if ($dbh->{FetchHashKeyName} ne 'NAME_uc') { - warn "setting dbh attribute {FetchHashKeyName} to NAME_uc"; - $dbh->{FetchHashKeyName} = 'NAME_uc'; - } + if ($dbh->{FetchHashKeyName} ne 'NAME_uc') { + warn "setting dbh attribute {FetchHashKeyName} to NAME_uc"; + $dbh->{FetchHashKeyName} = 'NAME_uc'; + } - if ($dbh->{ChopBlanks} != 1) { - warn "setting dbh attribute {ChopBlanks} to 1"; - $dbh->{ChopBlanks} = 1; - } + if ($dbh->{ChopBlanks} != 1) { + warn "setting dbh attribute {ChopBlanks} to 1"; + $dbh->{ChopBlanks} = 1; + } - my $schema = $tr->schema; + my $schema = $tr->schema; - my ($sth, @tables, $columns); - my $stuff; + my ($sth, @tables, $columns); + my $stuff; - ### Columns + ### Columns - # it is much quicker to slurp back everything all at once rather - # than make repeated calls + # it is much quicker to slurp back everything all at once rather + # than make repeated calls - $sth = $dbh->column_info(undef, undef, undef, undef); + $sth = $dbh->column_info(undef, undef, undef, undef); + foreach my $c (@{ $sth->fetchall_arrayref({}) }) { + $columns->{ $c->{TABLE_CAT} }->{ $c->{TABLE_SCHEM} } + ->{ $c->{TABLE_NAME} }->{columns}->{ $c->{COLUMN_NAME} } = $c; + } - foreach my $c (@{$sth->fetchall_arrayref({})}) { - $columns - ->{$c->{TABLE_CAT}} - ->{$c->{TABLE_SCHEM}} - ->{$c->{TABLE_NAME}} - ->{columns} - ->{$c->{COLUMN_NAME}}= $c; - } + ### Tables and views - ### Tables and views + # Get a list of the tables and views. + $sth = $dbh->table_info(); + @tables = @{ $sth->fetchall_arrayref({}) }; - # Get a list of the tables and views. - $sth = $dbh->table_info(); - @tables = @{$sth->fetchall_arrayref({})}; - - my $h = $dbh->selectall_arrayref(q{ + my $h = $dbh->selectall_arrayref( + q{ SELECT o.name, colid,colid2,c.text FROM syscomments c JOIN sysobjects o @@ -77,46 +73,44 @@ ORDER BY o.name, c.colid, c.colid2 } -); + ); - # View text - # I had always thought there was something 'hard' about - # reconstructing text from syscomments .. - # this seems to work fine and is certainly not complicated! + # View text + # I had always thought there was something 'hard' about + # reconstructing text from syscomments .. + # this seems to work fine and is certainly not complicated! - foreach (@{$h}) { - $stuff->{view}->{$_->[0]}->{text} .= $_->[3]; - } + foreach (@{$h}) { + $stuff->{view}->{ $_->[0] }->{text} .= $_->[3]; + } - #### objects with indexes. - map { - $stuff->{indexes}->{$_->[0]}++ - if defined; - } @{$dbh->selectall_arrayref("SELECT DISTINCT object_name(id) AS name + #### objects with indexes. + map { $stuff->{indexes}->{ $_->[0] }++ if defined; } @{ + $dbh->selectall_arrayref( + "SELECT DISTINCT object_name(id) AS name FROM sysindexes - WHERE indid > 0")}; + WHERE indid > 0" + ) + }; - ## slurp objects - map { - $stuff->{$_->[1]}->{$_->[0]} = $_; - } @{$dbh->selectall_arrayref("SELECT name,type, id FROM sysobjects")}; + ## slurp objects + map { $stuff->{ $_->[1] }->{ $_->[0] } = $_; } @{ $dbh->selectall_arrayref("SELECT name,type, id FROM sysobjects") }; + ### Procedures - ### Procedures +# This gets legitimate procedures by used the 'supported' API: sp_stored_procedures + map { + my $n = $_->{PROCEDURE_NAME}; + $n =~ s/;\d+$//; # Ignore versions for now + $_->{name} = $n; + $stuff->{procedures}->{$n} = $_; + } values %{ $dbh->selectall_hashref("sp_stored_procedures", 'PROCEDURE_NAME') }; - # This gets legitimate procedures by used the 'supported' API: sp_stored_procedures - map { - my $n = $_->{PROCEDURE_NAME}; - $n =~ s/;\d+$//; # Ignore versions for now - $_->{name} = $n; - $stuff->{procedures}->{$n} = $_; - } values %{$dbh->selectall_hashref("sp_stored_procedures", 'PROCEDURE_NAME')}; + # And this blasts in the text of 'legit' stored procedures. Do + # this rather than calling sp_helptext in a loop. - - # And this blasts in the text of 'legit' stored procedures. Do - # this rather than calling sp_helptext in a loop. - - $h = $dbh->selectall_arrayref(q{ + $h = $dbh->selectall_arrayref( + q{ SELECT o.name, colid,colid2,c.text FROM syscomments c JOIN sysobjects o @@ -126,24 +120,25 @@ ORDER BY o.name, c.colid, c.colid2 } -); + ); - foreach (@{$h}) { - $stuff->{procedures}->{$_->[0]}->{text} .= $_->[3] - if (defined($stuff->{procedures}->{$_->[0]})); - } + foreach (@{$h}) { + $stuff->{procedures}->{ $_->[0] }->{text} .= $_->[3] + if (defined($stuff->{procedures}->{ $_->[0] })); + } - ### Defaults - ### Rules - ### Bind Defaults - ### Bind Rules + ### Defaults + ### Rules + ### Bind Defaults + ### Bind Rules - ### Triggers - # Since the 'target' of the trigger is defined in the text, we will - # just create them independently for now rather than associating them - # with a table. + ### Triggers + # Since the 'target' of the trigger is defined in the text, we will + # just create them independently for now rather than associating them + # with a table. - $h = $dbh->selectall_arrayref(q{ + $h = $dbh->selectall_arrayref( + q{ SELECT o.name, colid,colid2,c.text FROM syscomments c JOIN sysobjects o @@ -155,147 +150,134 @@ ORDER BY o.name, c.colid, c.colid2 } -); - foreach (@{$h}) { - $stuff->{triggers}->{$_->[0]}->{text} .= $_->[3]; - } - - ### References - ### Keys - - ### Types - # Not sure what to do with these? - $stuff->{type_info_all} = $dbh->type_info_all; - - ### Tables - # According to the DBI docs, these can be - - # "TABLE" - # "VIEW" - # "SYSTEM TABLE" - # "GLOBAL TEMPORARY", - # "LOCAL TEMPORARY" - # "ALIAS" - # "SYNONYM" - - foreach my $table_info (@tables) { - next - unless (defined($table_info->{TABLE_TYPE})); - - if ($table_info->{TABLE_TYPE} =~ /TABLE/) { - my $table = $schema->add_table( - name => -$table_info->{TABLE_NAME}, - type => -$table_info->{TABLE_TYPE}, - ) || die $schema->error; - - # find the associated columns - - my $cols = - $columns->{$table_info->{TABLE_QUALIFIER}} - ->{$table_info->{TABLE_OWNER}} - ->{$table_info->{TABLE_NAME}} - ->{columns}; - - foreach my $c (values %{$cols}) { - my $f = $table->add_field( - name => $c->{COLUMN_NAME}, - data_type => $c->{TYPE_NAME}, - order => $c->{ORDINAL_POSITION}, - size => $c->{COLUMN_SIZE}, - ) || die $table->error; - - $f->is_nullable(1) - if ($c->{NULLABLE} == 1); - } - - # add in primary key - my $h = $dbh->selectall_hashref("sp_pkeys -[$table_info->{TABLE_NAME}]", 'COLUMN_NAME'); - if (scalar keys %{$h} > 1) { - my @c = map { - $_->{COLUMN_NAME} - } sort { - $a->{KEY_SEQ} <=> $b->{KEY_SEQ} - } values %{$h}; - - $table->primary_key(@c) - if (scalar @c); - } - - # add in any indexes ... how do we tell if the index has - # already been created as part of a primary key or other - # constraint? - - if (defined($stuff->{indexes}->{$table_info->{TABLE_NAME}})){ - my $h = $dbh->selectall_hashref("sp_helpindex -[$table_info->{TABLE_NAME}]", 'INDEX_NAME'); - foreach (values %{$h}) { - my $fields = $_->{'INDEX_KEYS'}; - $fields =~ s/\s*//g; - my $i = $table->add_index( - name => -$_->{INDEX_NAME}, - fields => $fields, - ); - if ($_->{'INDEX_DESCRIPTION'} =~ /unique/i) { - $i->type('unique'); - - # we could make this a primary key if there - # isn't already one defined and if there - # aren't any nullable columns in thisindex. - - if (!defined($table->primary_key())) { - $table->primary_key($fields) - unless grep { - $table->get_field($_)->is_nullable() - } split(/,\s*/, $fields); - } - } - } + ); + foreach (@{$h}) { + $stuff->{triggers}->{ $_->[0] }->{text} .= $_->[3]; + } + + ### References + ### Keys + + ### Types + # Not sure what to do with these? + $stuff->{type_info_all} = $dbh->type_info_all; + + ### Tables + # According to the DBI docs, these can be + + # "TABLE" + # "VIEW" + # "SYSTEM TABLE" + # "GLOBAL TEMPORARY", + # "LOCAL TEMPORARY" + # "ALIAS" + # "SYNONYM" + + foreach my $table_info (@tables) { + next + unless (defined($table_info->{TABLE_TYPE})); + + if ($table_info->{TABLE_TYPE} =~ /TABLE/) { + my $table = $schema->add_table( + name => $table_info->{TABLE_NAME}, + type => $table_info->{TABLE_TYPE}, + ) || die $schema->error; + + # find the associated columns + + my $cols = $columns->{ $table_info->{TABLE_QUALIFIER} } + ->{ $table_info->{TABLE_OWNER} }->{ $table_info->{TABLE_NAME} } + ->{columns}; + + foreach my $c (values %{$cols}) { + my $f = $table->add_field( + name => $c->{COLUMN_NAME}, + data_type => $c->{TYPE_NAME}, + order => $c->{ORDINAL_POSITION}, + size => $c->{COLUMN_SIZE}, + ) || die $table->error; + + $f->is_nullable(1) + if ($c->{NULLABLE} == 1); + } + + # add in primary key + my $h = $dbh->selectall_hashref( + "sp_pkeys +[$table_info->{TABLE_NAME}]", 'COLUMN_NAME' + ); + if (scalar keys %{$h} > 1) { + my @c = map { $_->{COLUMN_NAME} } + sort { $a->{KEY_SEQ} <=> $b->{KEY_SEQ} } values %{$h}; + + $table->primary_key(@c) + if (scalar @c); + } + + # add in any indexes ... how do we tell if the index has + # already been created as part of a primary key or other + # constraint? + + if (defined($stuff->{indexes}->{ $table_info->{TABLE_NAME} })) { + my $h = $dbh->selectall_hashref( + "sp_helpindex +[$table_info->{TABLE_NAME}]", 'INDEX_NAME' + ); + foreach (values %{$h}) { + my $fields = $_->{'INDEX_KEYS'}; + $fields =~ s/\s*//g; + my $i = $table->add_index( + name => $_->{INDEX_NAME}, + fields => $fields, + ); + if ($_->{'INDEX_DESCRIPTION'} =~ /unique/i) { + $i->type('unique'); + + # we could make this a primary key if there + # isn't already one defined and if there + # aren't any nullable columns in thisindex. + + if (!defined($table->primary_key())) { + $table->primary_key($fields) + unless grep { $table->get_field($_)->is_nullable() } + split(/,\s*/, $fields); } - } elsif ($table_info->{TABLE_TYPE} eq 'VIEW') { - my $view = $schema->add_view( - name => -$table_info->{TABLE_NAME}, - ); - - - my $cols = - $columns->{$table_info->{TABLE_QUALIFIER}} - ->{$table_info->{TABLE_OWNER}} - ->{$table_info->{TABLE_NAME}} - ->{columns}; - - $view->fields(map { - $_->{COLUMN_NAME} - } sort { - $a->{ORDINAL_POSITION} <=> $b->{ORDINAL_POSITION} - } values %{$cols} - ); - - $view->sql($stuff->{view}->{$table_info->{TABLE_NAME}}->{text}) - if (defined($stuff->{view}->{$table_info->{TABLE_NAME}}->{text})); + } } - } + } + } elsif ($table_info->{TABLE_TYPE} eq 'VIEW') { + my $view = $schema->add_view(name => $table_info->{TABLE_NAME},); - foreach my $p (values %{$stuff->{procedures}}) { - my $proc = $schema->add_procedure( - name => $p->{name}, - owner => $p->{PROCEDURE_OWNER}, - comments => $p->{REMARKS}, - sql => $p->{text}, - ); + my $cols = $columns->{ $table_info->{TABLE_QUALIFIER} } + ->{ $table_info->{TABLE_OWNER} }->{ $table_info->{TABLE_NAME} } + ->{columns}; - } + $view->fields( + map { $_->{COLUMN_NAME} } + sort { $a->{ORDINAL_POSITION} <=> $b->{ORDINAL_POSITION} } values %{$cols} + ); - ### Permissions - ### Groups - ### Users - ### Aliases - ### Logins - return 1; + $view->sql($stuff->{view}->{ $table_info->{TABLE_NAME} }->{text}) + if (defined($stuff->{view}->{ $table_info->{TABLE_NAME} }->{text})); + } + } + + foreach my $p (values %{ $stuff->{procedures} }) { + my $proc = $schema->add_procedure( + name => $p->{name}, + owner => $p->{PROCEDURE_OWNER}, + comments => $p->{REMARKS}, + sql => $p->{text}, + ); + + } + + ### Permissions + ### Groups + ### Users + ### Aliases + ### Logins + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/Excel.pm b/lib/SQL/Translator/Parser/Excel.pm index 5aeb85c43..83d30caf5 100644 --- a/lib/SQL/Translator/Parser/Excel.pm +++ b/lib/SQL/Translator/Parser/Excel.pm @@ -42,10 +42,10 @@ use base qw(Exporter); @EXPORT_OK = qw(parse); -my %ET_to_ST = ( - 'Text' => 'VARCHAR', - 'Date' => 'DATETIME', - 'Numeric' => 'DOUBLE', +my %ET_to_ST = ( + 'Text' => 'VARCHAR', + 'Date' => 'DATETIME', + 'Numeric' => 'DOUBLE', ); # ------------------------------------------------------------------- @@ -55,128 +55,115 @@ my %ET_to_ST = ( # Spreadsheet::ParseExcel works on files, not data streams. # ------------------------------------------------------------------- sub parse { - my ($tr, $data) = @_; - my $args = $tr->parser_args; - my $filename = $tr->filename || return; - my $wb = Spreadsheet::ParseExcel::Workbook->Parse( $filename ); - my $schema = $tr->schema; - my $table_no = 0; - - my $wb_count = $wb->{'SheetCount'} || 0; - for my $num ( 0 .. $wb_count - 1 ) { - $table_no++; - my $ws = $wb->Worksheet( $num ); - my $table_name = normalize_name( $ws->{'Name'} || "Table$table_no" ); - - my @cols = $ws->ColRange; - next unless $cols[1] > 0; - - my $table = $schema->add_table( name => $table_name ); - - my @field_names = (); - for my $col ( $cols[0] .. $cols[1] ) { - my $cell = $ws->Cell(0, $col); - my $col_name = normalize_name( $cell->{'Val'} ); - my $data_type = ET_to_ST( $cell->{'Type'} ); - push @field_names, $col_name; - - my $field = $table->add_field( - name => $col_name, - data_type => $data_type, - default_value => '', - size => 255, - is_nullable => 1, - is_auto_increment => undef, - ) or die $table->error; - - if ( $col == 0 ) { - $table->primary_key( $field->name ); - $field->is_primary_key(1); - } - } + my ($tr, $data) = @_; + my $args = $tr->parser_args; + my $filename = $tr->filename || return; + my $wb = Spreadsheet::ParseExcel::Workbook->Parse($filename); + my $schema = $tr->schema; + my $table_no = 0; + + my $wb_count = $wb->{'SheetCount'} || 0; + for my $num (0 .. $wb_count - 1) { + $table_no++; + my $ws = $wb->Worksheet($num); + my $table_name = normalize_name($ws->{'Name'} || "Table$table_no"); + + my @cols = $ws->ColRange; + next unless $cols[1] > 0; + + my $table = $schema->add_table(name => $table_name); + + my @field_names = (); + for my $col ($cols[0] .. $cols[1]) { + my $cell = $ws->Cell(0, $col); + my $col_name = normalize_name($cell->{'Val'}); + my $data_type = ET_to_ST($cell->{'Type'}); + push @field_names, $col_name; + + my $field = $table->add_field( + name => $col_name, + data_type => $data_type, + default_value => '', + size => 255, + is_nullable => 1, + is_auto_increment => undef, + ) or die $table->error; + + if ($col == 0) { + $table->primary_key($field->name); + $field->is_primary_key(1); + } + } - # - # If directed, look at every field's values to guess size and type. - # - unless ( - defined $args->{'scan_fields'} && - $args->{'scan_fields'} == 0 - ) { - my %field_info = map { $_, {} } @field_names; - - for( - my $iR = $ws->{'MinRow'} == 0 ? 1 : $ws->{'MinRow'}; - defined $ws->{'MaxRow'} && $iR <= $ws->{'MaxRow'}; - $iR++ - ) { - for ( - my $iC = $ws->{'MinCol'}; - defined $ws->{'MaxCol'} && $iC <= $ws->{'MaxCol'}; - $iC++ - ) { - my $field = $field_names[ $iC ]; - my $data = $ws->{'Cells'}[ $iR ][ $iC ]->{'_Value'}; - next if !defined $data || $data eq ''; - my $size = [ length $data ]; - my $type; - - if ( $data =~ /^-?\d+$/ ) { - $type = 'integer'; - } - elsif ( - $data =~ /^-?[,\d]+\.[\d+]?$/ - || - $data =~ /^-?[,\d]+?\.\d+$/ - || - $data =~ /^-?\.\d+$/ - ) { - $type = 'float'; - my ( $w, $d ) = - map { s/,//g; length $_ || 1 } - split( /\./, $data ) - ; - $size = [ $w + $d, $d ]; - } - else { - $type = 'char'; - } - - for my $i ( 0, 1 ) { - next unless defined $size->[ $i ]; - my $fsize = $field_info{ $field }{'size'}[ $i ] || 0; - if ( $size->[ $i ] > $fsize ) { - $field_info{ $field }{'size'}[ $i ] = $size->[ $i ]; - } - } - - $field_info{ $field }{ $type }++; - } + # + # If directed, look at every field's values to guess size and type. + # + unless (defined $args->{'scan_fields'} + && $args->{'scan_fields'} == 0) { + my %field_info = map { $_, {} } @field_names; + + for ( + my $iR = $ws->{'MinRow'} == 0 ? 1 : $ws->{'MinRow'}; + defined $ws->{'MaxRow'} && $iR <= $ws->{'MaxRow'}; + $iR++ + ) { + for (my $iC = $ws->{'MinCol'}; defined $ws->{'MaxCol'} && $iC <= $ws->{'MaxCol'}; $iC++) { + my $field = $field_names[$iC]; + my $data = $ws->{'Cells'}[$iR][$iC]->{'_Value'}; + next if !defined $data || $data eq ''; + my $size = [ length $data ]; + my $type; + + if ($data =~ /^-?\d+$/) { + $type = 'integer'; + } elsif ($data =~ /^-?[,\d]+\.[\d+]?$/ + || $data =~ /^-?[,\d]+?\.\d+$/ + || $data =~ /^-?\.\d+$/) { + $type = 'float'; + my ($w, $d) = map { s/,//g; length $_ || 1 } + split(/\./, $data); + $size = [ $w + $d, $d ]; + } else { + $type = 'char'; + } + + for my $i (0, 1) { + next unless defined $size->[$i]; + my $fsize = $field_info{$field}{'size'}[$i] || 0; + if ($size->[$i] > $fsize) { + $field_info{$field}{'size'}[$i] = $size->[$i]; } + } - for my $field ( keys %field_info ) { - my $size = $field_info{ $field }{'size'} || [ 1 ]; - my $data_type = - $field_info{ $field }{'char'} ? 'char' : - $field_info{ $field }{'float'} ? 'float' : - $field_info{ $field }{'integer'} ? 'integer' : 'char'; - - if ( $data_type eq 'char' && scalar @$size == 2 ) { - $size = [ $size->[0] + $size->[1] ]; - } - - my $field = $table->get_field( $field ); - $field->size( $size ) if $size; - $field->data_type( $data_type ); - } + $field_info{$field}{$type}++; } + } + + for my $field (keys %field_info) { + my $size = $field_info{$field}{'size'} || [1]; + my $data_type + = $field_info{$field}{'char'} ? 'char' + : $field_info{$field}{'float'} ? 'float' + : $field_info{$field}{'integer'} ? 'integer' + : 'char'; + + if ($data_type eq 'char' && scalar @$size == 2) { + $size = [ $size->[0] + $size->[1] ]; + } + + my $field = $table->get_field($field); + $field->size($size) if $size; + $field->data_type($data_type); + } } + } - return 1; + return 1; } sub ET_to_ST { - my $et = shift; - $ET_to_ST{$et} || $ET_to_ST{'Text'}; + my $et = shift; + $ET_to_ST{$et} || $ET_to_ST{'Text'}; } 1; diff --git a/lib/SQL/Translator/Parser/JSON.pm b/lib/SQL/Translator/Parser/JSON.pm index 823025e8f..57bbaaf7d 100644 --- a/lib/SQL/Translator/Parser/JSON.pm +++ b/lib/SQL/Translator/Parser/JSON.pm @@ -10,113 +10,100 @@ use Data::Dumper; use JSON::MaybeXS 'from_json'; sub parse { - my ($translator, $data) = @_; - $data = from_json($data); - $data = $data->{'schema'}; - - warn "JSON data:", Dumper($data) if $translator->debug; - - my $schema = $translator->schema; - - # - # Tables - # - my @tables = - map { $data->{'tables'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'tables'}{ $_ }{'order'} || 0, $_ ] } - keys %{ $data->{'tables'} } - ; - - for my $tdata ( @tables ) { - - my $table = $schema->add_table( - map { - $tdata->{$_} ? ($_ => $tdata->{$_}) : () - } (qw/name extra options/) - ) or die $schema->error; - - my @fields = - map { $tdata->{'fields'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $tdata->{'fields'}{ $_ }{'order'}, $_ ] } - keys %{ $tdata->{'fields'} } - ; - - for my $fdata ( @fields ) { - $table->add_field( %$fdata ) or die $table->error; - $table->primary_key( $fdata->{'name'} ) - if $fdata->{'is_primary_key'}; - } - - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - $table->add_index( %$idata ) or die $table->error; - } - - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - $table->add_constraint( %$cdata ) or die $table->error; - } - - $table->comments( $tdata->{'comments' } ) - if exists $tdata->{'comments'}; + my ($translator, $data) = @_; + $data = from_json($data); + $data = $data->{'schema'}; - } + warn "JSON data:", Dumper($data) if $translator->debug; - # - # Views - # - my @views = - map { $data->{'views'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'views'}{ $_ }{'order'}, $_ ] } - keys %{ $data->{'views'} } - ; - - for my $vdata ( @views ) { - $schema->add_view( %$vdata ) or die $schema->error; - } + my $schema = $translator->schema; + + # + # Tables + # + my @tables = map { $data->{'tables'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'tables'}{$_}{'order'} || 0, $_ ] } + keys %{ $data->{'tables'} }; + + for my $tdata (@tables) { + + my $table = $schema->add_table(map { $tdata->{$_} ? ($_ => $tdata->{$_}) : () } (qw/name extra options/)) + or die $schema->error; + + my @fields = map { $tdata->{'fields'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $tdata->{'fields'}{$_}{'order'}, $_ ] } + keys %{ $tdata->{'fields'} }; - # - # Triggers - # - my @triggers = - map { $data->{'triggers'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'triggers'}{ $_ }{'order'}, $_ ] } - keys %{ $data->{'triggers'} } - ; - - for my $tdata ( @triggers ) { - $schema->add_trigger( %$tdata ) or die $schema->error; + for my $fdata (@fields) { + $table->add_field(%$fdata) or die $table->error; + $table->primary_key($fdata->{'name'}) + if $fdata->{'is_primary_key'}; } - # - # Procedures - # - my @procedures = - map { $data->{'procedures'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'procedures'}{ $_ }{'order'}, $_ ] } - keys %{ $data->{'procedures'} } - ; - - for my $tdata ( @procedures ) { - $schema->add_procedure( %$tdata ) or die $schema->error; + for my $idata (@{ $tdata->{'indices'} || [] }) { + $table->add_index(%$idata) or die $table->error; } - if ( my $tr_data = $data->{'translator'} ) { - $translator->add_drop_table( $tr_data->{'add_drop_table'} ); - $translator->filename( $tr_data->{'filename'} ); - $translator->no_comments( $tr_data->{'no_comments'} ); - $translator->parser_args( $tr_data->{'parser_args'} ); - $translator->producer_args( $tr_data->{'producer_args'} ); - $translator->parser_type( $tr_data->{'parser_type'} ); - $translator->producer_type( $tr_data->{'producer_type'} ); - $translator->show_warnings( $tr_data->{'show_warnings'} ); - $translator->trace( $tr_data->{'trace'} ); + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + $table->add_constraint(%$cdata) or die $table->error; } - return 1; + $table->comments($tdata->{'comments'}) + if exists $tdata->{'comments'}; + + } + + # + # Views + # + my @views = map { $data->{'views'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'views'}{$_}{'order'}, $_ ] } + keys %{ $data->{'views'} }; + + for my $vdata (@views) { + $schema->add_view(%$vdata) or die $schema->error; + } + + # + # Triggers + # + my @triggers = map { $data->{'triggers'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'triggers'}{$_}{'order'}, $_ ] } + keys %{ $data->{'triggers'} }; + + for my $tdata (@triggers) { + $schema->add_trigger(%$tdata) or die $schema->error; + } + + # + # Procedures + # + my @procedures = map { $data->{'procedures'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'procedures'}{$_}{'order'}, $_ ] } + keys %{ $data->{'procedures'} }; + + for my $tdata (@procedures) { + $schema->add_procedure(%$tdata) or die $schema->error; + } + + if (my $tr_data = $data->{'translator'}) { + $translator->add_drop_table($tr_data->{'add_drop_table'}); + $translator->filename($tr_data->{'filename'}); + $translator->no_comments($tr_data->{'no_comments'}); + $translator->parser_args($tr_data->{'parser_args'}); + $translator->producer_args($tr_data->{'producer_args'}); + $translator->parser_type($tr_data->{'parser_type'}); + $translator->producer_type($tr_data->{'producer_type'}); + $translator->show_warnings($tr_data->{'show_warnings'}); + $translator->trace($tr_data->{'trace'}); + } + + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index 3a784bdd2..29a8dc930 100644 --- a/lib/SQL/Translator/Parser/MySQL.pm +++ b/lib/SQL/Translator/Parser/MySQL.pm @@ -135,11 +135,11 @@ use warnings; our $VERSION = '1.64'; our $DEBUG; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use Data::Dumper; -use Storable qw(dclone); -use DBI qw(:sql_types); +use Storable qw(dclone); +use DBI qw(:sql_types); use SQL::Translator::Utils qw/parse_mysql_version ddl_parser_instance/; use base qw(Exporter); @@ -913,276 +913,252 @@ CURRENT_TIMESTAMP : END_OF_GRAMMAR sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - # Make sure the parser dies when it encounters an error - local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; - # Enable warnings. This will warn on unused rules &c. - local $::RD_WARN = 1 unless defined $::RD_WARN; - # Give out hints to help fix problems. - local $::RD_HINT = 1 unless defined $::RD_HINT; - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('MySQL'); - - # Preprocess for MySQL-specific and not-before-version comments - # from mysqldump - my $parser_version = parse_mysql_version( - $translator->parser_args->{mysql_parser_version}, 'mysql' - ) || DEFAULT_PARSER_VERSION; - - while ( $data =~ - s#/\*!(\d{5})?(.*?)\*/#($1 && $1 > $parser_version ? '' : $2)#es - ) { - # do nothing; is there a better way to write this? -- ky - } + my ($translator, $data) = @_; - my $result = $parser->startrule($data); - return $translator->error( "Parse failed." ) unless defined $result; - warn "Parse result:".Dumper( $result ) if $DEBUG; - - my $schema = $translator->schema; - $schema->name($result->{'database_name'}) if $result->{'database_name'}; - - my @tables = sort { - $result->{'tables'}{ $a }{'order'} - <=> - $result->{'tables'}{ $b }{'order'} - } keys %{ $result->{'tables'} }; - - for my $table_name ( @tables ) { - my $tdata = $result->{tables}{ $table_name }; - my $table = $schema->add_table( - name => $tdata->{'table_name'}, - ) or die $schema->error; - - $table->comments( $tdata->{'comments'} ); - - my @fields = sort { - $tdata->{'fields'}->{$a}->{'order'} - <=> - $tdata->{'fields'}->{$b}->{'order'} - } keys %{ $tdata->{'fields'} }; - - for my $fname ( @fields ) { - my $fdata = $tdata->{'fields'}{ $fname }; - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, - is_nullable => $fdata->{'null'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata->{'is_primary_key'}; - - for my $qual ( qw[ binary unsigned zerofill list collate ], - 'character set', 'on update' ) { - if ( my $val = $fdata->{ $qual } || $fdata->{ uc $qual } ) { - next if ref $val eq 'ARRAY' && !@$val; - $field->extra( $qual, $val ); - } - } + # Enable warnings within the Parse::RecDescent module. + # Make sure the parser dies when it encounters an error + local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; - if ( $fdata->{'has_index'} ) { - $table->add_index( - name => '', - type => 'NORMAL', - fields => $fdata->{'name'}, - ) or die $table->error; - } + # Enable warnings. This will warn on unused rules &c. + local $::RD_WARN = 1 unless defined $::RD_WARN; - if ( $fdata->{'is_unique'} ) { - $table->add_constraint( - name => '', - type => 'UNIQUE', - fields => $fdata->{'name'}, - ) or die $table->error; - } + # Give out hints to help fix problems. + local $::RD_HINT = 1 unless defined $::RD_HINT; + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; - for my $cdata ( @{ $fdata->{'constraints'} } ) { - next unless $cdata->{'type'} eq 'foreign_key'; - $cdata->{'fields'} ||= [ $field->name ]; - push @{ $tdata->{'constraints'} }, $cdata; - } + my $parser = ddl_parser_instance('MySQL'); - } + # Preprocess for MySQL-specific and not-before-version comments + # from mysqldump + my $parser_version = parse_mysql_version($translator->parser_args->{mysql_parser_version}, 'mysql') + || DEFAULT_PARSER_VERSION; - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc $idata->{'type'}, - fields => $idata->{'fields'}, - ) or die $table->error; - } + while ($data =~ s#/\*!(\d{5})?(.*?)\*/#($1 && $1 > $parser_version ? '' : $2)#es) { + # do nothing; is there a better way to write this? -- ky + } - if ( my @options = @{ $tdata->{'table_options'} || [] } ) { - my @cleaned_options; - my @ignore_opts = $translator->parser_args->{'ignore_opts'} - ? split( /,/, $translator->parser_args->{'ignore_opts'} ) - : (); - if (@ignore_opts) { - my $ignores = { map { $_ => 1 } @ignore_opts }; - foreach my $option (@options) { - # make sure the option isn't in ignore list - my ($option_key) = keys %$option; - if ( !exists $ignores->{$option_key} ) { - push @cleaned_options, $option; - } - } - } else { - @cleaned_options = @options; - } - $table->options( \@cleaned_options ) or die $table->error; - } + my $result = $parser->startrule($data); + return $translator->error("Parse failed.") unless defined $result; + warn "Parse result:" . Dumper($result) if $DEBUG; + + my $schema = $translator->schema; + $schema->name($result->{'database_name'}) if $result->{'database_name'}; + + my @tables + = sort { $result->{'tables'}{$a}{'order'} <=> $result->{'tables'}{$b}{'order'} } keys %{ $result->{'tables'} }; + + for my $table_name (@tables) { + my $tdata = $result->{tables}{$table_name}; + my $table = $schema->add_table(name => $tdata->{'table_name'},) + or die $schema->error; + + $table->comments($tdata->{'comments'}); - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - my $constraint = $table->add_constraint( - name => $cdata->{'name'}, - type => $cdata->{'type'}, - fields => $cdata->{'fields'}, - expression => $cdata->{'expression'}, - reference_table => $cdata->{'reference_table'}, - reference_fields => $cdata->{'reference_fields'}, - match_type => $cdata->{'match_type'} || '', - on_delete => $cdata->{'on_delete'} - || $cdata->{'on_delete_do'}, - on_update => $cdata->{'on_update'} - || $cdata->{'on_update_do'}, - ) or die $table->error; + my @fields = sort { $tdata->{'fields'}->{$a}->{'order'} <=> $tdata->{'fields'}->{$b}->{'order'} } + keys %{ $tdata->{'fields'} }; + + for my $fname (@fields) { + my $fdata = $tdata->{'fields'}{$fname}; + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_inc'}, + is_nullable => $fdata->{'null'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + + $table->primary_key($field->name) if $fdata->{'is_primary_key'}; + + for my $qual (qw[ binary unsigned zerofill list collate ], 'character set', 'on update') { + if (my $val = $fdata->{$qual} || $fdata->{ uc $qual }) { + next if ref $val eq 'ARRAY' && !@$val; + $field->extra($qual, $val); } + } + + if ($fdata->{'has_index'}) { + $table->add_index( + name => '', + type => 'NORMAL', + fields => $fdata->{'name'}, + ) or die $table->error; + } + + if ($fdata->{'is_unique'}) { + $table->add_constraint( + name => '', + type => 'UNIQUE', + fields => $fdata->{'name'}, + ) or die $table->error; + } + + for my $cdata (@{ $fdata->{'constraints'} }) { + next unless $cdata->{'type'} eq 'foreign_key'; + $cdata->{'fields'} ||= [ $field->name ]; + push @{ $tdata->{'constraints'} }, $cdata; + } - # After the constrains and PK/idxs have been created, - # we normalize fields - normalize_field($_) for $table->get_fields; } - my @procedures = sort { - $result->{procedures}->{ $a }->{'order'} - <=> - $result->{procedures}->{ $b }->{'order'} - } keys %{ $result->{procedures} }; - - for my $proc_name ( @procedures ) { - $schema->add_procedure( - name => $proc_name, - owner => $result->{procedures}->{$proc_name}->{owner}, - sql => $result->{procedures}->{$proc_name}->{sql}, - ); + for my $idata (@{ $tdata->{'indices'} || [] }) { + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc $idata->{'type'}, + fields => $idata->{'fields'}, + ) or die $table->error; } - my @views = sort { - $result->{views}->{ $a }->{'order'} - <=> - $result->{views}->{ $b }->{'order'} - } keys %{ $result->{views} }; - - for my $view_name ( @views ) { - my $view = $result->{'views'}{ $view_name }; - my @flds = map { $_->{'alias'} || $_->{'name'} } - @{ $view->{'select'}{'columns'} || [] }; - my @from = map { $_->{'alias'} || $_->{'name'} } - @{ $view->{'from'}{'tables'} || [] }; - - $schema->add_view( - name => $view_name, - sql => $view->{'sql'}, - order => $view->{'order'}, - fields => \@flds, - tables => \@from, - options => $view->{'options'} - ); + if (my @options = @{ $tdata->{'table_options'} || [] }) { + my @cleaned_options; + my @ignore_opts + = $translator->parser_args->{'ignore_opts'} + ? split(/,/, $translator->parser_args->{'ignore_opts'}) + : (); + if (@ignore_opts) { + my $ignores = { map { $_ => 1 } @ignore_opts }; + foreach my $option (@options) { + + # make sure the option isn't in ignore list + my ($option_key) = keys %$option; + if (!exists $ignores->{$option_key}) { + push @cleaned_options, $option; + } + } + } else { + @cleaned_options = @options; + } + $table->options(\@cleaned_options) or die $table->error; } - return 1; + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + my $constraint = $table->add_constraint( + name => $cdata->{'name'}, + type => $cdata->{'type'}, + fields => $cdata->{'fields'}, + expression => $cdata->{'expression'}, + reference_table => $cdata->{'reference_table'}, + reference_fields => $cdata->{'reference_fields'}, + match_type => $cdata->{'match_type'} || '', + on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, + on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, + ) or die $table->error; + } + + # After the constrains and PK/idxs have been created, + # we normalize fields + normalize_field($_) for $table->get_fields; + } + + my @procedures = sort { $result->{procedures}->{$a}->{'order'} <=> $result->{procedures}->{$b}->{'order'} } + keys %{ $result->{procedures} }; + + for my $proc_name (@procedures) { + $schema->add_procedure( + name => $proc_name, + owner => $result->{procedures}->{$proc_name}->{owner}, + sql => $result->{procedures}->{$proc_name}->{sql}, + ); + } + + my @views + = sort { $result->{views}->{$a}->{'order'} <=> $result->{views}->{$b}->{'order'} } keys %{ $result->{views} }; + + for my $view_name (@views) { + my $view = $result->{'views'}{$view_name}; + my @flds = map { $_->{'alias'} || $_->{'name'} } @{ $view->{'select'}{'columns'} || [] }; + my @from = map { $_->{'alias'} || $_->{'name'} } @{ $view->{'from'}{'tables'} || [] }; + + $schema->add_view( + name => $view_name, + sql => $view->{'sql'}, + order => $view->{'order'}, + fields => \@flds, + tables => \@from, + options => $view->{'options'} + ); + } + + return 1; } # Takes a field, and returns sub normalize_field { - my ($field) = @_; - my ($size, $type, $list, $unsigned, $changed); - - $size = $field->size; - $type = $field->data_type; - $list = $field->extra->{list} || []; - $unsigned = defined($field->extra->{unsigned}); - - if ( !ref $size && $size eq 0 ) { - if ( lc $type eq 'tinyint' ) { - $changed = $size != 4 - $unsigned; - $size = 4 - $unsigned; - } - elsif ( lc $type eq 'smallint' ) { - $changed = $size != 6 - $unsigned; - $size = 6 - $unsigned; - } - elsif ( lc $type eq 'mediumint' ) { - $changed = $size != 9 - $unsigned; - $size = 9 - $unsigned; - } - elsif ( $type =~ /^int(eger)?$/i ) { - $changed = $size != 11 - $unsigned || $type ne 'int'; - $type = 'int'; - $size = 11 - $unsigned; - } - elsif ( lc $type eq 'bigint' ) { - $changed = $size != 20; - $size = 20; - } - elsif ( lc $type =~ /(float|double|decimal|numeric|real|fixed|dec)/ ) { - my $old_size = (ref $size || '') eq 'ARRAY' ? $size : []; - $changed = @$old_size != 2 - || $old_size->[0] != 8 - || $old_size->[1] != 2; - $size = [8,2]; - } + my ($field) = @_; + my ($size, $type, $list, $unsigned, $changed); + + $size = $field->size; + $type = $field->data_type; + $list = $field->extra->{list} || []; + $unsigned = defined($field->extra->{unsigned}); + + if (!ref $size && $size eq 0) { + if (lc $type eq 'tinyint') { + $changed = $size != 4 - $unsigned; + $size = 4 - $unsigned; + } elsif (lc $type eq 'smallint') { + $changed = $size != 6 - $unsigned; + $size = 6 - $unsigned; + } elsif (lc $type eq 'mediumint') { + $changed = $size != 9 - $unsigned; + $size = 9 - $unsigned; + } elsif ($type =~ /^int(eger)?$/i) { + $changed = $size != 11 - $unsigned || $type ne 'int'; + $type = 'int'; + $size = 11 - $unsigned; + } elsif (lc $type eq 'bigint') { + $changed = $size != 20; + $size = 20; + } elsif (lc $type =~ /(float|double|decimal|numeric|real|fixed|dec)/) { + my $old_size = (ref $size || '') eq 'ARRAY' ? $size : []; + $changed + = @$old_size != 2 + || $old_size->[0] != 8 + || $old_size->[1] != 2; + $size = [ 8, 2 ]; } - - if ( $type =~ /^tiny(text|blob)$/i ) { - $changed = $size != 255; - $size = 255; - } - elsif ( $type =~ /^(blob|text)$/i ) { - $changed = $size != 65_535; - $size = 65_535; - } - elsif ( $type =~ /^medium(blob|text)$/i ) { - $changed = $size != 16_777_215; - $size = 16_777_215; - } - elsif ( $type =~ /^long(blob|text)$/i ) { - $changed = $size != 4_294_967_295; - $size = 4_294_967_295; - } - - if ( $field->data_type =~ /(set|enum)/i && !$field->size ) { - my %extra = $field->extra; - my $longest = 0; - for my $len ( map { length } @{ $extra{'list'} || [] } ) { - $longest = $len if $len > $longest; - } - $changed = 1; - $size = $longest if $longest; + } + + if ($type =~ /^tiny(text|blob)$/i) { + $changed = $size != 255; + $size = 255; + } elsif ($type =~ /^(blob|text)$/i) { + $changed = $size != 65_535; + $size = 65_535; + } elsif ($type =~ /^medium(blob|text)$/i) { + $changed = $size != 16_777_215; + $size = 16_777_215; + } elsif ($type =~ /^long(blob|text)$/i) { + $changed = $size != 4_294_967_295; + $size = 4_294_967_295; + } + + if ($field->data_type =~ /(set|enum)/i && !$field->size) { + my %extra = $field->extra; + my $longest = 0; + for my $len (map {length} @{ $extra{'list'} || [] }) { + $longest = $len if $len > $longest; } + $changed = 1; + $size = $longest if $longest; + } + if ($changed) { - if ( $changed ) { - # We only want to clone the field, not *everything* - { - local $field->{table} = undef; - $field->parsed_field( dclone( $field ) ); - $field->parsed_field->{table} = $field->table; - } - $field->size( $size ); - $field->data_type( $type ); - $field->sql_data_type( $type_mapping{ lc $type } ) - if exists $type_mapping{ lc $type }; - $field->extra->{list} = $list if @$list; + # We only want to clone the field, not *everything* + { + local $field->{table} = undef; + $field->parsed_field(dclone($field)); + $field->parsed_field->{table} = $field->table; } + $field->size($size); + $field->data_type($type); + $field->sql_data_type($type_mapping{ lc $type }) + if exists $type_mapping{ lc $type }; + $field->extra->{list} = $list if @$list; + } } 1; diff --git a/lib/SQL/Translator/Parser/Oracle.pm b/lib/SQL/Translator/Parser/Oracle.pm index 7d1d19f33..a510f6b1d 100644 --- a/lib/SQL/Translator/Parser/Oracle.pm +++ b/lib/SQL/Translator/Parser/Oracle.pm @@ -634,125 +634,114 @@ CURRENT_TIMESTAMP : END_OF_GRAMMAR sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - local $::RD_ERRORS = 1 - unless defined - $::RD_ERRORS; # Make sure the parser dies when it encounters an error - local $::RD_WARN = 1 - unless - defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. - local $::RD_HINT = 1 - unless defined $::RD_HINT; # Give out hints to help fix problems. - - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('Oracle'); - - my $result = $parser->startrule($data); - die "Parse failed.\n" unless defined $result; - if ($DEBUG) { - warn "Parser results =\n", Dumper($result), "\n"; - } - - my $schema = $translator->schema; - my $indices = $result->{'indices'}; - my $constraints = $result->{'constraints'}; - my @tables = sort { - $result->{'tables'}{$a}{'order'} <=> $result->{'tables'}{$b}{'order'} - } keys %{ $result->{'tables'} }; - - for my $table_name (@tables) { - my $tdata = $result->{'tables'}{$table_name}; - next unless $tdata->{'table_name'}; - my $table = $schema->add_table( - name => $tdata->{'table_name'}, - comments => $tdata->{'comments'}, - ) or die $schema->error; - - $table->options( $tdata->{'table_options'} ); - - my @fields = sort { - $tdata->{'fields'}->{$a}->{'order'} - <=> $tdata->{'fields'}->{$b}->{'order'} - } keys %{ $tdata->{'fields'} }; - - for my $fname (@fields) { - my $fdata = $tdata->{'fields'}{$fname}; - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, - is_nullable => $fdata->{'null'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - } - - push @{ $tdata->{'indices'} }, @{ $indices->{$table_name} || [] }; - push @{ $tdata->{'constraints'} }, - @{ $constraints->{$table_name} || [] }; - - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc $idata->{'type'}, - fields => $idata->{'fields'}, - ) or die $table->error; - } - - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - my $constraint = $table->add_constraint( - name => $cdata->{'name'}, - type => $cdata->{'type'}, - fields => $cdata->{'fields'}, - expression => $cdata->{'expression'}, - reference_table => $cdata->{'reference_table'}, - reference_fields => $cdata->{'reference_fields'}, - match_type => $cdata->{'match_type'} || '', - on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, - on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, - ) or die $table->error; - } - } - - my @procedures = sort { - $result->{procedures}->{$a}->{'order'} - <=> $result->{procedures}->{$b}->{'order'} - } keys %{ $result->{procedures} }; - foreach my $proc_name (@procedures) { - $schema->add_procedure( - name => $proc_name, - owner => $result->{procedures}->{$proc_name}->{owner}, - sql => $result->{procedures}->{$proc_name}->{sql}, - ); - } - - my @views = sort { - $result->{views}->{$a}->{'order'} <=> $result->{views}->{$b}->{'order'} - } keys %{ $result->{views} }; - foreach my $view_name ( keys %{ $result->{views} } ) { - $schema->add_view( - name => $view_name, - sql => $result->{views}->{$view_name}->{sql}, - ); - } - - my @triggers = sort { - $result->{triggers}->{$a}->{'order'} - <=> $result->{triggers}->{$b}->{'order'} - } keys %{ $result->{triggers} }; - foreach my $trigger_name (@triggers) { - $schema->add_trigger( - name => $trigger_name, - action => $result->{triggers}->{$trigger_name}->{action}, - ); - } - - return 1; + my ($translator, $data) = @_; + + # Enable warnings within the Parse::RecDescent module. + local $::RD_ERRORS = 1 + unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error + local $::RD_WARN = 1 + unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. + local $::RD_HINT = 1 + unless defined $::RD_HINT; # Give out hints to help fix problems. + + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; + + my $parser = ddl_parser_instance('Oracle'); + + my $result = $parser->startrule($data); + die "Parse failed.\n" unless defined $result; + if ($DEBUG) { + warn "Parser results =\n", Dumper($result), "\n"; + } + + my $schema = $translator->schema; + my $indices = $result->{'indices'}; + my $constraints = $result->{'constraints'}; + my @tables + = sort { $result->{'tables'}{$a}{'order'} <=> $result->{'tables'}{$b}{'order'} } keys %{ $result->{'tables'} }; + + for my $table_name (@tables) { + my $tdata = $result->{'tables'}{$table_name}; + next unless $tdata->{'table_name'}; + my $table = $schema->add_table( + name => $tdata->{'table_name'}, + comments => $tdata->{'comments'}, + ) or die $schema->error; + + $table->options($tdata->{'table_options'}); + + my @fields = sort { $tdata->{'fields'}->{$a}->{'order'} <=> $tdata->{'fields'}->{$b}->{'order'} } + keys %{ $tdata->{'fields'} }; + + for my $fname (@fields) { + my $fdata = $tdata->{'fields'}{$fname}; + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_inc'}, + is_nullable => $fdata->{'null'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + } + + push @{ $tdata->{'indices'} }, @{ $indices->{$table_name} || [] }; + push @{ $tdata->{'constraints'} }, @{ $constraints->{$table_name} || [] }; + + for my $idata (@{ $tdata->{'indices'} || [] }) { + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc $idata->{'type'}, + fields => $idata->{'fields'}, + ) or die $table->error; + } + + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + my $constraint = $table->add_constraint( + name => $cdata->{'name'}, + type => $cdata->{'type'}, + fields => $cdata->{'fields'}, + expression => $cdata->{'expression'}, + reference_table => $cdata->{'reference_table'}, + reference_fields => $cdata->{'reference_fields'}, + match_type => $cdata->{'match_type'} || '', + on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, + on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, + ) or die $table->error; + } + } + + my @procedures = sort { $result->{procedures}->{$a}->{'order'} <=> $result->{procedures}->{$b}->{'order'} } + keys %{ $result->{procedures} }; + foreach my $proc_name (@procedures) { + $schema->add_procedure( + name => $proc_name, + owner => $result->{procedures}->{$proc_name}->{owner}, + sql => $result->{procedures}->{$proc_name}->{sql}, + ); + } + + my @views + = sort { $result->{views}->{$a}->{'order'} <=> $result->{views}->{$b}->{'order'} } keys %{ $result->{views} }; + foreach my $view_name (keys %{ $result->{views} }) { + $schema->add_view( + name => $view_name, + sql => $result->{views}->{$view_name}->{sql}, + ); + } + + my @triggers = sort { $result->{triggers}->{$a}->{'order'} <=> $result->{triggers}->{$b}->{'order'} } + keys %{ $result->{triggers} }; + foreach my $trigger_name (@triggers) { + $schema->add_trigger( + name => $trigger_name, + action => $result->{triggers}->{$trigger_name}->{action}, + ); + } + + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/PostgreSQL.pm b/lib/SQL/Translator/Parser/PostgreSQL.pm index 4ac69806c..bf799e967 100644 --- a/lib/SQL/Translator/Parser/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/PostgreSQL.pm @@ -91,7 +91,7 @@ use warnings; our $VERSION = '1.64'; our $DEBUG; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use Data::Dumper; use SQL::Translator::Utils qw/ddl_parser_instance/; @@ -1056,118 +1056,124 @@ VALUE : /[-+]?\d*\.?\d+(?:[eE]\d+)?/ END_OF_GRAMMAR sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error - local $::RD_WARN = 1 unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. - local $::RD_HINT = 1 unless defined $::RD_HINT; # Give out hints to help fix problems. - - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('PostgreSQL'); - - my $result = $parser->startrule($data); - die "Parse failed.\n" unless defined $result; - warn Dumper($result) if $DEBUG; - - my $schema = $translator->schema; - my @tables = sort { - ( $result->{tables}{ $a }{'order'} || 0 ) <=> ( $result->{tables}{ $b }{'order'} || 0 ) - } keys %{ $result->{tables} }; - - for my $table_name ( @tables ) { - my $tdata = $result->{tables}{ $table_name }; - my $table = $schema->add_table( - #schema => $tdata->{'schema_name'}, - name => $tdata->{'table_name'}, - ) or die "Couldn't create table '$table_name': " . $schema->error; - - $table->extra(temporary => 1) if $tdata->{'temporary'}; - - $table->comments( $tdata->{'comments'} ); - - my @fields = sort { - $tdata->{'fields'}{ $a }{'order'} - <=> - $tdata->{'fields'}{ $b }{'order'} - } keys %{ $tdata->{'fields'} }; - - for my $fname ( @fields ) { - my $fdata = $tdata->{'fields'}{ $fname }; - next if $fdata->{'drop'}; - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_increment'}, - is_nullable => $fdata->{'is_nullable'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata->{'is_primary_key'}; - - for my $cdata ( @{ $fdata->{'constraints'} } ) { - next unless $cdata->{'type'} eq 'foreign_key'; - $cdata->{'fields'} ||= [ $field->name ]; - push @{ $tdata->{'constraints'} }, $cdata; - } - } + my ($translator, $data) = @_; + + # Enable warnings within the Parse::RecDescent module. + local $::RD_ERRORS = 1 + unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error + local $::RD_WARN = 1 + unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. + local $::RD_HINT = 1 + unless defined $::RD_HINT; # Give out hints to help fix problems. + + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; + + my $parser = ddl_parser_instance('PostgreSQL'); + + my $result = $parser->startrule($data); + die "Parse failed.\n" unless defined $result; + warn Dumper($result) if $DEBUG; + + my $schema = $translator->schema; + my @tables = sort { ($result->{tables}{$a}{'order'} || 0) <=> ($result->{tables}{$b}{'order'} || 0) } + keys %{ $result->{tables} }; + + for my $table_name (@tables) { + my $tdata = $result->{tables}{$table_name}; + my $table = $schema->add_table( + + #schema => $tdata->{'schema_name'}, + name => $tdata->{'table_name'}, + ) or die "Couldn't create table '$table_name': " . $schema->error; + + $table->extra(temporary => 1) if $tdata->{'temporary'}; + + $table->comments($tdata->{'comments'}); + + my @fields + = sort { $tdata->{'fields'}{$a}{'order'} <=> $tdata->{'fields'}{$b}{'order'} } keys %{ $tdata->{'fields'} }; + + for my $fname (@fields) { + my $fdata = $tdata->{'fields'}{$fname}; + next if $fdata->{'drop'}; + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_increment'}, + is_nullable => $fdata->{'is_nullable'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + + $table->primary_key($field->name) if $fdata->{'is_primary_key'}; + + for my $cdata (@{ $fdata->{'constraints'} }) { + next unless $cdata->{'type'} eq 'foreign_key'; + $cdata->{'fields'} ||= [ $field->name ]; + push @{ $tdata->{'constraints'} }, $cdata; + } + } - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my @options = (); - push @options, { using => $idata->{'method'} } if $idata->{method}; - push @options, { where => $idata->{'where'} } if $idata->{where}; - push @options, { include => $idata->{'include'} } if $idata->{include}; - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc $idata->{'type'}, - fields => $idata->{'fields'}, - options => \@options - ) or die $table->error . ' ' . $table->name; - } + for my $idata (@{ $tdata->{'indices'} || [] }) { + my @options = (); + push @options, { using => $idata->{'method'} } if $idata->{method}; + push @options, { where => $idata->{'where'} } if $idata->{where}; + push @options, { include => $idata->{'include'} } + if $idata->{include}; + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc $idata->{'type'}, + fields => $idata->{'fields'}, + options => \@options + ) or die $table->error . ' ' . $table->name; + } - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - my $options = [ - # load this up with the extras - map +{%{$cdata}{$_}}, grep $cdata->{$_}, qw/include using where/ - ]; - my $constraint = $table->add_constraint( - name => $cdata->{'name'}, - type => $cdata->{'type'}, - fields => $cdata->{'fields'}, - reference_table => $cdata->{'reference_table'}, - reference_fields => $cdata->{'reference_fields'}, - match_type => $cdata->{'match_type'} || '', - on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, - on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, - expression => $cdata->{'expression'}, - options => $options - ) or die "Can't add constraint of type '" . - $cdata->{'type'} . "' to table '" . $table->name . - "': " . $table->error; - } + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + my $options = [ + + # load this up with the extras + map +{ %{$cdata}{$_} }, grep $cdata->{$_}, + qw/include using where/ + ]; + my $constraint = $table->add_constraint( + name => $cdata->{'name'}, + type => $cdata->{'type'}, + fields => $cdata->{'fields'}, + reference_table => $cdata->{'reference_table'}, + reference_fields => $cdata->{'reference_fields'}, + match_type => $cdata->{'match_type'} || '', + on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, + on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, + expression => $cdata->{'expression'}, + options => $options + ) + or die "Can't add constraint of type '" + . $cdata->{'type'} + . "' to table '" + . $table->name . "': " + . $table->error; } + } - for my $vinfo (@{$result->{views}}) { - my $sql = $vinfo->{sql}; - $sql =~ s/\A\s+|\s+\z//g; - my $view = $schema->add_view ( - name => $vinfo->{view_name}, - sql => $sql, - fields => $vinfo->{fields}, - ); + for my $vinfo (@{ $result->{views} }) { + my $sql = $vinfo->{sql}; + $sql =~ s/\A\s+|\s+\z//g; + my $view = $schema->add_view( + name => $vinfo->{view_name}, + sql => $sql, + fields => $vinfo->{fields}, + ); - $view->extra ( temporary => 1 ) if $vinfo->{is_temporary}; - } + $view->extra(temporary => 1) if $vinfo->{is_temporary}; + } - for my $trigger (@{ $result->{triggers} }) { - $schema->add_trigger( %$trigger ); - } + for my $trigger (@{ $result->{triggers} }) { + $schema->add_trigger(%$trigger); + } - return 1; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/SQLServer.pm b/lib/SQL/Translator/Parser/SQLServer.pm index 574b053e8..93e5262f9 100644 --- a/lib/SQL/Translator/Parser/SQLServer.pm +++ b/lib/SQL/Translator/Parser/SQLServer.pm @@ -22,7 +22,7 @@ use warnings; our $VERSION = '1.64'; our $DEBUG; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use Data::Dumper; use SQL::Translator::Utils qw/ddl_parser_instance/; @@ -452,121 +452,118 @@ BQSTRING : '[' /(?:[^]]|]])+/ ']' END_OF_GRAMMAR sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error - local $::RD_WARN = 1 unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. - local $::RD_HINT = 1 unless defined $::RD_HINT; # Give out hints to help fix problems. - - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('SQLServer'); - - my $result = $parser->startrule($data); - return $translator->error( "Parse failed." ) unless defined $result; - warn Dumper( $result ) if $DEBUG; - - my $schema = $translator->schema; - my @tables = sort { - $result->{tables}->{ $a }->{'order'} <=> $result->{tables}->{ $b }->{'order'} - } keys %{ $result->{tables} }; - - for my $table_name ( @tables ) { - my $tdata = $result->{tables}->{ $table_name }; - my $table = $schema->add_table( name => $tdata->{'name'} ) - or die "Can't create table '$table_name': ", $schema->error; - - $table->comments( $tdata->{'comments'} ); - - my @fields = sort { - $tdata->{'fields'}->{$a}->{'order'} - <=> - $tdata->{'fields'}->{$b}->{'order'} - } keys %{ $tdata->{'fields'} }; - - for my $fname ( @fields ) { - my $fdata = $tdata->{'fields'}{ $fname }; - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, - is_nullable => $fdata->{'nullable'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata->{'is_primary_key'}; - - for my $qual ( qw[ binary unsigned zerofill list ] ) { - if ( my $val = $fdata->{ $qual } || $fdata->{ uc $qual } ) { - next if ref $val eq 'ARRAY' && !@$val; - $field->extra( $qual, $val ); - } - } - - if ( $field->data_type =~ /(set|enum)/i && !$field->size ) { - my %extra = $field->extra; - my $longest = 0; - for my $len ( map { length } @{ $extra{'list'} || [] } ) { - $longest = $len if $len > $longest; - } - $field->size( $longest ) if $longest; - } - - for my $cdata ( @{ $fdata->{'constraints'} } ) { - next unless $cdata->{'type'} eq 'foreign_key'; - $cdata->{'fields'} ||= [ $field->name ]; - push @{ $tdata->{'constraints'} }, $cdata; - } + my ($translator, $data) = @_; + + # Enable warnings within the Parse::RecDescent module. + local $::RD_ERRORS = 1 + unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error + local $::RD_WARN = 1 + unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. + local $::RD_HINT = 1 + unless defined $::RD_HINT; # Give out hints to help fix problems. + + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; + + my $parser = ddl_parser_instance('SQLServer'); + + my $result = $parser->startrule($data); + return $translator->error("Parse failed.") unless defined $result; + warn Dumper($result) if $DEBUG; + + my $schema = $translator->schema; + my @tables + = sort { $result->{tables}->{$a}->{'order'} <=> $result->{tables}->{$b}->{'order'} } keys %{ $result->{tables} }; + + for my $table_name (@tables) { + my $tdata = $result->{tables}->{$table_name}; + my $table = $schema->add_table(name => $tdata->{'name'}) + or die "Can't create table '$table_name': ", $schema->error; + + $table->comments($tdata->{'comments'}); + + my @fields = sort { $tdata->{'fields'}->{$a}->{'order'} <=> $tdata->{'fields'}->{$b}->{'order'} } + keys %{ $tdata->{'fields'} }; + + for my $fname (@fields) { + my $fdata = $tdata->{'fields'}{$fname}; + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_inc'}, + is_nullable => $fdata->{'nullable'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + + $table->primary_key($field->name) if $fdata->{'is_primary_key'}; + + for my $qual (qw[ binary unsigned zerofill list ]) { + if (my $val = $fdata->{$qual} || $fdata->{ uc $qual }) { + next if ref $val eq 'ARRAY' && !@$val; + $field->extra($qual, $val); } + } - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc $idata->{'type'}, - fields => $idata->{'fields'}, - ) or die $table->error; + if ($field->data_type =~ /(set|enum)/i && !$field->size) { + my %extra = $field->extra; + my $longest = 0; + for my $len (map {length} @{ $extra{'list'} || [] }) { + $longest = $len if $len > $longest; } + $field->size($longest) if $longest; + } - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - my $constraint = $table->add_constraint( - name => $cdata->{'name'}, - type => $cdata->{'type'}, - fields => $cdata->{'fields'}, - reference_table => $cdata->{'reference_table'}, - reference_fields => $cdata->{'reference_fields'}, - match_type => $cdata->{'match_type'} || '', - on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, - on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, - ) or die $table->error; - } + for my $cdata (@{ $fdata->{'constraints'} }) { + next unless $cdata->{'type'} eq 'foreign_key'; + $cdata->{'fields'} ||= [ $field->name ]; + push @{ $tdata->{'constraints'} }, $cdata; + } } - my @procedures = sort { - $result->{procedures}->{ $a }->{'order'} <=> $result->{procedures}->{ $b }->{'order'} - } keys %{ $result->{procedures} }; - for my $proc_name (@procedures) { - $schema->add_procedure( - name => $proc_name, - owner => $result->{procedures}->{$proc_name}->{owner}, - sql => $result->{procedures}->{$proc_name}->{sql}, - ); + for my $idata (@{ $tdata->{'indices'} || [] }) { + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc $idata->{'type'}, + fields => $idata->{'fields'}, + ) or die $table->error; } - my @views = sort { - $result->{views}->{ $a }->{'order'} <=> $result->{views}->{ $b }->{'order'} - } keys %{ $result->{views} }; - for my $view_name (keys %{ $result->{views} }) { - $schema->add_view( - name => $view_name, - sql => $result->{views}->{$view_name}->{sql}, - ); + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + my $constraint = $table->add_constraint( + name => $cdata->{'name'}, + type => $cdata->{'type'}, + fields => $cdata->{'fields'}, + reference_table => $cdata->{'reference_table'}, + reference_fields => $cdata->{'reference_fields'}, + match_type => $cdata->{'match_type'} || '', + on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, + on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, + ) or die $table->error; } - - return 1; + } + + my @procedures = sort { $result->{procedures}->{$a}->{'order'} <=> $result->{procedures}->{$b}->{'order'} } + keys %{ $result->{procedures} }; + for my $proc_name (@procedures) { + $schema->add_procedure( + name => $proc_name, + owner => $result->{procedures}->{$proc_name}->{owner}, + sql => $result->{procedures}->{$proc_name}->{sql}, + ); + } + + my @views + = sort { $result->{views}->{$a}->{'order'} <=> $result->{views}->{$b}->{'order'} } keys %{ $result->{views} }; + for my $view_name (keys %{ $result->{views} }) { + $schema->add_view( + name => $view_name, + sql => $result->{views}->{$view_name}->{sql}, + ); + } + + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/SQLite.pm b/lib/SQL/Translator/Parser/SQLite.pm index 3f5d73064..fee05a2cc 100644 --- a/lib/SQL/Translator/Parser/SQLite.pm +++ b/lib/SQL/Translator/Parser/SQLite.pm @@ -136,7 +136,7 @@ use warnings; our $VERSION = '1.64'; our $DEBUG; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use Data::Dumper; use SQL::Translator::Utils qw/ddl_parser_instance/; @@ -641,103 +641,105 @@ VALUE : /[-+]?\d*\.?\d+(?:[eE]\d+)?/ END_OF_GRAMMAR - sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error - local $::RD_WARN = 1 unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. - local $::RD_HINT = 1 unless defined $::RD_HINT; # Give out hints to help fix problems. - - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('SQLite'); - - my $result = $parser->startrule($data); - return $translator->error( "Parse failed." ) unless defined $result; - warn Dumper( $result ) if $DEBUG; - - my $schema = $translator->schema; - my @tables = - map { $_->[1] } - sort { $a->[0] <=> $b->[0] } - map { [ $result->{'tables'}{ $_ }->{'order'}, $_ ] } - keys %{ $result->{'tables'} }; - - for my $table_name ( @tables ) { - my $tdata = $result->{'tables'}{ $table_name }; - my $table = $schema->add_table( - name => $tdata->{'name'}, - ) or die $schema->error; - - $table->comments( $tdata->{'comments'} ); - - for my $fdata ( @{ $tdata->{'fields'} } ) { - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, - ($fdata->{'is_auto_inc'}? ( extra => { auto_increment_type => 'monotonic' } ) : ()), - is_nullable => $fdata->{'is_nullable'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata->{'is_primary_key'}; - - for my $cdata ( @{ $fdata->{'constraints'} } ) { - next unless $cdata->{'type'} eq 'foreign_key'; - $cdata->{'fields'} ||= [ $field->name ]; - push @{ $tdata->{'constraints'} }, $cdata; - } - } - - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc ($idata->{'type'}||''), - fields => $idata->{'fields'}, - ) or die $table->error; - } - - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - my $constraint = $table->add_constraint( - name => $cdata->{'name'}, - type => $cdata->{'type'}, - fields => $cdata->{'fields'}, - reference_table => $cdata->{'reference_table'}, - reference_fields => $cdata->{'reference_fields'}, - match_type => $cdata->{'match_type'} || '', - on_delete => $cdata->{'on_delete'} - || $cdata->{'on_delete_do'}, - on_update => $cdata->{'on_update'} - || $cdata->{'on_update_do'}, - ) or die $table->error; - } + my ($translator, $data) = @_; + + # Enable warnings within the Parse::RecDescent module. + local $::RD_ERRORS = 1 + unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error + local $::RD_WARN = 1 + unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. + local $::RD_HINT = 1 + unless defined $::RD_HINT; # Give out hints to help fix problems. + + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; + + my $parser = ddl_parser_instance('SQLite'); + + my $result = $parser->startrule($data); + return $translator->error("Parse failed.") unless defined $result; + warn Dumper($result) if $DEBUG; + + my $schema = $translator->schema; + my @tables = map { $_->[1] } + sort { $a->[0] <=> $b->[0] } + map { [ $result->{'tables'}{$_}->{'order'}, $_ ] } + keys %{ $result->{'tables'} }; + + for my $table_name (@tables) { + my $tdata = $result->{'tables'}{$table_name}; + my $table = $schema->add_table(name => $tdata->{'name'},) + or die $schema->error; + + $table->comments($tdata->{'comments'}); + + for my $fdata (@{ $tdata->{'fields'} }) { + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_inc'}, + ( + $fdata->{'is_auto_inc'} + ? (extra => { auto_increment_type => 'monotonic' }) + : () + ), + is_nullable => $fdata->{'is_nullable'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + + $table->primary_key($field->name) if $fdata->{'is_primary_key'}; + + for my $cdata (@{ $fdata->{'constraints'} }) { + next unless $cdata->{'type'} eq 'foreign_key'; + $cdata->{'fields'} ||= [ $field->name ]; + push @{ $tdata->{'constraints'} }, $cdata; + } } - for my $def ( @{ $result->{'views'} || [] } ) { - my $view = $schema->add_view( - name => $def->{'name'}, - sql => $def->{'sql'}, - ); + for my $idata (@{ $tdata->{'indices'} || [] }) { + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc($idata->{'type'} || ''), + fields => $idata->{'fields'}, + ) or die $table->error; } - for my $def ( @{ $result->{'triggers'} || [] } ) { - my $view = $schema->add_trigger( - name => $def->{'name'}, - perform_action_when => $def->{'when'}, - database_events => $def->{'db_events'}, - action => $def->{'action'}, - on_table => $def->{'on_table'}, - scope => 'row', # SQLite only supports row triggers - ); + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + my $constraint = $table->add_constraint( + name => $cdata->{'name'}, + type => $cdata->{'type'}, + fields => $cdata->{'fields'}, + reference_table => $cdata->{'reference_table'}, + reference_fields => $cdata->{'reference_fields'}, + match_type => $cdata->{'match_type'} || '', + on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, + on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, + ) or die $table->error; } - - return 1; + } + + for my $def (@{ $result->{'views'} || [] }) { + my $view = $schema->add_view( + name => $def->{'name'}, + sql => $def->{'sql'}, + ); + } + + for my $def (@{ $result->{'triggers'} || [] }) { + my $view = $schema->add_trigger( + name => $def->{'name'}, + perform_action_when => $def->{'when'}, + database_events => $def->{'db_events'}, + action => $def->{'action'}, + on_table => $def->{'on_table'}, + scope => 'row', # SQLite only supports row triggers + ); + } + + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/Storable.pm b/lib/SQL/Translator/Parser/Storable.pm index 7362b5a15..033c06b4c 100644 --- a/lib/SQL/Translator/Parser/Storable.pm +++ b/lib/SQL/Translator/Parser/Storable.pm @@ -33,17 +33,17 @@ use base qw(Exporter); our @EXPORT_OK = qw(parse); sub parse { - my ($translator, $data) = @_; + my ($translator, $data) = @_; - if (defined($data)) { - $translator->{'schema'} = Storable::thaw($data); - return 1; - } elsif (defined($translator->filename)) { - $translator->{'schema'} = Storable::retrieve($translator->filename); - return 1; - } + if (defined($data)) { + $translator->{'schema'} = Storable::thaw($data); + return 1; + } elsif (defined($translator->filename)) { + $translator->{'schema'} = Storable::retrieve($translator->filename); + return 1; + } - return 0; + return 0; } 1; diff --git a/lib/SQL/Translator/Parser/Sybase.pm b/lib/SQL/Translator/Parser/Sybase.pm index 148377689..2d2ee85d0 100644 --- a/lib/SQL/Translator/Parser/Sybase.pm +++ b/lib/SQL/Translator/Parser/Sybase.pm @@ -23,7 +23,7 @@ use warnings; our $VERSION = '1.64'; our $DEBUG; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use Data::Dumper; use SQL::Translator::Utils qw/ddl_parser_instance/; @@ -288,100 +288,99 @@ QUOTE : /'/ END_OF_GRAMMAR sub parse { - my ( $translator, $data ) = @_; - - # Enable warnings within the Parse::RecDescent module. - local $::RD_ERRORS = 1 unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error - local $::RD_WARN = 1 unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. - local $::RD_HINT = 1 unless defined $::RD_HINT; # Give out hints to help fix problems. - - local $::RD_TRACE = $translator->trace ? 1 : undef; - local $DEBUG = $translator->debug; - - my $parser = ddl_parser_instance('Sybase'); - - my $result = $parser->startrule($data); - return $translator->error( "Parse failed." ) unless defined $result; - warn Dumper( $result ) if $DEBUG; - - my $schema = $translator->schema; - my @tables = sort { - $result->{ $a }->{'order'} <=> $result->{ $b }->{'order'} - } keys %{ $result }; - - for my $table_name ( @tables ) { - my $tdata = $result->{ $table_name }; - my $table = $schema->add_table( name => $tdata->{'name'} ) - or die "Can't create table '$table_name': ", $schema->error; - - $table->comments( $tdata->{'comments'} ); - - my @fields = sort { - $tdata->{'fields'}->{$a}->{'order'} - <=> - $tdata->{'fields'}->{$b}->{'order'} - } keys %{ $tdata->{'fields'} }; - - for my $fname ( @fields ) { - my $fdata = $tdata->{'fields'}{ $fname }; - my $field = $table->add_field( - name => $fdata->{'name'}, - data_type => $fdata->{'data_type'}, - size => $fdata->{'size'}, - default_value => $fdata->{'default'}, - is_auto_increment => $fdata->{'is_auto_inc'}, - is_nullable => $fdata->{'nullable'}, - comments => $fdata->{'comments'}, - ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata->{'is_primary_key'}; - - for my $qual ( qw[ binary unsigned zerofill list ] ) { - if ( my $val = $fdata->{ $qual } || $fdata->{ uc $qual } ) { - next if ref $val eq 'ARRAY' && !@$val; - $field->extra( $qual, $val ); - } - } - - if ( $field->data_type =~ /(set|enum)/i && !$field->size ) { - my %extra = $field->extra; - my $longest = 0; - for my $len ( map { length } @{ $extra{'list'} || [] } ) { - $longest = $len if $len > $longest; - } - $field->size( $longest ) if $longest; - } - - for my $cdata ( @{ $fdata->{'constraints'} } ) { - next unless $cdata->{'type'} eq 'foreign_key'; - $cdata->{'fields'} ||= [ $field->name ]; - push @{ $tdata->{'constraints'} }, $cdata; - } + my ($translator, $data) = @_; + + # Enable warnings within the Parse::RecDescent module. + local $::RD_ERRORS = 1 + unless defined $::RD_ERRORS; # Make sure the parser dies when it encounters an error + local $::RD_WARN = 1 + unless defined $::RD_WARN; # Enable warnings. This will warn on unused rules &c. + local $::RD_HINT = 1 + unless defined $::RD_HINT; # Give out hints to help fix problems. + + local $::RD_TRACE = $translator->trace ? 1 : undef; + local $DEBUG = $translator->debug; + + my $parser = ddl_parser_instance('Sybase'); + + my $result = $parser->startrule($data); + return $translator->error("Parse failed.") unless defined $result; + warn Dumper($result) if $DEBUG; + + my $schema = $translator->schema; + my @tables = sort { $result->{$a}->{'order'} <=> $result->{$b}->{'order'} } + keys %{$result}; + + for my $table_name (@tables) { + my $tdata = $result->{$table_name}; + my $table = $schema->add_table(name => $tdata->{'name'}) + or die "Can't create table '$table_name': ", $schema->error; + + $table->comments($tdata->{'comments'}); + + my @fields = sort { $tdata->{'fields'}->{$a}->{'order'} <=> $tdata->{'fields'}->{$b}->{'order'} } + keys %{ $tdata->{'fields'} }; + + for my $fname (@fields) { + my $fdata = $tdata->{'fields'}{$fname}; + my $field = $table->add_field( + name => $fdata->{'name'}, + data_type => $fdata->{'data_type'}, + size => $fdata->{'size'}, + default_value => $fdata->{'default'}, + is_auto_increment => $fdata->{'is_auto_inc'}, + is_nullable => $fdata->{'nullable'}, + comments => $fdata->{'comments'}, + ) or die $table->error; + + $table->primary_key($field->name) if $fdata->{'is_primary_key'}; + + for my $qual (qw[ binary unsigned zerofill list ]) { + if (my $val = $fdata->{$qual} || $fdata->{ uc $qual }) { + next if ref $val eq 'ARRAY' && !@$val; + $field->extra($qual, $val); } + } - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - my $index = $table->add_index( - name => $idata->{'name'}, - type => uc $idata->{'type'}, - fields => $idata->{'fields'}, - ) or die $table->error; + if ($field->data_type =~ /(set|enum)/i && !$field->size) { + my %extra = $field->extra; + my $longest = 0; + for my $len (map {length} @{ $extra{'list'} || [] }) { + $longest = $len if $len > $longest; } + $field->size($longest) if $longest; + } + + for my $cdata (@{ $fdata->{'constraints'} }) { + next unless $cdata->{'type'} eq 'foreign_key'; + $cdata->{'fields'} ||= [ $field->name ]; + push @{ $tdata->{'constraints'} }, $cdata; + } + } - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - my $constraint = $table->add_constraint( - name => $cdata->{'name'}, - type => $cdata->{'type'}, - fields => $cdata->{'fields'}, - reference_table => $cdata->{'reference_table'}, - reference_fields => $cdata->{'reference_fields'}, - match_type => $cdata->{'match_type'} || '', - on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, - on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, - ) or die $table->error; - } + for my $idata (@{ $tdata->{'indices'} || [] }) { + my $index = $table->add_index( + name => $idata->{'name'}, + type => uc $idata->{'type'}, + fields => $idata->{'fields'}, + ) or die $table->error; + } + + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + my $constraint = $table->add_constraint( + name => $cdata->{'name'}, + type => $cdata->{'type'}, + fields => $cdata->{'fields'}, + reference_table => $cdata->{'reference_table'}, + reference_fields => $cdata->{'reference_fields'}, + match_type => $cdata->{'match_type'} || '', + on_delete => $cdata->{'on_delete'} || $cdata->{'on_delete_do'}, + on_update => $cdata->{'on_update'} || $cdata->{'on_update_do'}, + ) or die $table->error; } + } - return 1; + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/XML/SQLFairy.pm b/lib/SQL/Translator/Parser/XML/SQLFairy.pm index 7ec062d3c..9fb15a469 100644 --- a/lib/SQL/Translator/Parser/XML/SQLFairy.pm +++ b/lib/SQL/Translator/Parser/XML/SQLFairy.pm @@ -78,9 +78,9 @@ To convert your old format files simply pass them through the translator :) use strict; use warnings; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use Data::Dumper; use Carp::Clan qw/^SQL::Translator/; @@ -88,219 +88,193 @@ use Exporter; use base qw(Exporter); @EXPORT_OK = qw(parse); -use base qw/SQL::Translator::Parser/; # Doesnt do anything at the mo! +use base qw/SQL::Translator::Parser/; # Doesnt do anything at the mo! use SQL::Translator::Utils 'debug'; use XML::LibXML; use XML::LibXML::XPathContext; sub parse { - my ( $translator, $data ) = @_; - my $schema = $translator->schema; - local $DEBUG = $translator->debug; - my $doc = XML::LibXML->new->parse_string($data); - my $xp = XML::LibXML::XPathContext->new($doc); - - $xp->registerNs("sqlf", "http://sqlfairy.sourceforge.net/sqlfairy.xml"); + my ($translator, $data) = @_; + my $schema = $translator->schema; + local $DEBUG = $translator->debug; + my $doc = XML::LibXML->new->parse_string($data); + my $xp = XML::LibXML::XPathContext->new($doc); + + $xp->registerNs("sqlf", "http://sqlfairy.sourceforge.net/sqlfairy.xml"); + + # + # Work our way through the tables + # + my @nodes = $xp->findnodes('/sqlf:schema/sqlf:table|/sqlf:schema/sqlf:tables/sqlf:table'); + for my $tblnode ( + sort { + ("" . $xp->findvalue('sqlf:order|@order', $a) || 0) <=> ("" . $xp->findvalue('sqlf:order|@order', $b) || 0) + } @nodes + ) { + debug "Adding table:" . $xp->findvalue('sqlf:name', $tblnode); + + my $table = $schema->add_table(get_tagfields($xp, $tblnode, "sqlf:" => qw/name order extra/)) + or die $schema->error; # - # Work our way through the tables + # Fields # - my @nodes = $xp->findnodes( - '/sqlf:schema/sqlf:table|/sqlf:schema/sqlf:tables/sqlf:table' - ); - for my $tblnode ( - sort { - ("".$xp->findvalue('sqlf:order|@order',$a) || 0) - <=> - ("".$xp->findvalue('sqlf:order|@order',$b) || 0) - } @nodes - ) { - debug "Adding table:".$xp->findvalue('sqlf:name',$tblnode); - - my $table = $schema->add_table( - get_tagfields($xp, $tblnode, "sqlf:" => qw/name order extra/) - ) or die $schema->error; - - # - # Fields - # - my @nodes = $xp->findnodes('sqlf:fields/sqlf:field',$tblnode); - foreach ( - sort { - ("".$xp->findvalue('sqlf:order',$a) || 0) - <=> - ("".$xp->findvalue('sqlf:order',$b) || 0) - } @nodes - ) { - my %fdata = get_tagfields($xp, $_, "sqlf:", - qw/name data_type size default_value is_nullable extra - is_auto_increment is_primary_key is_foreign_key comments/ - ); - - if ( - exists $fdata{'default_value'} and - defined $fdata{'default_value'} - ) { - if ( $fdata{'default_value'} =~ /^\s*NULL\s*$/ ) { - $fdata{'default_value'}= undef; - } - elsif ( $fdata{'default_value'} =~ /^\s*EMPTY_STRING\s*$/ ) { - $fdata{'default_value'} = ""; - } - } - - my $field = $table->add_field( %fdata ) or die $table->error; - - $table->primary_key( $field->name ) if $fdata{'is_primary_key'}; - - # - # TODO: - # - We should be able to make the table obj spot this when - # we use add_field. - # - } - - # - # Constraints - # - @nodes = $xp->findnodes('sqlf:constraints/sqlf:constraint',$tblnode); - foreach (@nodes) { - my %data = get_tagfields($xp, $_, "sqlf:", - qw/name type table fields reference_fields reference_table - match_type on_delete on_update extra/ - ); - $table->add_constraint( %data ) or die $table->error; - } - - # - # Indexes - # - @nodes = $xp->findnodes('sqlf:indices/sqlf:index',$tblnode); - foreach (@nodes) { - my %data = get_tagfields($xp, $_, "sqlf:", - qw/name type fields options extra/); - $table->add_index( %data ) or die $table->error; + my @nodes = $xp->findnodes('sqlf:fields/sqlf:field', $tblnode); + foreach (sort { ("" . $xp->findvalue('sqlf:order', $a) || 0) <=> ("" . $xp->findvalue('sqlf:order', $b) || 0) } + @nodes) { + my %fdata = get_tagfields( + $xp, $_, "sqlf:", + qw/name data_type size default_value is_nullable extra + is_auto_increment is_primary_key is_foreign_key comments/ + ); + + if (exists $fdata{'default_value'} + and defined $fdata{'default_value'}) { + if ($fdata{'default_value'} =~ /^\s*NULL\s*$/) { + $fdata{'default_value'} = undef; + } elsif ($fdata{'default_value'} =~ /^\s*EMPTY_STRING\s*$/) { + $fdata{'default_value'} = ""; } + } + my $field = $table->add_field(%fdata) or die $table->error; - # - # Comments - # - @nodes = $xp->findnodes('sqlf:comments/sqlf:comment',$tblnode); - foreach (@nodes) { - my $data = $_->string_value; - $table->comments( $data ); - } + $table->primary_key($field->name) if $fdata{'is_primary_key'}; - } # tables loop + # + # TODO: + # - We should be able to make the table obj spot this when + # we use add_field. + # + } # - # Views + # Constraints # - @nodes = $xp->findnodes( - '/sqlf:schema/sqlf:view|/sqlf:schema/sqlf:views/sqlf:view' - ); + @nodes = $xp->findnodes('sqlf:constraints/sqlf:constraint', $tblnode); foreach (@nodes) { - my %data = get_tagfields($xp, $_, "sqlf:", - qw/name sql fields order extra/ - ); - $schema->add_view( %data ) or die $schema->error; + my %data = get_tagfields( + $xp, $_, "sqlf:", + qw/name type table fields reference_fields reference_table + match_type on_delete on_update extra/ + ); + $table->add_constraint(%data) or die $table->error; } # - # Triggers + # Indexes # - @nodes = $xp->findnodes( - '/sqlf:schema/sqlf:trigger|/sqlf:schema/sqlf:triggers/sqlf:trigger' - ); + @nodes = $xp->findnodes('sqlf:indices/sqlf:index', $tblnode); foreach (@nodes) { - my %data = get_tagfields($xp, $_, "sqlf:", qw/ - name perform_action_when database_event database_events fields - on_table action order extra scope - /); - - # back compat - if (my $evt = $data{database_event} and $translator->{show_warnings}) { - carp 'The database_event tag is deprecated - please use ' . - 'database_events (which can take one or more comma separated ' . - 'event names)'; - $data{database_events} = join (', ', - $data{database_events} || (), - $evt, - ); - } - - # split into arrayref - if (my $evts = $data{database_events}) { - $data{database_events} = [split (/\s*,\s*/, $evts) ]; - } - - $schema->add_trigger( %data ) or die $schema->error; + my %data = get_tagfields($xp, $_, "sqlf:", qw/name type fields options extra/); + $table->add_index(%data) or die $table->error; } # - # Procedures + # Comments # - @nodes = $xp->findnodes( - '/sqlf:schema/sqlf:procedure|/sqlf:schema/sqlf:procedures/sqlf:procedure' - ); + @nodes = $xp->findnodes('sqlf:comments/sqlf:comment', $tblnode); foreach (@nodes) { - my %data = get_tagfields($xp, $_, "sqlf:", - qw/name sql parameters owner comments order extra/ - ); - $schema->add_procedure( %data ) or die $schema->error; + my $data = $_->string_value; + $table->comments($data); + } + + } # tables loop + + # + # Views + # + @nodes = $xp->findnodes('/sqlf:schema/sqlf:view|/sqlf:schema/sqlf:views/sqlf:view'); + foreach (@nodes) { + my %data = get_tagfields($xp, $_, "sqlf:", qw/name sql fields order extra/); + $schema->add_view(%data) or die $schema->error; + } + + # + # Triggers + # + @nodes = $xp->findnodes('/sqlf:schema/sqlf:trigger|/sqlf:schema/sqlf:triggers/sqlf:trigger'); + foreach (@nodes) { + my %data = get_tagfields( + $xp, $_, "sqlf:", qw/ + name perform_action_when database_event database_events fields + on_table action order extra scope + / + ); + + # back compat + if (my $evt = $data{database_event} and $translator->{show_warnings}) { + carp 'The database_event tag is deprecated - please use ' + . 'database_events (which can take one or more comma separated ' + . 'event names)'; + $data{database_events} = join(', ', $data{database_events} || (), $evt,); + } + + # split into arrayref + if (my $evts = $data{database_events}) { + $data{database_events} = [ split(/\s*,\s*/, $evts) ]; } - return 1; + $schema->add_trigger(%data) or die $schema->error; + } + + # + # Procedures + # + @nodes = $xp->findnodes('/sqlf:schema/sqlf:procedure|/sqlf:schema/sqlf:procedures/sqlf:procedure'); + foreach (@nodes) { + my %data = get_tagfields($xp, $_, "sqlf:", qw/name sql parameters owner comments order extra/); + $schema->add_procedure(%data) or die $schema->error; + } + + return 1; } sub get_tagfields { -# -# get_tagfields XP, NODE, NAMESPACE => qw/TAGNAMES/; -# get_tagfields $node, "sqlf:" => qw/name type fields reference/; -# -# Returns hash of data. -# TODO - Add handling of an explicit NULL value. -# - - my ($xp, $node, @names) = @_; - my (%data, $ns); - foreach (@names) { - if ( m/:$/ ) { $ns = $_; next; } # Set def namespace - my $thisns = (s/(^.*?:)// ? $1 : $ns); - - my $is_attrib = m/^(sql|comments|action|extra)$/ ? 0 : 1; - - my $attrib_path = "\@$_"; - my $tag_path = "$thisns$_"; - if ( my $found = $xp->find($attrib_path,$node) ) { - $data{$_} = "".$found->to_literal; - warn "Use of '$_' as an attribute is depricated." - ." Use a child tag instead." - ." To convert your file to the new version see the Docs.\n" - unless $is_attrib; - debug "Got $_=".( defined $data{ $_ } ? $data{ $_ } : 'UNDEF' ); - } - elsif ( $found = $xp->find($tag_path,$node) ) { - if ($_ eq "extra") { - my %extra; - foreach ( $found->pop->getAttributes ) { - $extra{$_->getName} = $_->getData; - } - $data{$_} = \%extra; - } - else { - $data{$_} = "".$found->to_literal; - } - warn "Use of '$_' as a child tag is depricated." - ." Use an attribute instead." - ." To convert your file to the new version see the Docs.\n" - if $is_attrib; - debug "Got $_=".( defined $data{ $_ } ? $data{ $_ } : 'UNDEF' ); + # + # get_tagfields XP, NODE, NAMESPACE => qw/TAGNAMES/; + # get_tagfields $node, "sqlf:" => qw/name type fields reference/; + # + # Returns hash of data. + # TODO - Add handling of an explicit NULL value. + # + + my ($xp, $node, @names) = @_; + my (%data, $ns); + foreach (@names) { + if (m/:$/) { $ns = $_; next; } # Set def namespace + my $thisns = (s/(^.*?:)// ? $1 : $ns); + + my $is_attrib = m/^(sql|comments|action|extra)$/ ? 0 : 1; + + my $attrib_path = "\@$_"; + my $tag_path = "$thisns$_"; + if (my $found = $xp->find($attrib_path, $node)) { + $data{$_} = "" . $found->to_literal; + warn "Use of '$_' as an attribute is depricated." + . " Use a child tag instead." + . " To convert your file to the new version see the Docs.\n" + unless $is_attrib; + debug "Got $_=" . (defined $data{$_} ? $data{$_} : 'UNDEF'); + } elsif ($found = $xp->find($tag_path, $node)) { + if ($_ eq "extra") { + my %extra; + foreach ($found->pop->getAttributes) { + $extra{ $_->getName } = $_->getData; } + $data{$_} = \%extra; + } else { + $data{$_} = "" . $found->to_literal; + } + warn "Use of '$_' as a child tag is depricated." + . " Use an attribute instead." + . " To convert your file to the new version see the Docs.\n" + if $is_attrib; + debug "Got $_=" . (defined $data{$_} ? $data{$_} : 'UNDEF'); } + } - return wantarray ? %data : \%data; + return wantarray ? %data : \%data; } 1; diff --git a/lib/SQL/Translator/Parser/YAML.pm b/lib/SQL/Translator/Parser/YAML.pm index a32789a36..3b15e7957 100644 --- a/lib/SQL/Translator/Parser/YAML.pm +++ b/lib/SQL/Translator/Parser/YAML.pm @@ -10,112 +10,99 @@ use Data::Dumper; use YAML qw(Load); sub parse { - my ($translator, $data) = @_; - $data = Load($data); - $data = $data->{'schema'}; - - warn "YAML data:",Dumper( $data ) if $translator->debug; - - my $schema = $translator->schema; - - # - # Tables - # - my @tables = - map { $data->{'tables'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'tables'}{ $_ }{'order'} || 0, $_ ] } - keys %{ $data->{'tables'} } - ; - - for my $tdata ( @tables ) { - - my $table = $schema->add_table( - map { - $tdata->{$_} ? ($_ => $tdata->{$_}) : () - } (qw/name extra options/) - ) or die $schema->error; - - my @fields = - map { $tdata->{'fields'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $tdata->{'fields'}{ $_ }{'order'}, $_ ] } - keys %{ $tdata->{'fields'} } - ; - - for my $fdata ( @fields ) { - $table->add_field( %$fdata ) or die $table->error; - $table->primary_key( $fdata->{'name'} ) - if $fdata->{'is_primary_key'}; - } - - for my $idata ( @{ $tdata->{'indices'} || [] } ) { - $table->add_index( %$idata ) or die $table->error; - } - - for my $cdata ( @{ $tdata->{'constraints'} || [] } ) { - $table->add_constraint( %$cdata ) or die $table->error; - } - - $table->comments( $tdata->{'comments' } ) - if exists $tdata->{'comments'}; - } + my ($translator, $data) = @_; + $data = Load($data); + $data = $data->{'schema'}; - # - # Views - # - my @views = - map { $data->{'views'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'views'}{ $_ }{'order'}, $_ ] } - keys %{ $data->{'views'} } - ; - - for my $vdata ( @views ) { - $schema->add_view( %$vdata ) or die $schema->error; - } + warn "YAML data:", Dumper($data) if $translator->debug; + + my $schema = $translator->schema; + + # + # Tables + # + my @tables = map { $data->{'tables'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'tables'}{$_}{'order'} || 0, $_ ] } + keys %{ $data->{'tables'} }; + + for my $tdata (@tables) { + + my $table = $schema->add_table(map { $tdata->{$_} ? ($_ => $tdata->{$_}) : () } (qw/name extra options/)) + or die $schema->error; + + my @fields = map { $tdata->{'fields'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $tdata->{'fields'}{$_}{'order'}, $_ ] } + keys %{ $tdata->{'fields'} }; - # - # Triggers - # - my @triggers = - map { $data->{'triggers'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'triggers'}{ $_ }{'order'}, $_ ] } - keys %{ $data->{'triggers'} } - ; - - for my $tdata ( @triggers ) { - $schema->add_trigger( %$tdata ) or die $schema->error; + for my $fdata (@fields) { + $table->add_field(%$fdata) or die $table->error; + $table->primary_key($fdata->{'name'}) + if $fdata->{'is_primary_key'}; } - # - # Procedures - # - my @procedures = - map { $data->{'procedures'}{ $_->[1] } } - sort { $a->[0] <=> $b->[0] } - map { [ $data->{'procedures'}{ $_ }{'order'}, $_ ] } - keys %{ $data->{'procedures'} } - ; - - for my $tdata ( @procedures ) { - $schema->add_procedure( %$tdata ) or die $schema->error; + for my $idata (@{ $tdata->{'indices'} || [] }) { + $table->add_index(%$idata) or die $table->error; } - if ( my $tr_data = $data->{'translator'} ) { - $translator->add_drop_table( $tr_data->{'add_drop_table'} ); - $translator->filename( $tr_data->{'filename'} ); - $translator->no_comments( $tr_data->{'no_comments'} ); - $translator->parser_args( $tr_data->{'parser_args'} ); - $translator->producer_args( $tr_data->{'producer_args'} ); - $translator->parser_type( $tr_data->{'parser_type'} ); - $translator->producer_type( $tr_data->{'producer_type'} ); - $translator->show_warnings( $tr_data->{'show_warnings'} ); - $translator->trace( $tr_data->{'trace'} ); + for my $cdata (@{ $tdata->{'constraints'} || [] }) { + $table->add_constraint(%$cdata) or die $table->error; } - return 1; + $table->comments($tdata->{'comments'}) + if exists $tdata->{'comments'}; + } + + # + # Views + # + my @views = map { $data->{'views'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'views'}{$_}{'order'}, $_ ] } + keys %{ $data->{'views'} }; + + for my $vdata (@views) { + $schema->add_view(%$vdata) or die $schema->error; + } + + # + # Triggers + # + my @triggers = map { $data->{'triggers'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'triggers'}{$_}{'order'}, $_ ] } + keys %{ $data->{'triggers'} }; + + for my $tdata (@triggers) { + $schema->add_trigger(%$tdata) or die $schema->error; + } + + # + # Procedures + # + my @procedures = map { $data->{'procedures'}{ $_->[1] } } + sort { $a->[0] <=> $b->[0] } + map { [ $data->{'procedures'}{$_}{'order'}, $_ ] } + keys %{ $data->{'procedures'} }; + + for my $tdata (@procedures) { + $schema->add_procedure(%$tdata) or die $schema->error; + } + + if (my $tr_data = $data->{'translator'}) { + $translator->add_drop_table($tr_data->{'add_drop_table'}); + $translator->filename($tr_data->{'filename'}); + $translator->no_comments($tr_data->{'no_comments'}); + $translator->parser_args($tr_data->{'parser_args'}); + $translator->producer_args($tr_data->{'producer_args'}); + $translator->parser_type($tr_data->{'parser_type'}); + $translator->producer_type($tr_data->{'producer_type'}); + $translator->show_warnings($tr_data->{'show_warnings'}); + $translator->trace($tr_data->{'trace'}); + } + + return 1; } 1; diff --git a/lib/SQL/Translator/Parser/xSV.pm b/lib/SQL/Translator/Parser/xSV.pm index 242a27a7c..47535998d 100644 --- a/lib/SQL/Translator/Parser/xSV.pm +++ b/lib/SQL/Translator/Parser/xSV.pm @@ -60,106 +60,99 @@ use base qw(Exporter); # Passed a SQL::Translator instance and a string containing the data # sub parse { - my ( $tr, $data ) = @_; - my $args = $tr->parser_args; - my $parser = Text::RecordParser->new( - field_separator => $args->{'field_separator'} || ',', - record_separator => $args->{'record_separator'} || "\n", - data => $data, - header_filter => \&normalize_name, - ); - - $parser->field_filter( sub { $_ = shift || ''; s/^\s+|\s+$//g; $_ } ) - unless defined $args->{'trim_fields'} && $args->{'trim_fields'} == 0; - - my $schema = $tr->schema; - my $table = $schema->add_table( name => 'table1' ); - - # - # Get the field names from the first row. - # - $parser->bind_header; - my @field_names = $parser->field_list; - - for ( my $i = 0; $i < @field_names; $i++ ) { - my $field = $table->add_field( - name => $field_names[$i], - data_type => 'char', - default_value => '', - size => 255, - is_nullable => 1, - is_auto_increment => undef, - ) or die $table->error; - - if ( $i == 0 ) { - $table->primary_key( $field->name ); - $field->is_primary_key(1); - } - } + my ($tr, $data) = @_; + my $args = $tr->parser_args; + my $parser = Text::RecordParser->new( + field_separator => $args->{'field_separator'} || ',', + record_separator => $args->{'record_separator'} || "\n", + data => $data, + header_filter => \&normalize_name, + ); - # - # If directed, look at every field's values to guess size and type. - # - unless ( - defined $args->{'scan_fields'} && - $args->{'scan_fields'} == 0 - ) { - my %field_info = map { $_, {} } @field_names; - while ( my $rec = $parser->fetchrow_hashref ) { - for my $field ( @field_names ) { - my $data = defined $rec->{ $field } ? $rec->{ $field } : ''; - my $size = [ length $data ]; - my $type; - - if ( $data =~ /^-?\d+$/ ) { - $type = 'integer'; - } - elsif ( - $data =~ /^-?[,\d]+\.[\d+]?$/ - || - $data =~ /^-?[,\d]+?\.\d+$/ - || - $data =~ /^-?\.\d+$/ - ) { - $type = 'float'; - my ( $w, $d ) = - map { s/,//g; length $_ || 1 } split( /\./, $data ); - $size = [ $w + $d, $d ]; - } - else { - $type = 'char'; - } - - for my $i ( 0, 1 ) { - next unless defined $size->[ $i ]; - my $fsize = $field_info{ $field }{'size'}[ $i ] || 0; - if ( $size->[ $i ] > $fsize ) { - $field_info{ $field }{'size'}[ $i ] = $size->[ $i ]; - } - } - - $field_info{ $field }{ $type }++; - } + $parser->field_filter(sub { $_ = shift || ''; s/^\s+|\s+$//g; $_ }) + unless defined $args->{'trim_fields'} && $args->{'trim_fields'} == 0; + + my $schema = $tr->schema; + my $table = $schema->add_table(name => 'table1'); + + # + # Get the field names from the first row. + # + $parser->bind_header; + my @field_names = $parser->field_list; + + for (my $i = 0; $i < @field_names; $i++) { + my $field = $table->add_field( + name => $field_names[$i], + data_type => 'char', + default_value => '', + size => 255, + is_nullable => 1, + is_auto_increment => undef, + ) or die $table->error; + + if ($i == 0) { + $table->primary_key($field->name); + $field->is_primary_key(1); + } + } + + # + # If directed, look at every field's values to guess size and type. + # + unless (defined $args->{'scan_fields'} + && $args->{'scan_fields'} == 0) { + my %field_info = map { $_, {} } @field_names; + while (my $rec = $parser->fetchrow_hashref) { + for my $field (@field_names) { + my $data = defined $rec->{$field} ? $rec->{$field} : ''; + my $size = [ length $data ]; + my $type; + + if ($data =~ /^-?\d+$/) { + $type = 'integer'; + } elsif ($data =~ /^-?[,\d]+\.[\d+]?$/ + || $data =~ /^-?[,\d]+?\.\d+$/ + || $data =~ /^-?\.\d+$/) { + $type = 'float'; + my ($w, $d) + = map { s/,//g; length $_ || 1 } split(/\./, $data); + $size = [ $w + $d, $d ]; + } else { + $type = 'char'; } - for my $field ( keys %field_info ) { - my $size = $field_info{ $field }{'size'} || [ 1 ]; - my $data_type = - $field_info{ $field }{'char'} ? 'char' : - $field_info{ $field }{'float'} ? 'float' : - $field_info{ $field }{'integer'} ? 'integer' : 'char'; + for my $i (0, 1) { + next unless defined $size->[$i]; + my $fsize = $field_info{$field}{'size'}[$i] || 0; + if ($size->[$i] > $fsize) { + $field_info{$field}{'size'}[$i] = $size->[$i]; + } + } - if ( $data_type eq 'char' && scalar @$size == 2 ) { - $size = [ $size->[0] + $size->[1] ]; - } + $field_info{$field}{$type}++; + } + } - my $field = $table->get_field( $field ); - $field->size( $size ); - $field->data_type( $data_type ); - } + for my $field (keys %field_info) { + my $size = $field_info{$field}{'size'} || [1]; + my $data_type + = $field_info{$field}{'char'} ? 'char' + : $field_info{$field}{'float'} ? 'float' + : $field_info{$field}{'integer'} ? 'integer' + : 'char'; + + if ($data_type eq 'char' && scalar @$size == 2) { + $size = [ $size->[0] + $size->[1] ]; + } + + my $field = $table->get_field($field); + $field->size($size); + $field->data_type($data_type); } + } - return 1; + return 1; } 1; diff --git a/lib/SQL/Translator/Producer.pm b/lib/SQL/Translator/Producer.pm index 36bbd4569..1359d0740 100644 --- a/lib/SQL/Translator/Producer.pm +++ b/lib/SQL/Translator/Producer.pm @@ -5,7 +5,7 @@ use warnings; use Scalar::Util (); our $VERSION = '1.64'; -sub produce { "" } +sub produce {""} # Do not rely on this if you are not bundled with SQL::Translator. # -- rjbs, 2008-09-30 @@ -19,38 +19,39 @@ sub _apply_default_value { my $default = $field->default_value; return if !defined $default; - if ($exceptions and ! ref $default) { + if ($exceptions and !ref $default) { for (my $i = 0; $i < @$exceptions; $i += 2) { my ($pat, $val) = @$exceptions[ $i, $i + 1 ]; if (ref $pat and $default =~ $pat) { - $default = $val; - last; + $default = $val; + last; } elsif (lc $default eq lc $pat) { - $default = $val; - last + $default = $val; + last; } } } my $type = lc $field->data_type; - my $is_numeric_datatype = ($type =~ /^(?:(?:big|medium|small|tiny)?int(?:eger)?|decimal|double|float|num(?:ber|eric)?|real)$/); + my $is_numeric_datatype + = ($type =~ /^(?:(?:big|medium|small|tiny)?int(?:eger)?|decimal|double|float|num(?:ber|eric)?|real)$/); if (ref $default) { - $$field_ref .= " DEFAULT $$default"; - } elsif ($is_numeric_datatype && Scalar::Util::looks_like_number ($default) ) { - # we need to check the data itself in addition to the datatype, for basic safety - $$field_ref .= " DEFAULT $default"; + $$field_ref .= " DEFAULT $$default"; + } elsif ($is_numeric_datatype && Scalar::Util::looks_like_number($default)) { +# we need to check the data itself in addition to the datatype, for basic safety + $$field_ref .= " DEFAULT $default"; } else { - $default = $self->_quote_string($default); - $$field_ref .= " DEFAULT $default"; + $default = $self->_quote_string($default); + $$field_ref .= " DEFAULT $default"; } } sub _quote_string { - my ($self, $string) = @_; - $string =~ s/'/''/g; - return qq{'$string'}; + my ($self, $string) = @_; + $string =~ s/'/''/g; + return qq{'$string'}; } 1; diff --git a/lib/SQL/Translator/Producer/ClassDBI.pm b/lib/SQL/Translator/Producer/ClassDBI.pm index 24b17506a..32e49a2d2 100644 --- a/lib/SQL/Translator/Producer/ClassDBI.pm +++ b/lib/SQL/Translator/Producer/ClassDBI.pm @@ -11,359 +11,335 @@ use SQL::Translator::Utils qw(debug header_comment); use Data::Dumper; my %CDBI_auto_pkgs = ( - MySQL => 'mysql', - PostgreSQL => 'Pg', - Oracle => 'Oracle', + MySQL => 'mysql', + PostgreSQL => 'Pg', + Oracle => 'Oracle', ); sub produce { - my $t = shift; - local $DEBUG = $t->debug; - my $no_comments = $t->no_comments; - my $schema = $t->schema; - my $args = $t->producer_args; - my @create; - - if ( my $fmt = $args->{'format_pkg_name'} ) { - $t->format_package_name( $fmt ); + my $t = shift; + local $DEBUG = $t->debug; + my $no_comments = $t->no_comments; + my $schema = $t->schema; + my $args = $t->producer_args; + my @create; + + if (my $fmt = $args->{'format_pkg_name'}) { + $t->format_package_name($fmt); + } + + if (my $fmt = $args->{'format_fk_name'}) { + $t->format_fk_name($fmt); + } + + my $db_user = $args->{'db_user'} || ''; + my $db_pass = $args->{'db_password'} || ''; + my $main_pkg_name = $args->{'package_name'} || + + # $args->{'main_pkg_name'} || # keep this? undocumented + $t->format_package_name('DBI'); + my $header = header_comment(__PACKAGE__, "# "); + my $parser_type = (split /::/, $t->parser_type)[-1]; + my $from = $CDBI_auto_pkgs{$parser_type} || ''; + my $dsn = $args->{'dsn'} || sprintf( + 'dbi:%s:_', $CDBI_auto_pkgs{$parser_type} + ? $CDBI_auto_pkgs{$parser_type} + : $parser_type + ); + my $sep = '# ' . '-' x 67; + + # + # Identify "link tables" (have only PK and FK fields). + # + my %linkable; + my %linktable; + for my $table ($schema->get_tables) { + debug("PKG: Table = ", $table->name, "\n"); + my $is_link = 1; + for my $field ($table->get_fields) { + unless ($field->is_primary_key or $field->is_foreign_key) { + $is_link = 0; + last; + } } - if ( my $fmt = $args->{'format_fk_name'} ) { - $t->format_fk_name( $fmt ); + next unless $is_link; + + foreach my $left ($table->get_fields) { + next unless $left->is_foreign_key; + my $lfk = $left->foreign_key_reference or next; + my $lr_table = $schema->get_table($lfk->reference_table) + or next; + my $lr_field_name = ($lfk->reference_fields)[0]; + my $lr_field = $lr_table->get_field($lr_field_name); + next unless $lr_field->is_primary_key; + + foreach my $right ($table->get_fields) { + next if $left->name eq $right->name; + + my $rfk = $right->foreign_key_reference or next; + my $rr_table = $schema->get_table($rfk->reference_table) + or next; + my $rr_field_name = ($rfk->reference_fields)[0]; + my $rr_field = $rr_table->get_field($rr_field_name); + next unless $rr_field->is_primary_key; + + $linkable{ $lr_table->name }{ $rr_table->name } = $table; + $linkable{ $rr_table->name }{ $lr_table->name } = $table; + $linktable{ $table->name } = $table; + } } - - my $db_user = $args->{'db_user'} || ''; - my $db_pass = $args->{'db_password'} || ''; - my $main_pkg_name = $args->{'package_name'} || - # $args->{'main_pkg_name'} || # keep this? undocumented - $t->format_package_name('DBI'); - my $header = header_comment( __PACKAGE__, "# " ); - my $parser_type = ( split /::/, $t->parser_type )[-1]; - my $from = $CDBI_auto_pkgs{$parser_type} || ''; - my $dsn = $args->{'dsn'} || sprintf( 'dbi:%s:_', - $CDBI_auto_pkgs{ $parser_type } - ? $CDBI_auto_pkgs{ $parser_type } : $parser_type - ); - my $sep = '# ' . '-' x 67; - + } + + # + # Iterate over all tables + # + my (%packages, $order); + for my $table ($schema->get_tables) { + my $table_name = $table->name or next; + + my $table_pkg_name = join '::', $main_pkg_name, $t->format_package_name($table_name); + $packages{$table_pkg_name} = { + order => ++$order, + pkg_name => $table_pkg_name, + base => $main_pkg_name, + table => $table_name, + }; # - # Identify "link tables" (have only PK and FK fields). + # Primary key may have a different accessor method name # - my %linkable; - my %linktable; - for my $table ( $schema->get_tables ) { - debug("PKG: Table = ", $table->name, "\n"); - my $is_link = 1; - for my $field ( $table->get_fields ) { - unless ( $field->is_primary_key or $field->is_foreign_key ) { - $is_link = 0; - last; - } - } - - next unless $is_link; - - foreach my $left ( $table->get_fields ) { - next unless $left->is_foreign_key; - my $lfk = $left->foreign_key_reference or next; - my $lr_table = $schema->get_table( $lfk->reference_table ) - or next; - my $lr_field_name = ( $lfk->reference_fields )[0]; - my $lr_field = $lr_table->get_field($lr_field_name); - next unless $lr_field->is_primary_key; - - foreach my $right ( $table->get_fields ) { - next if $left->name eq $right->name; - - my $rfk = $right->foreign_key_reference or next; - my $rr_table = $schema->get_table( $rfk->reference_table ) - or next; - my $rr_field_name = ( $rfk->reference_fields )[0]; - my $rr_field = $rr_table->get_field($rr_field_name); - next unless $rr_field->is_primary_key; - - $linkable{ $lr_table->name }{ $rr_table->name } = $table; - $linkable{ $rr_table->name }{ $lr_table->name } = $table; - $linktable{ $table->name } = $table; - } - } - } - + # if ( my $constraint = $table->primary_key ) { + # my $field = ( $constraint->fields )[0]; + # $packages{ $table_pkg_name }{'_columns_primary'} = $field; # - # Iterate over all tables + # if ( my $pk_xform = $t->format_pk_name ) { + # my $pk_name = $pk_xform->( $table_pkg_name, $field ); # - my ( %packages, $order ); - for my $table ( $schema->get_tables ) { - my $table_name = $table->name or next; - - my $table_pkg_name = join '::', $main_pkg_name, $t->format_package_name($table_name); - $packages{ $table_pkg_name } = { - order => ++$order, - pkg_name => $table_pkg_name, - base => $main_pkg_name, - table => $table_name, - }; + # $packages{$table_pkg_name}{'pk_accessor'} = + # "#\n# Primary key accessor\n#\n" + # . "sub $pk_name {\n shift->$field\n}\n\n"; + # } + # } + + my $is_data = 0; + foreach my $field ($table->get_fields) { + if (!$field->is_foreign_key and !$field->is_primary_key) { + push @{ $packages{$table_pkg_name}{'_columns_essential'} }, $field->name; + $is_data++; + } elsif (!$field->is_primary_key) { + push @{ $packages{$table_pkg_name}{'_columns_others'} }, $field->name; + } + } - # - # Primary key may have a different accessor method name - # -# if ( my $constraint = $table->primary_key ) { -# my $field = ( $constraint->fields )[0]; -# $packages{ $table_pkg_name }{'_columns_primary'} = $field; -# -# if ( my $pk_xform = $t->format_pk_name ) { -# my $pk_name = $pk_xform->( $table_pkg_name, $field ); -# -# $packages{$table_pkg_name}{'pk_accessor'} = -# "#\n# Primary key accessor\n#\n" -# . "sub $pk_name {\n shift->$field\n}\n\n"; -# } -# } - - my $is_data = 0; - foreach my $field ( $table->get_fields ) { - if ( !$field->is_foreign_key and !$field->is_primary_key ) { - push @{ $packages{$table_pkg_name}{'_columns_essential'} }, - $field->name; - $is_data++; - } - elsif ( !$field->is_primary_key ) { - push @{ $packages{$table_pkg_name}{'_columns_others'} }, - $field->name; - } + my %linked; + if ($is_data) { + foreach my $link (keys %{ $linkable{$table_name} }) { + my $linkmethodname; + + if (my $fk_xform = $t->format_fk_name) { + + # ADD CALLBACK FOR PLURALIZATION MANGLING HERE + $linkmethodname + = $fk_xform->($linkable{$table_name}{$link}->name, ($schema->get_table($link)->primary_key->fields)[0]) + . 's'; + } else { + # ADD CALLBACK FOR PLURALIZATION MANGLING HERE + $linkmethodname + = $linkable{$table_name}{$link}->name . '_' . ($schema->get_table($link)->primary_key->fields)[0] . 's'; } - my %linked; - if ($is_data) { - foreach my $link ( keys %{ $linkable{$table_name} } ) { - my $linkmethodname; - - if ( my $fk_xform = $t->format_fk_name ) { - - # ADD CALLBACK FOR PLURALIZATION MANGLING HERE - $linkmethodname = $fk_xform->( - $linkable{ $table_name }{ $link }->name, - ( $schema->get_table( $link )->primary_key->fields )[0] - ) - . 's'; - } - else { - # ADD CALLBACK FOR PLURALIZATION MANGLING HERE - $linkmethodname = - $linkable{ $table_name }{ $link }->name . '_' - . ( $schema->get_table( $link )->primary_key->fields )[0] - . 's'; - } - - my @rk_fields = (); - my @lk_fields = (); - foreach my $field ( $linkable{$table_name}{$link}->get_fields ) - { - next unless $field->is_foreign_key; - - next unless ( - $field->foreign_key_reference->reference_table eq - $table_name - || - $field->foreign_key_reference->reference_table eq $link - ); - - push @lk_fields, - ( $field->foreign_key_reference->reference_fields )[0] - if $field->foreign_key_reference->reference_table eq - $link; - - push @rk_fields, $field->name - if $field->foreign_key_reference->reference_table eq - $table_name; - } - - # - # If one possible traversal via link table. - # - if ( scalar(@rk_fields) == 1 and scalar(@lk_fields) == 1 ) { - foreach my $rk_field (@rk_fields) { - push @{ $packages{$table_pkg_name}{'has_many'}{$link} }, - "sub " - . $linkmethodname - . " { my \$self = shift; " - . "return map \$_->" - . ( $schema->get_table($link)->primary_key->fields ) - [0] - . ", \$self->" - . $linkable{$table_name}{$link}->name . "_" - . $rk_field - . " }\n\n"; - } - - # - # Else there is more than one way to traverse it. - # ack! Let's treat these types of link tables as - # a many-to-one (easier) - # - # NOTE: we need to rethink the link method name, - # as the cardinality has shifted on us. - # - } - elsif ( scalar(@rk_fields) == 1 ) { - foreach my $rk_field (@rk_fields) { - # - # ADD CALLBACK FOR PLURALIZATION MANGLING HERE - # - push @{ $packages{$table_pkg_name}{'has_many'}{$link} }, - "sub " - . $linkable{$table_name}{$link}->name - . "s { my \$self = shift; return \$self->" - . $linkable{$table_name}{$link}->name . "_" - . $rk_field - . "(\@_) }\n\n"; - } - } - elsif ( scalar(@lk_fields) == 1 ) { - # - # These will be taken care of on the other end... - # - } - else { - # - # Many many many. Need multiple iterations here, - # data structure revision to handle N FK sources. - # This code has not been tested and likely doesn't - # work here. - # - foreach my $rk_field (@rk_fields) { - # ADD CALLBACK FOR PLURALIZATION MANGLING HERE - push @{ $packages{$table_pkg_name}{'has_many'}{$link} }, - "sub " - . $linkable{$table_name}{$link}->name . "_" - . $rk_field - . "s { my \$self = shift; return \$self->" - . $linkable{$table_name}{$link}->name . "_" - . $rk_field - . "(\@_) }\n\n"; - } - } - } + my @rk_fields = (); + my @lk_fields = (); + foreach my $field ($linkable{$table_name}{$link}->get_fields) { + next unless $field->is_foreign_key; + + next + unless ($field->foreign_key_reference->reference_table eq $table_name + || $field->foreign_key_reference->reference_table eq $link); + + push @lk_fields, ($field->foreign_key_reference->reference_fields)[0] + if $field->foreign_key_reference->reference_table eq $link; + + push @rk_fields, $field->name + if $field->foreign_key_reference->reference_table eq $table_name; } # - # Use foreign keys to set up "has_a/has_many" relationships. + # If one possible traversal via link table. # - foreach my $field ( $table->get_fields ) { - if ( $field->is_foreign_key ) { - my $table_name = $table->name; - my $field_name = $field->name; -# my $fk_method = $t->format_fk_name( $table_name, $field_name ); - my $fk_method = join('::', $table_pkg_name, - $t->format_fk_name( $table_name, $field_name ) - ); - my $fk = $field->foreign_key_reference; - my $ref_table = $fk->reference_table; - my $ref_pkg = $t->format_package_name($ref_table); - my $ref_field = ( $fk->reference_fields )[0]; -# my $fk_method = join('::', -# $table_pkg_name, $t->format_fk_name( $ref_table ) -# ); - - push @{ $packages{$table_pkg_name}{'has_a'} }, - "$table_pkg_name->has_a(\n" - . " $field_name => '$ref_pkg'\n);\n\n" - . "sub $fk_method {\n" - . " return shift->$field_name\n}\n\n" - ; - - # if there weren't M-M relationships via the has_many - # being set up here, create nice pluralized method alias - # rather for user as alt. to ugly tablename_fieldname name - # -# if ( !$packages{$ref_pkg}{'has_many'}{$table_name} ) { -# # -# # ADD CALLBACK FOR PLURALIZATION MANGLING HERE -# # -# push @{ $packages{$ref_pkg}{'has_many'}{$table_name} }, -# "sub ${table_name}s {\n " . -# "return shift->$table_name\_$field_name\n}\n\n"; -# # else ugly -# } -# else { -# } - - push @{ $packages{$ref_pkg}{'has_many'}{$table_name} }, - "$ref_pkg->has_many(\n '${table_name}_${field_name}', " - . "'$table_pkg_name' => '$field_name'\n);\n\n"; - - } + if (scalar(@rk_fields) == 1 and scalar(@lk_fields) == 1) { + foreach my $rk_field (@rk_fields) { + push @{ $packages{$table_pkg_name}{'has_many'}{$link} }, + "sub " + . $linkmethodname + . " { my \$self = shift; " + . "return map \$_->" + . ($schema->get_table($link)->primary_key->fields)[0] + . ", \$self->" + . $linkable{$table_name}{$link}->name . "_" + . $rk_field + . " }\n\n"; + } + + # + # Else there is more than one way to traverse it. + # ack! Let's treat these types of link tables as + # a many-to-one (easier) + # + # NOTE: we need to rethink the link method name, + # as the cardinality has shifted on us. + # + } elsif (scalar(@rk_fields) == 1) { + foreach my $rk_field (@rk_fields) { + # + # ADD CALLBACK FOR PLURALIZATION MANGLING HERE + # + push @{ $packages{$table_pkg_name}{'has_many'}{$link} }, + "sub " + . $linkable{$table_name}{$link}->name + . "s { my \$self = shift; return \$self->" + . $linkable{$table_name}{$link}->name . "_" + . $rk_field + . "(\@_) }\n\n"; + } + } elsif (scalar(@lk_fields) == 1) { + # + # These will be taken care of on the other end... + # + } else { + # + # Many many many. Need multiple iterations here, + # data structure revision to handle N FK sources. + # This code has not been tested and likely doesn't + # work here. + # + foreach my $rk_field (@rk_fields) { + + # ADD CALLBACK FOR PLURALIZATION MANGLING HERE + push @{ $packages{$table_pkg_name}{'has_many'}{$link} }, + "sub " + . $linkable{$table_name}{$link}->name . "_" + . $rk_field + . "s { my \$self = shift; return \$self->" + . $linkable{$table_name}{$link}->name . "_" + . $rk_field + . "(\@_) }\n\n"; + } } + } } # - # Now build up text of package. + # Use foreign keys to set up "has_a/has_many" relationships. # - my $base_pkg = sprintf( 'Class::DBI%s', $from ? "::$from" : '' ); - push @create, join ( "\n", + foreach my $field ($table->get_fields) { + if ($field->is_foreign_key) { + my $table_name = $table->name; + my $field_name = $field->name; + +# my $fk_method = $t->format_fk_name( $table_name, $field_name ); + my $fk_method = join('::', $table_pkg_name, $t->format_fk_name($table_name, $field_name)); + my $fk = $field->foreign_key_reference; + my $ref_table = $fk->reference_table; + my $ref_pkg = $t->format_package_name($ref_table); + my $ref_field = ($fk->reference_fields)[0]; + + # my $fk_method = join('::', + # $table_pkg_name, $t->format_fk_name( $ref_table ) + # ); + + push @{ $packages{$table_pkg_name}{'has_a'} }, + "$table_pkg_name->has_a(\n" + . " $field_name => '$ref_pkg'\n);\n\n" + . "sub $fk_method {\n" + . " return shift->$field_name\n}\n\n"; + + # if there weren't M-M relationships via the has_many + # being set up here, create nice pluralized method alias + # rather for user as alt. to ugly tablename_fieldname name + # + # if ( !$packages{$ref_pkg}{'has_many'}{$table_name} ) { + # # + # # ADD CALLBACK FOR PLURALIZATION MANGLING HERE + # # + # push @{ $packages{$ref_pkg}{'has_many'}{$table_name} }, + # "sub ${table_name}s {\n " . + # "return shift->$table_name\_$field_name\n}\n\n"; + # # else ugly + # } + # else { + # } + + push @{ $packages{$ref_pkg}{'has_many'}{$table_name} }, + "$ref_pkg->has_many(\n '${table_name}_${field_name}', " . "'$table_pkg_name' => '$field_name'\n);\n\n"; + + } + } + } + + # + # Now build up text of package. + # + my $base_pkg = sprintf('Class::DBI%s', $from ? "::$from" : ''); + push @create, + join("\n", "package $main_pkg_name;\n", - $header, - "use strict;", + $header, "use strict;", "use base '$base_pkg';\n", "$main_pkg_name->set_db('Main', '$dsn', '$db_user', '$db_pass');\n\n", - ); - - for my $pkg_name ( - sort { $packages{ $a }{'order'} <=> $packages{ $b }{'order'} } - keys %packages - ) { - my $pkg = $packages{$pkg_name} or next; - next unless $pkg->{'pkg_name'}; - - push @create, join ( "\n", - $sep, - "package " . $pkg->{'pkg_name'} . ";", - "use base '" . $pkg->{'base'} . "';", - "use Class::DBI::Pager;\n\n", + ); + + for my $pkg_name ( + sort { $packages{$a}{'order'} <=> $packages{$b}{'order'} } + keys %packages + ) { + my $pkg = $packages{$pkg_name} or next; + next unless $pkg->{'pkg_name'}; + + push @create, + join("\n", + $sep, + "package " . $pkg->{'pkg_name'} . ";", + "use base '" . $pkg->{'base'} . "';", + "use Class::DBI::Pager;\n\n", ); - if ( $from ) { - push @create, join('', - $pkg->{'pkg_name'}, - "->set_up_table('", - $pkg->{'table'}, - "');\n\n" - ); - } - else { - my $table = $schema->get_table( $pkg->{'table'} ); - my @field_names = map { $_->name } $table->get_fields; - - push @create, join("\n", - $pkg_name."->table('".$pkg->{'table'}."');\n", - $pkg_name."->columns(All => qw/". - join(' ', @field_names)."/);\n\n", - ); - } - - push @create, "\n"; - - if ( my $pk = $pkg->{'pk_accessor'} ) { - push @create, $pk; - } + if ($from) { + push @create, join('', $pkg->{'pkg_name'}, "->set_up_table('", $pkg->{'table'}, "');\n\n"); + } else { + my $table = $schema->get_table($pkg->{'table'}); + my @field_names = map { $_->name } $table->get_fields; + + push @create, + join("\n", + $pkg_name . "->table('" . $pkg->{'table'} . "');\n", + $pkg_name . "->columns(All => qw/" . join(' ', @field_names) . "/);\n\n", + ); + } - if ( my @has_a = @{ $pkg->{'has_a'} || [] } ) { - push @create, $_ for @has_a; - } + push @create, "\n"; - foreach my $has_many_key ( keys %{ $pkg->{'has_many'} } ) { - if ( my @has_many = @{ $pkg->{'has_many'}{$has_many_key} || [] } ) { - push @create, $_ for @has_many; - } - } + if (my $pk = $pkg->{'pk_accessor'}) { + push @create, $pk; + } + + if (my @has_a = @{ $pkg->{'has_a'} || [] }) { + push @create, $_ for @has_a; + } + + foreach my $has_many_key (keys %{ $pkg->{'has_many'} }) { + if (my @has_many = @{ $pkg->{'has_many'}{$has_many_key} || [] }) { + push @create, $_ for @has_many; + } } + } - push @create, "1;\n"; + push @create, "1;\n"; - return wantarray - ? @create - : join('', @create); + return wantarray + ? @create + : join('', @create); } 1; diff --git a/lib/SQL/Translator/Producer/DB2.pm b/lib/SQL/Translator/Producer/DB2.pm index e01d39a2e..08864e57c 100644 --- a/lib/SQL/Translator/Producer/DB2.pm +++ b/lib/SQL/Translator/Producer/DB2.pm @@ -20,14 +20,13 @@ Creates an SQL DDL suitable for DB2. use warnings; use strict; use warnings; -our ( $DEBUG, $WARN ); +our ($DEBUG, $WARN); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(header_comment); - # http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/ad/r0006844.htm # This is a terrible WTDI, each Parser should parse down to some standard set @@ -35,6 +34,7 @@ use SQL::Translator::Utils qw(header_comment); # weird types like "polygon" if needed (IMO anyway) my %dt_translate; + BEGIN { %dt_translate = ( # @@ -86,341 +86,346 @@ BEGIN { # # DB types # - number => 'integer', - varchar2 => 'varchar', - long => 'clob', -); + number => 'integer', + varchar2 => 'varchar', + long => 'clob', + ); } -my %db2_reserved = map { $_ => 1} qw/ -ADD DETERMINISTIC LEAVE RESTART -AFTER DISALLOW LEFT RESTRICT -ALIAS DISCONNECT LIKE RESULT -ALL DISTINCT LINKTYPE RESULT_SET_LOCATOR -ALLOCATE DO LOCAL RETURN -ALLOW DOUBLE LOCALE RETURNS -ALTER DROP LOCATOR REVOKE -AND DSNHATTR LOCATORS RIGHT -ANY DSSIZE LOCK ROLLBACK -APPLICATION DYNAMIC LOCKMAX ROUTINE -AS EACH LOCKSIZE ROW -ASSOCIATE EDITPROC LONG ROWS -ASUTIME ELSE LOOP RRN -AUDIT ELSEIF MAXVALUE RUN -AUTHORIZATION ENCODING MICROSECOND SAVEPOINT -AUX END MICROSECONDS SCHEMA -AUXILIARY END-EXEC MINUTE SCRATCHPAD -BEFORE END-EXEC1 MINUTES SECOND -BEGIN ERASE MINVALUE SECONDS -BETWEEN ESCAPE MODE SECQTY -BINARY EXCEPT MODIFIES SECURITY -BUFFERPOOL EXCEPTION MONTH SELECT -BY EXCLUDING MONTHS SENSITIVE -CACHE EXECUTE NEW SET -CALL EXISTS NEW_TABLE SIGNAL -CALLED EXIT NO SIMPLE -CAPTURE EXTERNAL NOCACHE SOME -CARDINALITY FENCED NOCYCLE SOURCE -CASCADED FETCH NODENAME SPECIFIC -CASE FIELDPROC NODENUMBER SQL -CAST FILE NOMAXVALUE SQLID -CCSID FINAL NOMINVALUE STANDARD -CHAR FOR NOORDER START -CHARACTER FOREIGN NOT STATIC -CHECK FREE NULL STAY -CLOSE FROM NULLS STOGROUP -CLUSTER FULL NUMPARTS STORES -COLLECTION FUNCTION OBID STYLE -COLLID GENERAL OF SUBPAGES -COLUMN GENERATED OLD SUBSTRING -COMMENT GET OLD_TABLE SYNONYM -COMMIT GLOBAL ON SYSFUN -CONCAT GO OPEN SYSIBM -CONDITION GOTO OPTIMIZATION SYSPROC -CONNECT GRANT OPTIMIZE SYSTEM -CONNECTION GRAPHIC OPTION TABLE -CONSTRAINT GROUP OR TABLESPACE -CONTAINS HANDLER ORDER THEN -CONTINUE HAVING OUT TO -COUNT HOLD OUTER TRANSACTION -COUNT_BIG HOUR OVERRIDING TRIGGER -CREATE HOURS PACKAGE TRIM -CROSS IDENTITY PARAMETER TYPE -CURRENT IF PART UNDO -CURRENT_DATE IMMEDIATE PARTITION UNION -CURRENT_LC_CTYPE IN PATH UNIQUE -CURRENT_PATH INCLUDING PIECESIZE UNTIL -CURRENT_SERVER INCREMENT PLAN UPDATE -CURRENT_TIME INDEX POSITION USAGE -CURRENT_TIMESTAMP INDICATOR PRECISION USER -CURRENT_TIMEZONE INHERIT PREPARE USING -CURRENT_USER INNER PRIMARY VALIDPROC -CURSOR INOUT PRIQTY VALUES -CYCLE INSENSITIVE PRIVILEGES VARIABLE -DATA INSERT PROCEDURE VARIANT -DATABASE INTEGRITY PROGRAM VCAT -DAY INTO PSID VIEW -DAYS IS QUERYNO VOLUMES -DB2GENERAL ISOBID READ WHEN -DB2GENRL ISOLATION READS WHERE -DB2SQL ITERATE RECOVERY WHILE -DBINFO JAR REFERENCES WITH -DECLARE JAVA REFERENCING WLM -DEFAULT JOIN RELEASE WRITE -DEFAULTS KEY RENAME YEAR -DEFINITION LABEL REPEAT YEARS -DELETE LANGUAGE RESET -DESCRIPTOR LC_CTYPE RESIGNAL -/; - -sub produce -{ - my ($translator) = @_; - $DEBUG = $translator->debug; - $WARN = $translator->show_warnings; - my $no_comments = $translator->no_comments; - my $add_drop_table = $translator->add_drop_table; - my $schema = $translator->schema; - my $output = ''; - my $indent = ' '; - - $output .= header_comment unless($no_comments); - my (@table_defs, @fks, @index_defs); - foreach my $table ($schema->get_tables) - { - push @table_defs, 'DROP TABLE ' . $table->name . ";" if $add_drop_table; - my ($table_def, $fks) = create_table($table, { - no_comments => $no_comments}); - push @table_defs, $table_def; - push @fks, @$fks; - - foreach my $index ($table->get_indices) - { - push @index_defs, create_index($index); - } - - } - my (@view_defs); - foreach my $view ( $schema->get_views ) - { - push @view_defs, create_view($view); +my %db2_reserved = map { $_ => 1 } qw/ + ADD DETERMINISTIC LEAVE RESTART + AFTER DISALLOW LEFT RESTRICT + ALIAS DISCONNECT LIKE RESULT + ALL DISTINCT LINKTYPE RESULT_SET_LOCATOR + ALLOCATE DO LOCAL RETURN + ALLOW DOUBLE LOCALE RETURNS + ALTER DROP LOCATOR REVOKE + AND DSNHATTR LOCATORS RIGHT + ANY DSSIZE LOCK ROLLBACK + APPLICATION DYNAMIC LOCKMAX ROUTINE + AS EACH LOCKSIZE ROW + ASSOCIATE EDITPROC LONG ROWS + ASUTIME ELSE LOOP RRN + AUDIT ELSEIF MAXVALUE RUN + AUTHORIZATION ENCODING MICROSECOND SAVEPOINT + AUX END MICROSECONDS SCHEMA + AUXILIARY END-EXEC MINUTE SCRATCHPAD + BEFORE END-EXEC1 MINUTES SECOND + BEGIN ERASE MINVALUE SECONDS + BETWEEN ESCAPE MODE SECQTY + BINARY EXCEPT MODIFIES SECURITY + BUFFERPOOL EXCEPTION MONTH SELECT + BY EXCLUDING MONTHS SENSITIVE + CACHE EXECUTE NEW SET + CALL EXISTS NEW_TABLE SIGNAL + CALLED EXIT NO SIMPLE + CAPTURE EXTERNAL NOCACHE SOME + CARDINALITY FENCED NOCYCLE SOURCE + CASCADED FETCH NODENAME SPECIFIC + CASE FIELDPROC NODENUMBER SQL + CAST FILE NOMAXVALUE SQLID + CCSID FINAL NOMINVALUE STANDARD + CHAR FOR NOORDER START + CHARACTER FOREIGN NOT STATIC + CHECK FREE NULL STAY + CLOSE FROM NULLS STOGROUP + CLUSTER FULL NUMPARTS STORES + COLLECTION FUNCTION OBID STYLE + COLLID GENERAL OF SUBPAGES + COLUMN GENERATED OLD SUBSTRING + COMMENT GET OLD_TABLE SYNONYM + COMMIT GLOBAL ON SYSFUN + CONCAT GO OPEN SYSIBM + CONDITION GOTO OPTIMIZATION SYSPROC + CONNECT GRANT OPTIMIZE SYSTEM + CONNECTION GRAPHIC OPTION TABLE + CONSTRAINT GROUP OR TABLESPACE + CONTAINS HANDLER ORDER THEN + CONTINUE HAVING OUT TO + COUNT HOLD OUTER TRANSACTION + COUNT_BIG HOUR OVERRIDING TRIGGER + CREATE HOURS PACKAGE TRIM + CROSS IDENTITY PARAMETER TYPE + CURRENT IF PART UNDO + CURRENT_DATE IMMEDIATE PARTITION UNION + CURRENT_LC_CTYPE IN PATH UNIQUE + CURRENT_PATH INCLUDING PIECESIZE UNTIL + CURRENT_SERVER INCREMENT PLAN UPDATE + CURRENT_TIME INDEX POSITION USAGE + CURRENT_TIMESTAMP INDICATOR PRECISION USER + CURRENT_TIMEZONE INHERIT PREPARE USING + CURRENT_USER INNER PRIMARY VALIDPROC + CURSOR INOUT PRIQTY VALUES + CYCLE INSENSITIVE PRIVILEGES VARIABLE + DATA INSERT PROCEDURE VARIANT + DATABASE INTEGRITY PROGRAM VCAT + DAY INTO PSID VIEW + DAYS IS QUERYNO VOLUMES + DB2GENERAL ISOBID READ WHEN + DB2GENRL ISOLATION READS WHERE + DB2SQL ITERATE RECOVERY WHILE + DBINFO JAR REFERENCES WITH + DECLARE JAVA REFERENCING WLM + DEFAULT JOIN RELEASE WRITE + DEFAULTS KEY RENAME YEAR + DEFINITION LABEL REPEAT YEARS + DELETE LANGUAGE RESET + DESCRIPTOR LC_CTYPE RESIGNAL + /; + +sub produce { + my ($translator) = @_; + $DEBUG = $translator->debug; + $WARN = $translator->show_warnings; + my $no_comments = $translator->no_comments; + my $add_drop_table = $translator->add_drop_table; + my $schema = $translator->schema; + my $output = ''; + my $indent = ' '; + + $output .= header_comment unless ($no_comments); + my (@table_defs, @fks, @index_defs); + foreach my $table ($schema->get_tables) { + push @table_defs, 'DROP TABLE ' . $table->name . ";" if $add_drop_table; + my ($table_def, $fks) = create_table( + $table, + { + no_comments => $no_comments + } + ); + push @table_defs, $table_def; + push @fks, @$fks; + + foreach my $index ($table->get_indices) { + push @index_defs, create_index($index); } - my (@trigger_defs); - foreach my $trigger ( $schema->get_triggers ) - { - push @trigger_defs, create_trigger($trigger); - } - - return wantarray ? (@table_defs, @fks, @index_defs, @view_defs, @trigger_defs) : - $output . join("\n\n", @table_defs, @fks, @index_defs, @view_defs, @trigger_defs) . "\n"; -} -{ my %objnames; - - sub check_name - { - my ($name, $type, $length) = @_; - - my $newname = $name; - if(length($name) > $length) ## Maximum table name length is 18 - { - warn "Table name $name is longer than $length characters, truncated" if $WARN; -# if(grep {$_ eq substr($name, 0, $length) } -# values(%{$objnames{$type}})) -# { -# die "Got multiple matching table names when truncated"; -# } -# $objnames{$type}{$name} = substr($name, 0,$length); -# $newname = $objnames{$type}{$name}; - } - - if($db2_reserved{uc($newname)}) - { - warn "$newname is a reserved word in DB2!" if $WARN; - } - -# return sprintf("%-*s", $length-5, $newname); - return $newname; - } + } + my (@view_defs); + foreach my $view ($schema->get_views) { + push @view_defs, create_view($view); + } + my (@trigger_defs); + foreach my $trigger ($schema->get_triggers) { + push @trigger_defs, create_trigger($trigger); + } + + return wantarray + ? (@table_defs, @fks, @index_defs, @view_defs, @trigger_defs) + : $output . join("\n\n", @table_defs, @fks, @index_defs, @view_defs, @trigger_defs) . "\n"; } -sub create_table { - my ($table, $options) = @_; + my %objnames; - my $table_name = check_name($table->name, 'tables', 128); - # this limit is 18 in older DB2s ! (<= 8) + sub check_name { + my ($name, $type, $length) = @_; - my (@field_defs, @comments); - push @comments, "--\n-- Table: $table_name\n--" unless $options->{no_comments}; - foreach my $field ($table->get_fields) + my $newname = $name; + if (length($name) > $length) ## Maximum table name length is 18 { - push @field_defs, create_field($field); + warn "Table name $name is longer than $length characters, truncated" + if $WARN; + + # if(grep {$_ eq substr($name, 0, $length) } + # values(%{$objnames{$type}})) + # { + # die "Got multiple matching table names when truncated"; + # } + # $objnames{$type}{$name} = substr($name, 0,$length); + # $newname = $objnames{$type}{$name}; } - my (@con_defs, @fks); - foreach my $con ($table->get_constraints) - { - my ($cdefs, $fks) = create_constraint($con); - push @con_defs, @$cdefs; - push @fks, @$fks; + + if ($db2_reserved{ uc($newname) }) { + warn "$newname is a reserved word in DB2!" if $WARN; } - my $tablespace = $table->extra()->{'TABLESPACE'} || ''; - my $table_def = "CREATE TABLE $table_name (\n"; - $table_def .= join (",\n", map { " $_" } @field_defs, @con_defs); - $table_def .= "\n)"; - $table_def .= $tablespace ? "IN $tablespace;" : ';'; + # return sprintf("%-*s", $length-5, $newname); + return $newname; + } +} - return $table_def, \@fks; +sub create_table { + my ($table, $options) = @_; + + my $table_name = check_name($table->name, 'tables', 128); + + # this limit is 18 in older DB2s ! (<= 8) + + my (@field_defs, @comments); + push @comments, "--\n-- Table: $table_name\n--" + unless $options->{no_comments}; + foreach my $field ($table->get_fields) { + push @field_defs, create_field($field); + } + my (@con_defs, @fks); + foreach my $con ($table->get_constraints) { + my ($cdefs, $fks) = create_constraint($con); + push @con_defs, @$cdefs; + push @fks, @$fks; + } + + my $tablespace = $table->extra()->{'TABLESPACE'} || ''; + my $table_def = "CREATE TABLE $table_name (\n"; + $table_def .= join(",\n", map {" $_"} @field_defs, @con_defs); + $table_def .= "\n)"; + $table_def .= $tablespace ? "IN $tablespace;" : ';'; + + return $table_def, \@fks; } -sub create_field -{ - my ($field) = @_; - - my $field_name = check_name($field->name, 'fields', 30); -# use Data::Dumper; -# print Dumper(\%dt_translate); -# print $field->data_type, " ", $dt_translate{lc($field->data_type)}, "\n"; - my $data_type = uc($dt_translate{lc($field->data_type)} || $field->data_type); - my $size = $field->size(); - - my $field_def = "$field_name $data_type"; - $field_def .= $field->is_auto_increment ? - ' GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1)' : ''; - $field_def .= $data_type =~ /(CHAR|CLOB|NUMERIC|DECIMAL)/i ? "(${size})" : ''; - $field_def .= !$field->is_nullable ? ' NOT NULL':''; -# $field_def .= $field->is_primary_key ? ' PRIMARY KEY':''; - $field_def .= !defined $field->default_value ? '' : - $field->default_value =~ /current( |_)timestamp/i || - $field->default_value =~ /\Qnow()\E/i ? - ' DEFAULT CURRENT TIMESTAMP' : defined $field->default_value ? - (" DEFAULT " . ($data_type =~ /(INT|DOUBLE)/i ? - $field->default_value : "'" . $field->default_value . "'") - ) : ''; - - return $field_def; +sub create_field { + my ($field) = @_; + + my $field_name = check_name($field->name, 'fields', 30); + + # use Data::Dumper; + # print Dumper(\%dt_translate); + # print $field->data_type, " ", $dt_translate{lc($field->data_type)}, "\n"; + my $data_type = uc($dt_translate{ lc($field->data_type) } || $field->data_type); + my $size = $field->size(); + + my $field_def = "$field_name $data_type"; + $field_def + .= $field->is_auto_increment + ? ' GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1)' + : ''; + $field_def .= $data_type =~ /(CHAR|CLOB|NUMERIC|DECIMAL)/i ? "(${size})" : ''; + $field_def .= !$field->is_nullable ? ' NOT NULL' : ''; + + # $field_def .= $field->is_primary_key ? ' PRIMARY KEY':''; + $field_def + .= !defined $field->default_value + ? '' + : $field->default_value =~ /current( |_)timestamp/i + || $field->default_value =~ /\Qnow()\E/i ? ' DEFAULT CURRENT TIMESTAMP' + : defined $field->default_value ? ( + " DEFAULT " + . ( + $data_type =~ /(INT|DOUBLE)/i + ? $field->default_value + : "'" . $field->default_value . "'" + ) + ) + : ''; + + return $field_def; } -sub create_index -{ - my ($index) = @_; +sub create_index { + my ($index) = @_; - my $out = sprintf('CREATE %sINDEX %s ON %s ( %s );', - $index->type() =~ /^UNIQUE$/i ? 'UNIQUE' : '', - $index->name, - $index->table->name, - join(', ', $index->fields) ); + my $out = sprintf( + 'CREATE %sINDEX %s ON %s ( %s );', + $index->type() =~ /^UNIQUE$/i ? 'UNIQUE' : '', + $index->name, $index->table->name, join(', ', $index->fields) + ); - return $out; + return $out; } -sub create_constraint -{ - my ($constraint) = @_; - - my (@con_defs, @fks); - - my $ctype = $constraint->type =~ /^PRIMARY(_|\s)KEY$/i ? 'PRIMARY KEY' : - $constraint->type =~ /^UNIQUE$/i ? 'UNIQUE' : - $constraint->type =~ /^CHECK_C$/i ? 'CHECK' : - $constraint->type =~ /^FOREIGN(_|\s)KEY$/i ? 'FOREIGN KEY' : ''; - - my $expr = $constraint->type =~ /^CHECK_C$/i ? $constraint->expression : - ''; - my $ref = $constraint->type =~ /^FOREIGN(_|\s)KEY$/i ? ('REFERENCES ' . $constraint->reference_table . '(' . join(', ', $constraint->reference_fields) . ')') : ''; - my $update = $constraint->on_update ? $constraint->on_update : ''; - my $delete = $constraint->on_delete ? $constraint->on_delete : ''; - - my $out = join(' ', grep { $_ } - $constraint->name ? ('CONSTRAINT ' . $constraint->name) : '', - $ctype, - '(' . join (', ', $constraint->fields) . ')', - $expr ? $expr : $ref, - $update, - $delete); - if ($constraint->type eq FOREIGN_KEY) { - my $table_name = $constraint->table->name; - $out = "ALTER TABLE $table_name ADD $out;"; - push @fks, $out; - } - else { - push @con_defs, $out; - } - - return \@con_defs, \@fks; +sub create_constraint { + my ($constraint) = @_; + + my (@con_defs, @fks); + + my $ctype + = $constraint->type =~ /^PRIMARY(_|\s)KEY$/i ? 'PRIMARY KEY' + : $constraint->type =~ /^UNIQUE$/i ? 'UNIQUE' + : $constraint->type =~ /^CHECK_C$/i ? 'CHECK' + : $constraint->type =~ /^FOREIGN(_|\s)KEY$/i ? 'FOREIGN KEY' + : ''; + + my $expr + = $constraint->type =~ /^CHECK_C$/i + ? $constraint->expression + : ''; + my $ref + = $constraint->type =~ /^FOREIGN(_|\s)KEY$/i + ? ('REFERENCES ' . $constraint->reference_table . '(' . join(', ', $constraint->reference_fields) . ')') + : ''; + my $update = $constraint->on_update ? $constraint->on_update : ''; + my $delete = $constraint->on_delete ? $constraint->on_delete : ''; + + my $out = join(' ', + grep {$_} $constraint->name ? ('CONSTRAINT ' . $constraint->name) : '', + $ctype, + '(' . join(', ', $constraint->fields) . ')', + $expr ? $expr : $ref, + $update, $delete); + + if ($constraint->type eq FOREIGN_KEY) { + my $table_name = $constraint->table->name; + $out = "ALTER TABLE $table_name ADD $out;"; + push @fks, $out; + } else { + push @con_defs, $out; + } + + return \@con_defs, \@fks; } -sub create_view -{ - my ($view) = @_; +sub create_view { + my ($view) = @_; - my $out = sprintf("CREATE VIEW %s AS\n%s;", - $view->name, - $view->sql); + my $out = sprintf("CREATE VIEW %s AS\n%s;", $view->name, $view->sql); - return $out; + return $out; } -sub create_trigger -{ - my ($trigger) = @_; -# create: CREATE TRIGGER trigger_name before type /ON/i table_name reference_b(?) /FOR EACH ROW/i 'MODE DB2SQL' triggered_action +sub create_trigger { + my ($trigger) = @_; - my $db_events = join ', ', $trigger->database_events; - my $out = sprintf('CREATE TRIGGER %s %s %s ON %s %s %s MODE DB2SQL %s', - $trigger->name, - $trigger->perform_action_when || 'AFTER', - $db_events =~ /update_on/i ? - ('UPDATE OF '. join(', ', $trigger->fields)) : - $db_events || 'UPDATE', - $trigger->table->name, - $trigger->extra->{reference} || 'REFERENCING OLD AS oldrow NEW AS newrow', - $trigger->extra->{granularity} || 'FOR EACH ROW', - $trigger->action ); +# create: CREATE TRIGGER trigger_name before type /ON/i table_name reference_b(?) /FOR EACH ROW/i 'MODE DB2SQL' triggered_action - return $out; + my $db_events = join ', ', $trigger->database_events; + my $out = sprintf( + 'CREATE TRIGGER %s %s %s ON %s %s %s MODE DB2SQL %s', + $trigger->name, + $trigger->perform_action_when || 'AFTER', + $db_events =~ /update_on/i + ? ('UPDATE OF ' . join(', ', $trigger->fields)) + : $db_events || 'UPDATE', + $trigger->table->name, + $trigger->extra->{reference} || 'REFERENCING OLD AS oldrow NEW AS newrow', + $trigger->extra->{granularity} || 'FOR EACH ROW', + $trigger->action + ); + + return $out; } -sub alter_field -{ - my ($from_field, $to_field) = @_; +sub alter_field { + my ($from_field, $to_field) = @_; - my $data_type = uc($dt_translate{lc($to_field->data_type)} || $to_field->data_type); + my $data_type = uc($dt_translate{ lc($to_field->data_type) } || $to_field->data_type); - my $size = $to_field->size(); - $data_type .= $data_type =~ /CHAR/i ? "(${size})" : ''; + my $size = $to_field->size(); + $data_type .= $data_type =~ /CHAR/i ? "(${size})" : ''; - # DB2 will only allow changing of varchar/vargraphic datatypes - # to extend their lengths. Or changing of text types to other - # texttypes, and numeric types to larger numeric types. (v8) - # We can also drop/add keys, checks and constraints, but not - # columns !? + # DB2 will only allow changing of varchar/vargraphic datatypes + # to extend their lengths. Or changing of text types to other + # texttypes, and numeric types to larger numeric types. (v8) + # We can also drop/add keys, checks and constraints, but not + # columns !? - my $out = sprintf('ALTER TABLE %s ALTER %s SET DATATYPE %s', - $to_field->table->name, - $to_field->name, - $data_type); + my $out = sprintf('ALTER TABLE %s ALTER %s SET DATATYPE %s', $to_field->table->name, $to_field->name, $data_type); } -sub add_field -{ - my ($new_field) = @_; +sub add_field { + my ($new_field) = @_; - my $out = sprintf('ALTER TABLE %s ADD COLUMN %s', - $new_field->table->name, - create_field($new_field)); + my $out = sprintf('ALTER TABLE %s ADD COLUMN %s', $new_field->table->name, create_field($new_field)); - return $out; + return $out; } -sub drop_field -{ - my ($field) = @_; +sub drop_field { + my ($field) = @_; - return ''; + return ''; } 1; diff --git a/lib/SQL/Translator/Producer/DiaUml.pm b/lib/SQL/Translator/Producer/DiaUml.pm index afc8fff7d..99669edf9 100644 --- a/lib/SQL/Translator/Producer/DiaUml.pm +++ b/lib/SQL/Translator/Producer/DiaUml.pm @@ -33,22 +33,23 @@ automatically arrange them horizontally or vertically. use strict; use warnings; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use File::ShareDir qw/dist_dir/; use SQL::Translator::Utils 'debug'; use base qw/SQL::Translator::Producer::TT::Base/; + # Convert produce call into a method call on our class -sub produce { return __PACKAGE__->new( translator => shift )->run; }; +sub produce { return __PACKAGE__->new(translator => shift)->run; } sub tt_config { - ( INCLUDE_PATH => File::Spec->catdir (dist_dir('SQL-Translator'), 'DiaUml') ); + (INCLUDE_PATH => File::Spec->catdir(dist_dir('SQL-Translator'), 'DiaUml')); } -sub tt_schema { 'schema.tt2' } +sub tt_schema {'schema.tt2'} 1; diff --git a/lib/SQL/Translator/Producer/Diagram.pm b/lib/SQL/Translator/Producer/Diagram.pm index b80b2d946..1989528e2 100644 --- a/lib/SQL/Translator/Producer/Diagram.pm +++ b/lib/SQL/Translator/Producer/Diagram.pm @@ -48,516 +48,447 @@ use SQL::Translator::Utils qw(debug); our $DEBUG; our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use constant VALID_FONT_SIZE => { - small => 1, - medium => 1, - large => 1, - huge => 1, + small => 1, + medium => 1, + large => 1, + huge => 1, }; use constant VALID_IMAGE_TYPE => { - png => 1, - jpeg => 1, + png => 1, + jpeg => 1, }; sub produce { - my $t = shift; - my $schema = $t->schema; - my $args = $t->producer_args; - local $DEBUG = $t->debug; - debug("Schema =\n", Dumper( $schema )) if $DEBUG; - debug("Producer args =\n", Dumper( $args )) if $DEBUG; - - my $out_file = $args->{'out_file'} || ''; - my $output_type = $args->{'output_type'} || 'png'; - my $title = $args->{'title'} || $t->filename; - my $font_size = $args->{'font_size'} || 'medium'; - my $imap_file = $args->{'imap_file'} || ''; - my $imap_url = $args->{'imap_url'} || ''; - my $gutter = $args->{'gutter'} || 30; # distance b/w columns - my $num_columns = $args->{'num_columns'} || $args->{'no_columns'} || ''; - my $no_lines = $args->{'no_lines'}; - my $add_color = $args->{'add_color'}; - my $show_fk_only = $args->{'show_fk_only'}; - my $join_pk_only = $args->{'join_pk_only'}; - my $natural_join = $args->{'natural_join'} || $join_pk_only; - my %skip_field = map { $_, 1 } ( - ref $args->{'skip_fields'} eq 'ARRAY' - ? @{ $args->{'skip_fields'} } - : split ( /\s*,\s*/, $args->{'skip_fields'}||'' ) + my $t = shift; + my $schema = $t->schema; + my $args = $t->producer_args; + local $DEBUG = $t->debug; + debug("Schema =\n", Dumper($schema)) if $DEBUG; + debug("Producer args =\n", Dumper($args)) if $DEBUG; + + my $out_file = $args->{'out_file'} || ''; + my $output_type = $args->{'output_type'} || 'png'; + my $title = $args->{'title'} || $t->filename; + my $font_size = $args->{'font_size'} || 'medium'; + my $imap_file = $args->{'imap_file'} || ''; + my $imap_url = $args->{'imap_url'} || ''; + my $gutter = $args->{'gutter'} || 30; # distance b/w columns + my $num_columns = $args->{'num_columns'} || $args->{'no_columns'} || ''; + my $no_lines = $args->{'no_lines'}; + my $add_color = $args->{'add_color'}; + my $show_fk_only = $args->{'show_fk_only'}; + my $join_pk_only = $args->{'join_pk_only'}; + my $natural_join = $args->{'natural_join'} || $join_pk_only; + my %skip_field = map { $_, 1 } ( + ref $args->{'skip_fields'} eq 'ARRAY' + ? @{ $args->{'skip_fields'} } + : split(/\s*,\s*/, $args->{'skip_fields'} || '') + ); + + my %skip_table = map { $_, 1 } ( + ref $args->{'skip_tables'} eq 'ARRAY' + ? @{ $args->{'skip_tables'} } + : split(/\s*,\s*/, $args->{'skip_tables'} || '') + ); + + my @skip_tables_like = map {qr/$_/} ( + ref $args->{'skip_tables_like'} eq 'ARRAY' + ? @{ $args->{'skip_tables_like'} } + : split(/\s*,\s*/, $args->{'skip_tables_like'} || '') + ); + + my @table_names; + if ($natural_join) { + $schema->make_natural_joins( + join_pk_only => $join_pk_only, + skip_fields => $args->{'skip_fields'}, ); - my %skip_table = map { $_, 1 } ( - ref $args->{'skip_tables'} eq 'ARRAY' - ? @{ $args->{'skip_tables'} } - : split ( /\s*,\s*/, $args->{'skip_tables'}||'' ) - ); + my $g = $schema->as_graph_pm; + my $d = Graph::Traversal::DFS->new($g, next_alphabetic => 1); + $d->preorder; + + @table_names = $d->dfs; + } else { + @table_names = map { $_->name } $schema->get_tables; + } + + die "Invalid image type '$output_type'" + unless VALID_IMAGE_TYPE->{$output_type}; + die "Invalid font size '$font_size'" + unless VALID_FONT_SIZE->{$font_size}; + + # + # Layout the image. + # + my $font + = $font_size eq 'small' ? gdTinyFont + : $font_size eq 'medium' ? gdSmallFont + : $font_size eq 'large' ? gdLargeFont + : gdGiantFont; + + my $num_tables = scalar @table_names; + $num_columns = 0 unless $num_columns =~ /^\d+$/; + $num_columns ||= sprintf("%.0f", sqrt($num_tables) + .5); + $num_columns ||= .5; + my $no_per_col = sprintf("%.0f", $num_tables / $num_columns + .5); + + my @shapes; + my ($max_x, $max_y); # the furthest x and y used + my $orig_y = 40; # used to reset y for each column + my ($x, $y) = (30, $orig_y); # where to start + my $cur_col = 1; # the current column + my $no_this_col = 0; # number of tables in current column + my $this_col_x = $x; # current column's x + my %nj_registry; # for locations of fields for natural joins + my @fk_registry; # for locations of fields for foreign keys + my %table_x; # for max x of each table + my $field_no; # counter to give distinct no. to each field + my %coords; # holds fields coordinates + my @imap_coords; # for making clickable image map + my %legend; + +TABLE: + for my $table_name (@table_names) { + my $table = $schema->get_table($table_name); + + if (@skip_tables_like or keys %skip_table) { + next TABLE if $skip_table{$table_name}; + for my $regex (@skip_tables_like) { + next TABLE if $table_name =~ $regex; + } + } - my @skip_tables_like = map { qr/$_/ } ( - ref $args->{'skip_tables_like'} eq 'ARRAY' - ? @{ $args->{'skip_tables_like'} } - : split ( /\s*,\s*/, $args->{'skip_tables_like'}||'' ) - ); + my $top = $y; + push @shapes, [ 'string', $font, $this_col_x, $y, $table_name, 'black' ]; + $y += $font->height + 2; + my $below_table_name = $y; + $y += 2; + my $this_max_x = $this_col_x + ($font->width * length($table_name)); - my @table_names; - if ( $natural_join ) { - $schema->make_natural_joins( - join_pk_only => $join_pk_only, - skip_fields => $args->{'skip_fields'}, - ); + debug("Processing table '$table_name'"); - my $g = $schema->as_graph_pm; - my $d = Graph::Traversal::DFS->new( $g, next_alphabetic => 1 ); - $d->preorder; + my @fields = $table->get_fields; + debug("Fields = ", join(', ', map { $_->name } @fields)) if $DEBUG; - @table_names = $d->dfs; - } - else { - @table_names = map { $_->name } $schema->get_tables; - } + my (@fld_desc, $max_name, $max_desc); + for my $f (@fields) { + my $name = $f->name or next; + my $is_pk = $f->is_primary_key; - die "Invalid image type '$output_type'" - unless VALID_IMAGE_TYPE->{ $output_type }; - die "Invalid font size '$font_size'" - unless VALID_FONT_SIZE->{ $font_size }; - - # - # Layout the image. - # - my $font - = $font_size eq 'small' ? gdTinyFont - : $font_size eq 'medium' ? gdSmallFont - : $font_size eq 'large' ? gdLargeFont - : gdGiantFont; - - my $num_tables = scalar @table_names; - $num_columns = 0 unless $num_columns =~ /^\d+$/; - $num_columns ||= sprintf( "%.0f", sqrt( $num_tables ) + .5 ); - $num_columns ||= .5; - my $no_per_col = sprintf( "%.0f", $num_tables/$num_columns + .5 ); - - my @shapes; - my ( $max_x, $max_y ); # the furthest x and y used - my $orig_y = 40; # used to reset y for each column - my ( $x, $y ) = (30,$orig_y); # where to start - my $cur_col = 1; # the current column - my $no_this_col = 0; # number of tables in current column - my $this_col_x = $x; # current column's x - my %nj_registry; # for locations of fields for natural joins - my @fk_registry; # for locations of fields for foreign keys - my %table_x; # for max x of each table - my $field_no; # counter to give distinct no. to each field - my %coords; # holds fields coordinates - my @imap_coords; # for making clickable image map - my %legend; - - TABLE: - for my $table_name ( @table_names ) { - my $table = $schema->get_table( $table_name ); - - if ( @skip_tables_like or keys %skip_table ) { - next TABLE if $skip_table{ $table_name }; - for my $regex ( @skip_tables_like ) { - next TABLE if $table_name =~ $regex; - } - } - - my $top = $y; - push @shapes, - [ 'string', $font, $this_col_x, $y, $table_name, 'black' ]; - $y += $font->height + 2; - my $below_table_name = $y; - $y += 2; - my $this_max_x = - $this_col_x + ($font->width * length($table_name)); + my @attr; - debug("Processing table '$table_name'"); + # + # Decide if we should skip this field. + # + if ($show_fk_only) { + next unless $is_pk || $f->is_foreign_key; + } - my @fields = $table->get_fields; - debug("Fields = ", join(', ', map { $_->name } @fields)) if $DEBUG; + if ($is_pk) { + push @attr, 'PK'; + $legend{'Primary key'} = '[PK]'; + } - my ( @fld_desc, $max_name, $max_desc ); - for my $f ( @fields ) { - my $name = $f->name or next; - my $is_pk = $f->is_primary_key; + if ($f->is_unique) { + push @attr, 'U'; + $legend{'Unique constraint'} = '[U]'; + } - my @attr; + if ($f->is_foreign_key) { + push @attr, 'FK'; + $legend{'Foreign Key'} = '[FK]'; + } - # - # Decide if we should skip this field. - # - if ( $show_fk_only ) { - next unless $is_pk || $f->is_foreign_key; - } + my $attr = ''; + if (@attr) { + $attr .= '[' . join(', ', @attr) . ']'; + } - if ( $is_pk ) { - push @attr, 'PK'; - $legend{'Primary key'} = '[PK]'; - } + my $desc = $f->data_type; + $desc .= '(' . $f->size . ')' + if $f->size + && $f->data_type =~ /^(VAR)?CHAR2?$/i; - if ( $f->is_unique ) { - push @attr, 'U'; - $legend{'Unique constraint'} = '[U]'; - } + my $nlen = length $name; + my $dlen = length $desc; + $max_name = $nlen if $nlen > ($max_name || 0); + $max_desc = $dlen if $dlen > ($max_desc || 0); + push @fld_desc, [ $name, $desc, $f->{'name'}, $is_pk, $attr ]; + } - if ( $f->is_foreign_key ) { - push @attr, 'FK'; - $legend{'Foreign Key'} = '[FK]'; - } + $max_name += 2; + $max_desc += 2; + for my $fld_desc (@fld_desc) { + my ($name, $desc, $orig_name, $is_pk, $attr) = @$fld_desc; + my $diff1 = $max_name - length $name; + my $diff2 = $max_desc - length $desc; + $name .= ' ' x $diff1; + $desc .= ' ' x $diff2; + $desc = $name . $desc . $attr; + + push @shapes, [ 'string', $font, $this_col_x, $y, $desc, 'black' ]; + $y += $font->height + 2; + my $length = $this_col_x + ($font->width * length($desc)); + $this_max_x = $length if $length > $this_max_x; + + my $constraints = $table->{'fields'}{$orig_name}{'constraints'}; + + if ($natural_join && !$skip_field{$orig_name}) { + push @{ $nj_registry{$orig_name} }, $table_name; + } - my $attr = ''; - if ( @attr ) { - $attr .= '[' . join(', ', @attr) . ']'; - } + my $y_link = $y - $font->height / 2; + $coords{$table_name}{$orig_name}{'coords'} = { + left => [ $this_col_x - 6, $y_link ], + right => [ $length + 2, $y_link ], + table => $table_name, + field_no => ++$field_no, + is_pk => $is_pk, + fld_name => $orig_name, + }; + + push @imap_coords, [ $imap_url . "#$table_name-$orig_name", $this_col_x, $y - $font->height, $length, $y_link, ]; + } - my $desc = $f->data_type; - $desc .= '('.$f->size.')' if $f->size && - $f->data_type =~ /^(VAR)?CHAR2?$/i; + unless ($natural_join) { + for my $c ($table->get_constraints) { + next unless $c->type eq FOREIGN_KEY; + my $fk_table = $c->reference_table or next; - my $nlen = length $name; - my $dlen = length $desc; - $max_name = $nlen if $nlen > ($max_name||0); - $max_desc = $dlen if $dlen > ($max_desc||0); - push @fld_desc, [ $name, $desc, $f->{'name'}, $is_pk, $attr ]; + for my $field_name ($c->fields) { + for my $fk_field ($c->reference_fields) { + next unless defined $schema->get_table($fk_table); + push @fk_registry, [ [ $fk_table, $fk_field ], [ $table_name, $field_name ], ]; + } } + } + } - $max_name += 2; - $max_desc += 2; - for my $fld_desc ( @fld_desc ) { - my ( $name, $desc, $orig_name, $is_pk, $attr ) = @$fld_desc; - my $diff1 = $max_name - length $name; - my $diff2 = $max_desc - length $desc; - $name .= ' ' x $diff1; - $desc .= ' ' x $diff2; - $desc = $name . $desc . $attr; - - push @shapes, [ 'string', $font, $this_col_x, $y, $desc, 'black' ]; - $y += $font->height + 2; - my $length = $this_col_x + ( $font->width * length( $desc ) ); - $this_max_x = $length if $length > $this_max_x; - - my $constraints = $table->{'fields'}{ $orig_name }{'constraints'}; - - if ( $natural_join && !$skip_field{ $orig_name } ) { - push @{ $nj_registry{ $orig_name } }, $table_name; - } + $this_max_x += 5; + $table_x{$table_name} = $this_max_x + 5; + push @shapes, [ 'line', $this_col_x - 5, $below_table_name, $this_max_x, $below_table_name, 'black' ]; + my @bounds = ($this_col_x - 5, $top - 5, $this_max_x, $y + 5); + if ($add_color) { + unshift @shapes, [ 'filledRectangle', $bounds[0], $bounds[1], $this_max_x, $below_table_name, 'khaki' ]; + unshift @shapes, [ 'filledRectangle', @bounds, 'white' ]; + } - my $y_link = $y - $font->height/2; - $coords{ $table_name }{ $orig_name }{'coords'} = { - left => [ $this_col_x - 6, $y_link ], - right => [ $length + 2 , $y_link ], - table => $table_name, - field_no => ++$field_no, - is_pk => $is_pk, - fld_name => $orig_name, - }; - - push @imap_coords, [ - $imap_url."#$table_name-$orig_name", - $this_col_x, $y - $font->height, $length, $y_link, - ]; - } + push @imap_coords, [ $imap_url . "#$table_name", $bounds[0], $bounds[1], $this_max_x, $below_table_name, ]; - unless ( $natural_join ) { - for my $c ( $table->get_constraints ) { - next unless $c->type eq FOREIGN_KEY; - my $fk_table = $c->reference_table or next; - - for my $field_name ( $c->fields ) { - for my $fk_field ( $c->reference_fields ) { - next unless defined $schema->get_table( $fk_table ); - push @fk_registry, [ - [ $fk_table , $fk_field ], - [ $table_name, $field_name ], - ]; - } - } - } - } + push @shapes, [ 'rectangle', @bounds, 'black' ]; + $max_x = $this_max_x if $this_max_x > ($max_x || 0); + $y += 25; - $this_max_x += 5; - $table_x{ $table_name } = $this_max_x + 5; - push @shapes, [ 'line', $this_col_x - 5, $below_table_name, - $this_max_x, $below_table_name, 'black' ]; - my @bounds = ( $this_col_x - 5, $top - 5, $this_max_x, $y + 5 ); - if ( $add_color ) { - unshift @shapes, [ - 'filledRectangle', - $bounds[0], $bounds[1], - $this_max_x, $below_table_name, - 'khaki' - ]; - unshift @shapes, [ 'filledRectangle', @bounds, 'white' ]; + if (++$no_this_col == $no_per_col) { # if we've filled up this column + $cur_col++; # up the column number + $no_this_col = 0; # reset the number of tables + $max_x += $gutter; # push the x over for next column + $this_col_x = $max_x; # remember the max x for this col + $max_y = $y if $y > ($max_y || 0); # note the max y + $y = $orig_y; # reset the y for next column + } + } + + # + # Connect the lines. + # + my %horz_taken; + my %done; + unless ($no_lines) { + my @position_bunches; + + if ($natural_join) { + for my $field_name (keys %nj_registry) { + my @positions; + my @table_names = @{ $nj_registry{$field_name} || [] } + or next; + next if scalar @table_names == 1; + + for my $table_name (@table_names) { + push @positions, $coords{$table_name}{$field_name}{'coords'}; } - push @imap_coords, [ - $imap_url."#$table_name", - $bounds[0], $bounds[1], $this_max_x, $below_table_name, - ]; - - push @shapes, [ 'rectangle', @bounds, 'black' ]; - $max_x = $this_max_x if $this_max_x > ($max_x||0); - $y += 25; - - if ( ++$no_this_col == $no_per_col ) {# if we've filled up this column - $cur_col++; # up the column number - $no_this_col = 0; # reset the number of tables - $max_x += $gutter; # push the x over for next column - $this_col_x = $max_x; # remember the max x for this col - $max_y = $y if $y > ($max_y||0); # note the max y - $y = $orig_y; # reset the y for next column - } + push @position_bunches, [@positions]; + } + } else { + for my $pair (@fk_registry) { + push @position_bunches, + [ + $coords{ $pair->[0][0] }{ $pair->[0][1] }{'coords'}, + $coords{ $pair->[1][0] }{ $pair->[1][1] }{'coords'}, + ]; + } } - # - # Connect the lines. - # - my %horz_taken; - my %done; - unless ( $no_lines ) { - my @position_bunches; - - if ( $natural_join ) { - for my $field_name ( keys %nj_registry ) { - my @positions; - my @table_names = - @{ $nj_registry{ $field_name } || [] } or next; - next if scalar @table_names == 1; - - for my $table_name ( @table_names ) { - push @positions, - $coords{ $table_name }{ $field_name }{'coords'}; - } - - push @position_bunches, [ @positions ]; + my $is_directed = $natural_join ? 0 : 1; + + for my $bunch (@position_bunches) { + my @positions = @$bunch; + + for my $i (0 .. $#positions) { + my $pos1 = $positions[$i]; + my ($ax, $ay) = @{ $pos1->{'left'} || [] } or next; + my ($bx, $by) = @{ $pos1->{'right'} || [] } or next; + my $table1 = $pos1->{'table'}; + my $fno1 = $pos1->{'field_no'}; + my $is_pk = $pos1->{'is_pk'}; + next if $join_pk_only and !$is_pk; + + for my $j (0 .. $#positions) { + my $pos2 = $positions[$j]; + my ($cx, $cy) = @{ $pos2->{'left'} || [] } or next; + my ($dx, $dy) = @{ $pos2->{'right'} || [] } or next; + my $table2 = $pos2->{'table'}; + my $fno2 = $pos2->{'field_no'}; + next if $table1 eq $table2; + next if $done{$fno1}{$fno2}; + next if $fno1 == $fno2; + + my @distances = (); + push @distances, [ abs($ax - $cx) + abs($ay - $cy), [ $ax, $ay, $cx, $cy ], [ 'left', 'left' ] ]; + push @distances, [ abs($ax - $dx) + abs($ay - $dy), [ $ax, $ay, $dx, $dy ], [ 'left', 'right' ], ]; + push @distances, [ abs($bx - $cx) + abs($by - $cy), [ $bx, $by, $cx, $cy ], [ 'right', 'left' ], ]; + push @distances, [ abs($bx - $dx) + abs($by - $dy), [ $bx, $by, $dx, $dy ], [ 'right', 'right' ], ]; + @distances = sort { $a->[0] <=> $b->[0] } @distances; + my $shortest = $distances[0]; + my ($x1, $y1, $x2, $y2) = @{ $shortest->[1] }; + my ($side1, $side2) = @{ $shortest->[2] }; + my ($start, $end); + my $offset = 9; + my $col1_right = $table_x{$table1}; + my $col2_right = $table_x{$table2}; + + my $diff = 0; + if ($x1 == $x2) { + while ($horz_taken{ $x1 + $diff }) { + $diff = $side1 eq 'left' ? $diff - 2 : $diff + 2; } - } - else { - for my $pair ( @fk_registry ) { - push @position_bunches, [ - $coords{$pair->[0][0]}{ $pair->[0][1] }{'coords'}, - $coords{$pair->[1][0]}{ $pair->[1][1] }{'coords'}, - ]; - } - } - - my $is_directed = $natural_join ? 0 : 1; - - for my $bunch ( @position_bunches ) { - my @positions = @$bunch; - - for my $i ( 0 .. $#positions ) { - my $pos1 = $positions[ $i ]; - my ( $ax, $ay ) = @{ $pos1->{'left'} || [] } or next; - my ( $bx, $by ) = @{ $pos1->{'right'} || [] } or next; - my $table1 = $pos1->{'table'}; - my $fno1 = $pos1->{'field_no'}; - my $is_pk = $pos1->{'is_pk'}; - next if $join_pk_only and !$is_pk; - - for my $j ( 0 .. $#positions ) { - my $pos2 = $positions[ $j ]; - my ( $cx, $cy ) = @{ $pos2->{'left'} || [] } or next; - my ( $dx, $dy ) = @{ $pos2->{'right'} || [] } or next; - my $table2 = $pos2->{'table'}; - my $fno2 = $pos2->{'field_no'}; - next if $table1 eq $table2; - next if $done{ $fno1 }{ $fno2 }; - next if $fno1 == $fno2; - - my @distances = (); - push @distances, [ - abs ( $ax - $cx ) + abs ( $ay - $cy ), - [ $ax, $ay, $cx, $cy ], - [ 'left', 'left' ] - ]; - push @distances, [ - abs ( $ax - $dx ) + abs ( $ay - $dy ), - [ $ax, $ay, $dx, $dy ], - [ 'left', 'right' ], - ]; - push @distances, [ - abs ( $bx - $cx ) + abs ( $by - $cy ), - [ $bx, $by, $cx, $cy ], - [ 'right', 'left' ], - ]; - push @distances, [ - abs ( $bx - $dx ) + abs ( $by - $dy ), - [ $bx, $by, $dx, $dy ], - [ 'right', 'right' ], - ]; - @distances = sort { $a->[0] <=> $b->[0] } @distances; - my $shortest = $distances[0]; - my ( $x1, $y1, $x2, $y2 ) = @{ $shortest->[1] }; - my ( $side1, $side2 ) = @{ $shortest->[2] }; - my ( $start, $end ); - my $offset = 9; - my $col1_right = $table_x{ $table1 }; - my $col2_right = $table_x{ $table2 }; - - my $diff = 0; - if ( $x1 == $x2 ) { - while ( $horz_taken{ $x1 + $diff } ) { - $diff = $side1 eq 'left' ? $diff - 2 : $diff + 2; - } - $horz_taken{ $x1 + $diff } = 1; - } - - if ( $side1 eq 'left' ) { - $start = $x1 - $offset + $diff; - } - else { - $start = $col1_right + $diff; - } - - if ( $side2 eq 'left' ) { - $end = $x2 - $offset + $diff; - } - else { - $end = $col2_right + $diff; - } - - push @shapes, - [ 'line', $x1, $y1, $start, $y1, 'cadetblue' ]; - push @shapes, - [ 'line', $start, $y1, $end, $y2, 'cadetblue' ]; - push @shapes, - [ 'line', $end, $y2, $x2, $y2, 'cadetblue' ]; - - if ( $is_directed ) { - if ( - $side1 eq 'right' && $side2 eq 'left' - || - $side1 eq 'left' && $side2 eq 'left' - ) { - push @shapes, [ - 'line', $x2 - 3, $y2 - 3, $x2, $y2, 'cadetblue' - ]; - push @shapes, [ - 'line', $x2 - 3, $y2 + 3, $x2, $y2, 'cadetblue' - ]; - push @shapes, [ - 'line', $x2 - 3, $y2 - 3, $x2 - 3, $y2 +3, - 'cadetblue' - ]; - } - else { - push @shapes, [ - 'line', $x2 + 3, $y2 - 3, $x2, $y2, 'cadetblue' - ]; - push @shapes, [ - 'line', $x2 + 3, $y2 + 3, $x2, $y2, 'cadetblue' - ]; - push @shapes, [ - 'line', $x2 + 3, $y2 - 3, $x2 + 3, $y2 +3, - 'cadetblue' - ]; - } - } - - $done{ $fno1 }{ $fno2 } = 1; - $done{ $fno2 }{ $fno1 } = 1; - } + $horz_taken{ $x1 + $diff } = 1; + } + + if ($side1 eq 'left') { + $start = $x1 - $offset + $diff; + } else { + $start = $col1_right + $diff; + } + + if ($side2 eq 'left') { + $end = $x2 - $offset + $diff; + } else { + $end = $col2_right + $diff; + } + + push @shapes, [ 'line', $x1, $y1, $start, $y1, 'cadetblue' ]; + push @shapes, [ 'line', $start, $y1, $end, $y2, 'cadetblue' ]; + push @shapes, [ 'line', $end, $y2, $x2, $y2, 'cadetblue' ]; + + if ($is_directed) { + if ( $side1 eq 'right' && $side2 eq 'left' + || $side1 eq 'left' && $side2 eq 'left') { + push @shapes, [ 'line', $x2 - 3, $y2 - 3, $x2, $y2, 'cadetblue' ]; + push @shapes, [ 'line', $x2 - 3, $y2 + 3, $x2, $y2, 'cadetblue' ]; + push @shapes, [ 'line', $x2 - 3, $y2 - 3, $x2 - 3, $y2 + 3, 'cadetblue' ]; + } else { + push @shapes, [ 'line', $x2 + 3, $y2 - 3, $x2, $y2, 'cadetblue' ]; + push @shapes, [ 'line', $x2 + 3, $y2 + 3, $x2, $y2, 'cadetblue' ]; + push @shapes, [ 'line', $x2 + 3, $y2 - 3, $x2 + 3, $y2 + 3, 'cadetblue' ]; } - } - } - - # - # Add the title, legend and signature. - # - my $large_font = gdLargeFont; - my $title_len = $large_font->width * length $title; - push @shapes, [ - 'string', $large_font, $max_x/2 - $title_len/2, 10, $title, 'black' - ]; - - if ( %legend ) { - $max_y += 5; - push @shapes, [ - 'string', $font, $x, $max_y - $font->height - 4, 'Legend', 'black' - ]; - $max_y += $font->height + 4; - - my $longest; - for my $len ( map { length $_ } values %legend ) { - $longest = $len if $len > ($longest||0); - } - $longest += 2; - - while ( my ( $key, $shape ) = each %legend ) { - my $space = $longest - length $shape; - push @shapes, [ - 'string', $font, $x, $max_y - $font->height - 4, - join( '', $shape, ' ' x $space, $key ), 'black' - ]; + } - $max_y += $font->height + 4; + $done{$fno1}{$fno2} = 1; + $done{$fno2}{$fno1} = 1; } + } } - - my $sig = 'Created by SQL::Translator ' . $t->version; - my $sig_len = $font->width * length $sig; - push @shapes, [ - 'string', $font, $max_x - $sig_len, $max_y - $font->height - 4, - $sig, 'black' - ]; - - # - # Render the image. - # - my $gd = GD::Image->new( $max_x + 30, $max_y ); - unless ( $gd->can( $output_type ) ) { - die "GD can't create images of type '$output_type'\n"; - } - my %colors = map { $_->[0], $gd->colorAllocate( @{$_->[1]} ) } ( - [ white => [ 255, 255, 255 ] ], - [ beige => [ 245, 245, 220 ] ], - [ black => [ 0, 0, 0 ] ], - [ lightblue => [ 173, 216, 230 ] ], - [ cadetblue => [ 95, 158, 160 ] ], - [ lightgoldenrodyellow => [ 250, 250, 210 ] ], - [ khaki => [ 240, 230, 140 ] ], - [ red => [ 255, 0, 0 ] ], - ); - $gd->interlaced( 'true' ); - my $background_color = $add_color ? 'lightgoldenrodyellow' : 'white'; - $gd->fill( 0, 0, $colors{ $background_color } ); - for my $shape ( @shapes ) { - my $method = shift @$shape; - my $color = pop @$shape; - $gd->$method( @$shape, $colors{ $color } ); + } + + # + # Add the title, legend and signature. + # + my $large_font = gdLargeFont; + my $title_len = $large_font->width * length $title; + push @shapes, [ 'string', $large_font, $max_x / 2 - $title_len / 2, 10, $title, 'black' ]; + + if (%legend) { + $max_y += 5; + push @shapes, [ 'string', $font, $x, $max_y - $font->height - 4, 'Legend', 'black' ]; + $max_y += $font->height + 4; + + my $longest; + for my $len (map { length $_ } values %legend) { + $longest = $len if $len > ($longest || 0); } + $longest += 2; - # - # Make image map. - # - debug("imap file = '$imap_file'"); - if ( $imap_file && @imap_coords ) { - open my $fh, '>', $imap_file or die "Can't write '$imap_file': $!\n"; - print $fh qq[\n]. - qq[\n]; - for my $rec ( @imap_coords ) { - my $href = shift @$rec; - print $fh q[\n]; - } - print $fh qq[]; - close $fh; - } + while (my ($key, $shape) = each %legend) { + my $space = $longest - length $shape; + push @shapes, [ 'string', $font, $x, $max_y - $font->height - 4, join('', $shape, ' ' x $space, $key), 'black' ]; - # - # Print the image. - # - if ( $out_file ) { - open my $fh, '>', $out_file or die "Can't write '$out_file': $!\n"; - binmode $fh; - print $fh $gd->$output_type; - close $fh; + $max_y += $font->height + 4; } - else { - return $gd->$output_type; + } + + my $sig = 'Created by SQL::Translator ' . $t->version; + my $sig_len = $font->width * length $sig; + push @shapes, [ 'string', $font, $max_x - $sig_len, $max_y - $font->height - 4, $sig, 'black' ]; + + # + # Render the image. + # + my $gd = GD::Image->new($max_x + 30, $max_y); + unless ($gd->can($output_type)) { + die "GD can't create images of type '$output_type'\n"; + } + my %colors = map { $_->[0], $gd->colorAllocate(@{ $_->[1] }) } ( + [ white => [ 255, 255, 255 ] ], + [ beige => [ 245, 245, 220 ] ], + [ black => [ 0, 0, 0 ] ], + [ lightblue => [ 173, 216, 230 ] ], + [ cadetblue => [ 95, 158, 160 ] ], + [ lightgoldenrodyellow => [ 250, 250, 210 ] ], + [ khaki => [ 240, 230, 140 ] ], + [ red => [ 255, 0, 0 ] ], + ); + $gd->interlaced('true'); + my $background_color = $add_color ? 'lightgoldenrodyellow' : 'white'; + $gd->fill(0, 0, $colors{$background_color}); + for my $shape (@shapes) { + my $method = shift @$shape; + my $color = pop @$shape; + $gd->$method(@$shape, $colors{$color}); + } + + # + # Make image map. + # + debug("imap file = '$imap_file'"); + if ($imap_file && @imap_coords) { + open my $fh, '>', $imap_file or die "Can't write '$imap_file': $!\n"; + print $fh qq[\n] . qq[\n]; + for my $rec (@imap_coords) { + my $href = shift @$rec; + print $fh q[\n]; } + print $fh qq[]; + close $fh; + } + + # + # Print the image. + # + if ($out_file) { + open my $fh, '>', $out_file or die "Can't write '$out_file': $!\n"; + binmode $fh; + print $fh $gd->$output_type; + close $fh; + } else { + return $gd->$output_type; + } } 1; diff --git a/lib/SQL/Translator/Producer/Dumper.pm b/lib/SQL/Translator/Producer/Dumper.pm index 7bd00053a..606ea8105 100644 --- a/lib/SQL/Translator/Producer/Dumper.pm +++ b/lib/SQL/Translator/Producer/Dumper.pm @@ -44,70 +44,68 @@ use Data::Dumper; our $VERSION = '1.64'; sub produce { - my $t = shift; - my $args = $t->producer_args; - my $schema = $t->schema; - my $add_truncate = $args->{'add_truncate'} || 0; - my $skip = $args->{'skip'} || ''; - my $skiplike = $args->{'skiplike'} || ''; - my $db_user = $args->{'db_user'} || 'db_user'; - my $db_pass = $args->{'db_password'} || 'db_pass'; - my $parser_name = $t->parser_type; - my %skip = map { $_, 1 } map { s/^\s+|\s+$//; $_ } - split (/,/, $skip); - my $sqlt_version = $t->version; - - if ( $parser_name =~ /Parser::(\w+)$/ ) { - $parser_name = $1 - } - - my %type_to_dbd = ( - MySQL => 'mysql', - Oracle => 'Oracle', - PostgreSQL => 'Pg', - SQLite => 'SQLite', - Sybase => 'Sybase', - ); - my $dbd = $type_to_dbd{ $parser_name } || 'DBD'; - my $dsn = $args->{'dsn'} || "dbi:$dbd:"; - if ( $dbd eq 'Pg' && ! $args->{'dsn'} ) { - $dsn .= 'dbname=dbname;host=hostname'; - } - elsif ( $dbd eq 'Oracle' && ! $args->{'dsn'} ) { - $db_user = "$db_user/$db_pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)" . - "(HOST=hostname)(PORT=1521))(CONNECT_DATA=(SID=sid)))"; - $db_pass = ''; - } - elsif ( $dbd eq 'mysql' && ! $args->{'dsn'} ) { - $dsn .= 'dbname'; - } - - my $template = Template->new; - my $template_text = template(); - my $out; - $template->process( - \$template_text, - { - translator => $t, - schema => $schema, - db_user => $db_user, - db_pass => $db_pass, - dsn => $dsn, - perl => $Config{'startperl'}, - skip => \%skip, - skiplike => $skiplike, - }, - \$out - ) or die $template->error; + my $t = shift; + my $args = $t->producer_args; + my $schema = $t->schema; + my $add_truncate = $args->{'add_truncate'} || 0; + my $skip = $args->{'skip'} || ''; + my $skiplike = $args->{'skiplike'} || ''; + my $db_user = $args->{'db_user'} || 'db_user'; + my $db_pass = $args->{'db_password'} || 'db_pass'; + my $parser_name = $t->parser_type; + my %skip = map { $_, 1 } map { s/^\s+|\s+$//; $_ } + split(/,/, $skip); + my $sqlt_version = $t->version; + + if ($parser_name =~ /Parser::(\w+)$/) { + $parser_name = $1; + } + + my %type_to_dbd = ( + MySQL => 'mysql', + Oracle => 'Oracle', + PostgreSQL => 'Pg', + SQLite => 'SQLite', + Sybase => 'Sybase', + ); + my $dbd = $type_to_dbd{$parser_name} || 'DBD'; + my $dsn = $args->{'dsn'} || "dbi:$dbd:"; + if ($dbd eq 'Pg' && !$args->{'dsn'}) { + $dsn .= 'dbname=dbname;host=hostname'; + } elsif ($dbd eq 'Oracle' && !$args->{'dsn'}) { + $db_user = "$db_user/$db_pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)" + . "(HOST=hostname)(PORT=1521))(CONNECT_DATA=(SID=sid)))"; + $db_pass = ''; + } elsif ($dbd eq 'mysql' && !$args->{'dsn'}) { + $dsn .= 'dbname'; + } + + my $template = Template->new; + my $template_text = template(); + my $out; + $template->process( + \$template_text, + { + translator => $t, + schema => $schema, + db_user => $db_user, + db_pass => $db_pass, + dsn => $dsn, + perl => $Config{'startperl'}, + skip => \%skip, + skiplike => $skiplike, + }, + \$out + ) or die $template->error; - return $out; + return $out; } sub template { -# -# Returns the template to be processed by Template Toolkit -# - return <<'EOF'; + # + # Returns the template to be processed by Template Toolkit + # + return <<'EOF'; [% perl || '#!/usr/bin/perl' %] [% USE date %] # diff --git a/lib/SQL/Translator/Producer/GraphViz.pm b/lib/SQL/Translator/Producer/GraphViz.pm index 0289fa1b6..afeb64f11 100644 --- a/lib/SQL/Translator/Producer/GraphViz.pm +++ b/lib/SQL/Translator/Producer/GraphViz.pm @@ -227,398 +227,365 @@ use strict; use GraphViz; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(debug); -use Scalar::Util qw/openhandle/; +use Scalar::Util qw/openhandle/; our $DEBUG; our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; sub produce { - my $t = shift; - my $schema = $t->schema; - my $args = $t->producer_args; - local $DEBUG = $t->debug; - - # translate legacy {node|edge|graph}attrs to just {node|edge|graph} - for my $argtype (qw/node edge graph/) { - my $old_arg = $argtype . 'attrs'; - - my %arglist = (map - { %{ $_ || {} } } - ( delete $args->{$old_arg}, delete $args->{$argtype} ) - ); - - $args->{$argtype} = \%arglist if keys %arglist; - } - - # explode font settings - for (qw/fontsize fontname/) { - if (defined $args->{$_}) { - $args->{node}{$_} ||= $args->{$_}; - $args->{edge}{$_} ||= $args->{$_}; - $args->{graph}{$_} ||= $args->{$_}; - } + my $t = shift; + my $schema = $t->schema; + my $args = $t->producer_args; + local $DEBUG = $t->debug; + + # translate legacy {node|edge|graph}attrs to just {node|edge|graph} + for my $argtype (qw/node edge graph/) { + my $old_arg = $argtype . 'attrs'; + + my %arglist = (map { %{ $_ || {} } } (delete $args->{$old_arg}, delete $args->{$argtype})); + + $args->{$argtype} = \%arglist if keys %arglist; + } + + # explode font settings + for (qw/fontsize fontname/) { + if (defined $args->{$_}) { + $args->{node}{$_} ||= $args->{$_}; + $args->{edge}{$_} ||= $args->{$_}; + $args->{graph}{$_} ||= $args->{$_}; } - - # legacy add_color setting, trumped by bgcolor if set - $args->{bgcolor} ||= 'lightgoldenrodyellow' if $args->{add_color}; - - # legacy node_shape setting, defaults to 'record', trumped by {node}{shape} - $args->{node}{shape} ||= ( $args->{node_shape} || 'record' ); - - # maintain defaults - $args->{layout} ||= 'dot'; - $args->{output_type} ||= 'png'; - $args->{overlap} ||= 'false'; - $args->{node}{style} ||= 'filled'; - $args->{node}{fillcolor} ||= 'white'; - - $args->{show_fields} = 1 if not exists $args->{show_fields}; - $args->{show_index_names} = 1 if not exists $args->{show_index_names}; - $args->{width} = 8.5 if not defined $args->{width}; - $args->{height} = 11 if not defined $args->{height}; - for ( $args->{height}, $args->{width} ) { - $_ = 0 unless $_ =~ /^\d+(?:.\d+)?$/; - $_ = 0 if $_ < 0; - } - - # so split won't warn - $args->{$_} ||= '' for qw/skip_fields skip_tables skip_tables_like cluster/; - - my %skip_fields = map { s/^\s+|\s+$//g; length $_ ? ($_, 1) : () } - split ( /,/, $args->{skip_fields} ); - - my %skip_tables = map { $_, 1 } ( - ref $args->{skip_tables} eq 'ARRAY' - ? @{$args->{skip_tables}} - : split (/\s*,\s*/, $args->{skip_tables}) - ); - - my @skip_tables_like = map { qr/$_/ } ( - ref $args->{skip_tables_like} eq 'ARRAY' - ? @{$args->{skip_tables_like}} - : split (/\s*,\s*/, $args->{skip_tables_like}) - ); - - # join_pk_only/skip_fields implies natural_join - $args->{natural_join} = 1 + } + + # legacy add_color setting, trumped by bgcolor if set + $args->{bgcolor} ||= 'lightgoldenrodyellow' if $args->{add_color}; + + # legacy node_shape setting, defaults to 'record', trumped by {node}{shape} + $args->{node}{shape} ||= ($args->{node_shape} || 'record'); + + # maintain defaults + $args->{layout} ||= 'dot'; + $args->{output_type} ||= 'png'; + $args->{overlap} ||= 'false'; + $args->{node}{style} ||= 'filled'; + $args->{node}{fillcolor} ||= 'white'; + + $args->{show_fields} = 1 if not exists $args->{show_fields}; + $args->{show_index_names} = 1 if not exists $args->{show_index_names}; + $args->{width} = 8.5 if not defined $args->{width}; + $args->{height} = 11 if not defined $args->{height}; + for ($args->{height}, $args->{width}) { + $_ = 0 unless $_ =~ /^\d+(?:.\d+)?$/; + $_ = 0 if $_ < 0; + } + + # so split won't warn + $args->{$_} ||= '' for qw/skip_fields skip_tables skip_tables_like cluster/; + + my %skip_fields = map { s/^\s+|\s+$//g; length $_ ? ($_, 1) : () } + split(/,/, $args->{skip_fields}); + + my %skip_tables = map { $_, 1 } ( + ref $args->{skip_tables} eq 'ARRAY' + ? @{ $args->{skip_tables} } + : split(/\s*,\s*/, $args->{skip_tables}) + ); + + my @skip_tables_like = map {qr/$_/} ( + ref $args->{skip_tables_like} eq 'ARRAY' + ? @{ $args->{skip_tables_like} } + : split(/\s*,\s*/, $args->{skip_tables_like}) + ); + + # join_pk_only/skip_fields implies natural_join + $args->{natural_join} = 1 if ($args->{join_pk_only} or scalar keys %skip_fields); - # usually we do not want direction when using natural join - $args->{directed} = ($args->{natural_join} ? 0 : 1) + # usually we do not want direction when using natural join + $args->{directed} = ($args->{natural_join} ? 0 : 1) if not exists $args->{directed}; - $schema->make_natural_joins( - join_pk_only => $args->{join_pk_only}, - skip_fields => $args->{skip_fields}, - ) if $args->{natural_join}; + $schema->make_natural_joins( + join_pk_only => $args->{join_pk_only}, + skip_fields => $args->{skip_fields}, + ) if $args->{natural_join}; + + my %cluster; + if (defined $args->{'cluster'}) { + my @clusters; + if (ref $args->{'cluster'} eq 'ARRAY') { + @clusters = @{ $args->{'cluster'} }; + } else { + @clusters = split /\s*;\s*/, $args->{'cluster'}; + } - my %cluster; - if ( defined $args->{'cluster'} ) { - my @clusters; - if ( ref $args->{'cluster'} eq 'ARRAY' ) { - @clusters = @{ $args->{'cluster'} }; - } - else { - @clusters = split /\s*;\s*/, $args->{'cluster'}; - } + for my $c (@clusters) { + my ($cluster_name, @cluster_tables); + if (ref $c eq 'HASH') { + $cluster_name = $c->{'name'} || $c->{'cluster_name'}; + @cluster_tables = @{ $c->{'tables'} || [] }; + } else { + my ($name, $tables) = split /\s*=\s*/, $c; + $cluster_name = $name; + @cluster_tables = split /\s*,\s*/, $tables; + } - for my $c ( @clusters ) { - my ( $cluster_name, @cluster_tables ); - if ( ref $c eq 'HASH' ) { - $cluster_name = $c->{'name'} || $c->{'cluster_name'}; - @cluster_tables = @{ $c->{'tables'} || [] }; - } - else { - my ( $name, $tables ) = split /\s*=\s*/, $c; - $cluster_name = $name; - @cluster_tables = split /\s*,\s*/, $tables; - } + for my $table (@cluster_tables) { + $cluster{$table} = $cluster_name; + } + } + } + + # + # Create a blank GraphViz object and see if we can produce the output type. + # + my $gv = GraphViz->new(%$args) + or die sprintf("Can't create GraphViz object: %s\n", $@ || 'reason unknown'); + + my $output_method = "as_$args->{output_type}"; + + # the generators are AUTOLOADed so can't use ->can ($output_method) + eval { $gv->$output_method }; + die "Invalid output type: '$args->{output_type}'" if $@; + + # + # Process tables definitions, create nodes + # + my %nj_registry; # for locations of fields for natural joins + my @fk_registry; # for locations of fields for foreign keys + +TABLE: + for my $table ($schema->get_tables) { + + my $table_name = $table->name; + if (@skip_tables_like or keys %skip_tables) { + next TABLE if $skip_tables{$table_name}; + for my $regex (@skip_tables_like) { + next TABLE if $table_name =~ $regex; + } + } - for my $table ( @cluster_tables ) { - $cluster{ $table } = $cluster_name; - } - } + my @fields = $table->get_fields; + if ($args->{show_fk_only}) { + @fields = grep { $_->is_foreign_key } @fields; } - # - # Create a blank GraphViz object and see if we can produce the output type. - # - my $gv = GraphViz->new( %$args ) - or die sprintf ("Can't create GraphViz object: %s\n", - $@ || 'reason unknown' - ); - - my $output_method = "as_$args->{output_type}"; - - # the generators are AUTOLOADed so can't use ->can ($output_method) - eval { $gv->$output_method }; - die "Invalid output type: '$args->{output_type}'" if $@; - - # - # Process tables definitions, create nodes - # - my %nj_registry; # for locations of fields for natural joins - my @fk_registry; # for locations of fields for foreign keys - - TABLE: - for my $table ( $schema->get_tables ) { - - my $table_name = $table->name; - if ( @skip_tables_like or keys %skip_tables ) { - next TABLE if $skip_tables{ $table_name }; - for my $regex ( @skip_tables_like ) { - next TABLE if $table_name =~ $regex; + my $field_str = ''; + if ($args->{show_fields}) { + my @fmt_fields; + for my $field (@fields) { + + my $field_info; + if ($args->{show_datatypes}) { + + my $field_type = $field->data_type; + my $size = $field->size; + + if ( $args->{friendly_ints} + && $size + && (lc($field_type) eq 'integer')) { + # Automatically translate to int2, int4, int8 + # Type (Bits) Max. Signed/Unsigned Length + # tinyint* (8) 128 3 + # 255 3 + # smallint (16) 32767 5 + # 65535 5 + # mediumint* (24) 8388607 7 + # 16777215 8 + # int (32) 2147483647 10 + # 4294967295 11 + # bigint (64) 9223372036854775807 19 + # 18446744073709551615 20 + # + # * tinyint and mediumint are nonstandard extensions which are + # only available under MySQL (to my knowledge) + if ($size <= 3 and $args->{friendly_ints_extended}) { + $field_type = 'tinyint'; + } elsif ($size <= 5) { + $field_type = 'smallint'; + } elsif ($size <= 8 and $args->{friendly_ints_extended}) { + $field_type = 'mediumint'; + } elsif ($size <= 11) { + $field_type = 'integer'; + } else { + $field_type = 'bigint'; + } + } + + $field_info = $field_type; + if ( $args->{show_sizes} + && $size + && ($field_type =~ /^ (?: NUMERIC | DECIMAL | (VAR)?CHAR2? ) $/ix)) { + $field_info .= '(' . $size . ')'; } } - my @fields = $table->get_fields; - if ( $args->{show_fk_only} ) { - @fields = grep { $_->is_foreign_key } @fields; + my $constraints; + if ($args->{show_constraints}) { + my @constraints; + push(@constraints, $field->is_auto_increment ? 'PA' : 'PK') + if $field->is_primary_key; + push(@constraints, 'FK') if $field->is_foreign_key; + push(@constraints, 'U') if $field->is_unique; + push(@constraints, 'N') if $field->is_nullable; + + $constraints = join(',', @constraints); } - my $field_str = ''; - if ($args->{show_fields}) { - my @fmt_fields; - for my $field (@fields) { - - my $field_info; - if ($args->{show_datatypes}) { - - my $field_type = $field->data_type; - my $size = $field->size; - - if ( $args->{friendly_ints} && $size && (lc ($field_type) eq 'integer') ) { - # Automatically translate to int2, int4, int8 - # Type (Bits) Max. Signed/Unsigned Length - # tinyint* (8) 128 3 - # 255 3 - # smallint (16) 32767 5 - # 65535 5 - # mediumint* (24) 8388607 7 - # 16777215 8 - # int (32) 2147483647 10 - # 4294967295 11 - # bigint (64) 9223372036854775807 19 - # 18446744073709551615 20 - # - # * tinyint and mediumint are nonstandard extensions which are - # only available under MySQL (to my knowledge) - if ($size <= 3 and $args->{friendly_ints_extended}) { - $field_type = 'tinyint'; - } - elsif ($size <= 5) { - $field_type = 'smallint'; - } - elsif ($size <= 8 and $args->{friendly_ints_extended}) { - $field_type = 'mediumint'; - } - elsif ($size <= 11) { - $field_type = 'integer'; - } - else { - $field_type = 'bigint'; - } - } - - $field_info = $field_type; - if ($args->{show_sizes} && $size && ($field_type =~ /^ (?: NUMERIC | DECIMAL | (VAR)?CHAR2? ) $/ix ) ) { - $field_info .= '(' . $size . ')'; - } - } - - my $constraints; - if ($args->{show_constraints}) { - my @constraints; - push(@constraints, $field->is_auto_increment ? 'PA' : 'PK') if $field->is_primary_key; - push(@constraints, 'FK') if $field->is_foreign_key; - push(@constraints, 'U') if $field->is_unique; - push(@constraints, 'N') if $field->is_nullable; - - $constraints = join (',', @constraints); - } - - # construct the field line from all info gathered so far - push @fmt_fields, join (' ', - '-', - $field->name, - $field_info || (), - $constraints ? "[$constraints]" : (), - ); - } + # construct the field line from all info gathered so far + push @fmt_fields, join(' ', '-', $field->name, $field_info || (), $constraints ? "[$constraints]" : (),); + } - # join field lines with graphviz formatting - $field_str = join ('\l', @fmt_fields) . '\l'; + # join field lines with graphviz formatting + $field_str = join('\l', @fmt_fields) . '\l'; - } + } - my $index_str = ''; - if ($args->{show_indexes}) { + my $index_str = ''; + if ($args->{show_indexes}) { - my @fmt_indexes; - for my $index ($table->get_indices) { - next unless $index->is_valid; + my @fmt_indexes; + for my $index ($table->get_indices) { + next unless $index->is_valid; - push @fmt_indexes, join (' ', + push @fmt_indexes, + join(' ', '*', $args->{show_index_names} - ? $index->name . ':' - : () - , - join (', ', $index->fields), + ? $index->name . ':' + : (), + join(', ', $index->fields), ($index->type eq 'UNIQUE') ? '[U]' : (), ); - } + } - # join index lines with graphviz formatting (if any indexes at all) - $index_str = join ('\l', @fmt_indexes) . '\l' if @fmt_indexes; - } + # join index lines with graphviz formatting (if any indexes at all) + $index_str = join('\l', @fmt_indexes) . '\l' if @fmt_indexes; + } - my $name_str = $table_name . '\n'; + my $name_str = $table_name . '\n'; - # escape spaces - for ($name_str, $field_str, $index_str) { - $_ =~ s/ /\\ /g; - } + # escape spaces + for ($name_str, $field_str, $index_str) { + $_ =~ s/ /\\ /g; + } - my $node_args; - - # only the 'record' type supports nice formatting - if ($args->{node}{shape} eq 'record') { - - # the necessity to supply shape => 'record' is a graphviz bug - $node_args = { - shape => 'record', - label => sprintf ('{%s}', - join ('|', - $name_str, - $field_str || (), - $index_str || (), - ), - ), - }; - } - else { - my $sep = sprintf ('%s\n', - '-' x ( (length $table_name) + 2) - ); + my $node_args; - $node_args = { - label => join ($sep, - $name_str, - $field_str || (), - $index_str || (), - ), - }; - } + # only the 'record' type supports nice formatting + if ($args->{node}{shape} eq 'record') { - if (my $cluster_name = $cluster{$table_name} ) { - $node_args->{cluster} = $cluster_name; - } + # the necessity to supply shape => 'record' is a graphviz bug + $node_args = { + shape => 'record', + label => sprintf('{%s}', join('|', $name_str, $field_str || (), $index_str || (),),), + }; + } else { + my $sep = sprintf('%s\n', '-' x ((length $table_name) + 2)); - $gv->add_node(qq["$table_name"], %$node_args); + $node_args = { label => join($sep, $name_str, $field_str || (), $index_str || (),), }; + } - debug("Processing table '$table_name'"); + if (my $cluster_name = $cluster{$table_name}) { + $node_args->{cluster} = $cluster_name; + } - debug("Fields = ", join(', ', map { $_->name } @fields)) if $DEBUG; + $gv->add_node(qq["$table_name"], %$node_args); - for my $f ( @fields ) { - my $name = $f->name or next; - my $is_pk = $f->is_primary_key; - my $is_unique = $f->is_unique; + debug("Processing table '$table_name'"); - # - # Decide if we should skip this field. - # - if ( $args->{natural_join} ) { - next unless $is_pk || $f->is_foreign_key; - } + debug("Fields = ", join(', ', map { $_->name } @fields)) if $DEBUG; - my $constraints = $f->{'constraints'}; + for my $f (@fields) { + my $name = $f->name or next; + my $is_pk = $f->is_primary_key; + my $is_unique = $f->is_unique; - if ( $args->{natural_join} && !$skip_fields{ $name } ) { - push @{ $nj_registry{ $name } }, $table_name; - } - } + # + # Decide if we should skip this field. + # + if ($args->{natural_join}) { + next unless $is_pk || $f->is_foreign_key; + } - unless ( $args->{natural_join} ) { - for my $c ( $table->get_constraints ) { - next unless $c->type eq FOREIGN_KEY; - my $fk_table = $c->reference_table or next; - - for my $field_name ( $c->fields ) { - for my $fk_field ( $c->reference_fields ) { - next unless defined $schema->get_table( $fk_table ); - - # a condition is optional if at least one fk is nullable - push @fk_registry, [ - $table_name, - $fk_table, - scalar (grep { $_->is_nullable } ($c->fields)) - ]; - } - } - } - } + my $constraints = $f->{'constraints'}; + + if ($args->{natural_join} && !$skip_fields{$name}) { + push @{ $nj_registry{$name} }, $table_name; + } } - # - # Process relationships, create edges - # - my (@table_bunches, %optional_constraints); - if ( $args->{natural_join} ) { - for my $field_name ( keys %nj_registry ) { - my @table_names = @{ $nj_registry{ $field_name } || [] } or next; - next if scalar @table_names == 1; - push @table_bunches, [ @table_names ]; + unless ($args->{natural_join}) { + for my $c ($table->get_constraints) { + next unless $c->type eq FOREIGN_KEY; + my $fk_table = $c->reference_table or next; + + for my $field_name ($c->fields) { + for my $fk_field ($c->reference_fields) { + next unless defined $schema->get_table($fk_table); + + # a condition is optional if at least one fk is nullable + push @fk_registry, [ $table_name, $fk_table, scalar(grep { $_->is_nullable } ($c->fields)) ]; + } } + } } - else { - for my $i (0 .. $#fk_registry) { - my $fk = $fk_registry[$i]; - push @table_bunches, [$fk->[0], $fk->[1]]; - $optional_constraints{$i} = $fk->[2]; - } + } + + # + # Process relationships, create edges + # + my (@table_bunches, %optional_constraints); + if ($args->{natural_join}) { + for my $field_name (keys %nj_registry) { + my @table_names = @{ $nj_registry{$field_name} || [] } or next; + next if scalar @table_names == 1; + push @table_bunches, [@table_names]; } - - my %done; - for my $bi (0 .. $#table_bunches) { - my @tables = @{$table_bunches[$bi]}; - - for my $i ( 0 .. $#tables ) { - my $table1 = $tables[ $i ]; - for my $j ( 1 .. $#tables ) { - next if $i == $j; - my $table2 = $tables[ $j ]; - next if $done{ $table1 }{ $table2 }; - debug("Adding edge '$table2' -> '$table1'"); - $gv->add_edge( - qq["$table2"], - qq["$table1"], - arrowhead => $optional_constraints{$bi} ? 'empty' : 'normal', - ); - $done{ $table1 }{ $table2 } = 1; - } - } + } else { + for my $i (0 .. $#fk_registry) { + my $fk = $fk_registry[$i]; + push @table_bunches, [ $fk->[0], $fk->[1] ]; + $optional_constraints{$i} = $fk->[2]; } - - # - # Print the image - # - if ( my $out = $args->{out_file} ) { - if (openhandle ($out)) { - print $out $gv->$output_method; - } - else { - open my $fh, '>', $out or die "Can't write '$out': $!\n"; - binmode $fh; - print $fh $gv->$output_method; - close $fh; - } + } + + my %done; + for my $bi (0 .. $#table_bunches) { + my @tables = @{ $table_bunches[$bi] }; + + for my $i (0 .. $#tables) { + my $table1 = $tables[$i]; + for my $j (1 .. $#tables) { + next if $i == $j; + my $table2 = $tables[$j]; + next if $done{$table1}{$table2}; + debug("Adding edge '$table2' -> '$table1'"); + $gv->add_edge( + qq["$table2"], qq["$table1"], arrowhead => $optional_constraints{$bi} + ? 'empty' + : 'normal', + ); + $done{$table1}{$table2} = 1; + } } - else { - return $gv->$output_method; + } + + # + # Print the image + # + if (my $out = $args->{out_file}) { + if (openhandle($out)) { + print $out $gv->$output_method; + } else { + open my $fh, '>', $out or die "Can't write '$out': $!\n"; + binmode $fh; + print $fh $gv->$output_method; + close $fh; } + } else { + return $gv->$output_method; + } } 1; diff --git a/lib/SQL/Translator/Producer/HTML.pm b/lib/SQL/Translator/Producer/HTML.pm index 8f351abf1..f10430700 100644 --- a/lib/SQL/Translator/Producer/HTML.pm +++ b/lib/SQL/Translator/Producer/HTML.pm @@ -4,9 +4,9 @@ use strict; use warnings; use Data::Dumper; -our $VERSION = '1.64'; -our $NAME = __PACKAGE__; -our $NOWRAP = 0 unless defined $NOWRAP; +our $VERSION = '1.64'; +our $NAME = __PACKAGE__; +our $NOWRAP = 0 unless defined $NOWRAP; our $NOLINKTABLE = 0 unless defined $NOLINKTABLE; # Emit XHTML by default @@ -18,219 +18,191 @@ use SQL::Translator::Schema::Constants; # Main entry point. Returns a string containing HTML. # ------------------------------------------------------------------- sub produce { - my $t = shift; - my $args = $t->producer_args; - my $schema = $t->schema; - my $schema_name = $schema->name || 'Schema'; - my $title = $args->{'title'} || "Description of $schema_name"; - my $wrap = ! (defined $args->{'nowrap'} - ? $args->{'nowrap'} - : $NOWRAP); - my $linktable = ! (defined $args->{'nolinktable'} - ? $args->{'nolinktable'} - : $NOLINKTABLE); - my %stylesheet = defined $args->{'stylesheet'} - ? ( -style => { src => $args->{'stylesheet'} } ) - : ( ); - my @html; - my $q = defined $args->{'pretty'} - ? do { require CGI::Pretty; - import CGI::Pretty; - CGI::Pretty->new } - : do { require CGI; - import CGI; - CGI->new }; - my ($table, @table_names); - - if ($wrap) { - push @html, - $q->start_html({ - -title => $title, - %stylesheet, - -meta => { generator => $NAME }, - }), - $q->h1({ -class => 'SchemaDescription' }, $title), - $q->hr; + my $t = shift; + my $args = $t->producer_args; + my $schema = $t->schema; + my $schema_name = $schema->name || 'Schema'; + my $title = $args->{'title'} || "Description of $schema_name"; + my $wrap = !( + defined $args->{'nowrap'} + ? $args->{'nowrap'} + : $NOWRAP + ); + my $linktable = !( + defined $args->{'nolinktable'} + ? $args->{'nolinktable'} + : $NOLINKTABLE + ); + my %stylesheet + = defined $args->{'stylesheet'} + ? (-style => { src => $args->{'stylesheet'} }) + : (); + my @html; + my $q = defined $args->{'pretty'} + ? do { + require CGI::Pretty; + import CGI::Pretty; + CGI::Pretty->new; + } + : do { + require CGI; + import CGI; + CGI->new; + }; + my ($table, @table_names); + + if ($wrap) { + push @html, + $q->start_html({ + -title => $title, + %stylesheet, + -meta => { generator => $NAME }, + }), + $q->h1({ -class => 'SchemaDescription' }, $title), + $q->hr; + } + + @table_names = grep { length $_->name } $schema->get_tables; + + if ($linktable) { + + # Generate top menu, with links to full table information + my $count = scalar(@table_names); + $count = sprintf "%d table%s", $count, $count == 1 ? '' : 's'; + + # Leading table of links + push @html, + $q->comment("Table listing ($count)"), + $q->a({ -name => 'top' }), + $q->start_table({ -width => '100%', -class => 'LinkTable' }), + + # XXX This needs to be colspan="$#{$table->fields}" class="LinkTableHeader" + $q->Tr($q->td({ -class => 'LinkTableCell' }, $q->h2({ -class => 'LinkTableTitle' }, 'Tables'),),); + + for my $table (@table_names) { + my $table_name = $table->name; + push @html, $q->comment("Start link to table '$table_name'"), + $q->Tr({ -class => 'LinkTableRow' }, + $q->td({ -class => 'LinkTableCell' }, qq[$table_name])), + $q->comment("End link to table '$table_name'"); + } + push @html, $q->end_table; + } + + for my $table ($schema->get_tables) { + my $table_name = $table->name or next; + my @fields = $table->get_fields or next; + push @html, $q->comment("Starting table '$table_name'"), $q->a({ -name => $table_name }), + $q->table( + { -class => 'TableHeader', -width => '100%' }, + $q->Tr( + { -class => 'TableHeaderRow' }, + $q->td({ -class => 'TableHeaderCell' }, $q->h3($table_name)), + qq[], + $q->td({ -class => 'TableHeaderCell', -align => 'right' }, qq[Top]) + ) + ); + + if (my @comments = map { $_ ? $_ : () } $table->comments) { + push @html, $q->b("Comments:"), $q->br, $q->em(map { $q->br, $_ } @comments); } - @table_names = grep { length $_->name } $schema->get_tables; - - if ($linktable) { - # Generate top menu, with links to full table information - my $count = scalar(@table_names); - $count = sprintf "%d table%s", $count, $count == 1 ? '' : 's'; - - # Leading table of links - push @html, - $q->comment("Table listing ($count)"), - $q->a({ -name => 'top' }), - $q->start_table({ -width => '100%', -class => 'LinkTable'}), - - # XXX This needs to be colspan="$#{$table->fields}" class="LinkTableHeader" - $q->Tr( - $q->td({ -class => 'LinkTableCell' }, - $q->h2({ -class => 'LinkTableTitle' }, - 'Tables' - ), - ), - ); - - for my $table (@table_names) { - my $table_name = $table->name; - push @html, - $q->comment("Start link to table '$table_name'"), - $q->Tr({ -class => 'LinkTableRow' }, - $q->td({ -class => 'LinkTableCell' }, - qq[$table_name] - ) - ), - $q->comment("End link to table '$table_name'"); - } - push @html, $q->end_table; + # + # Fields + # + push @html, $q->start_table({ -border => 1 }), + $q->Tr($q->th( + { -class => 'FieldHeader' }, + [ 'Field Name', 'Data Type', 'Size', 'Default Value', 'Other', 'Foreign Key' ] + )); + + my $i = 0; + for my $field (@fields) { + my $name = $field->name || ''; + $name = qq[$name]; + my $data_type = $field->data_type || ''; + my $size = defined $field->size ? $field->size : ''; + my $default = defined $field->default_value ? $field->default_value : ''; + my $comment = $field->comments || ''; + my $fk = ''; + + if ($field->is_foreign_key) { + my $c = $field->foreign_key_reference; + my $ref_table = $c->reference_table || ''; + my $ref_field = ($c->reference_fields)[0] || ''; + $fk = qq[$ref_table.$ref_field]; + } + + my @other = (); + push @other, 'PRIMARY KEY' if $field->is_primary_key; + push @other, 'UNIQUE' if $field->is_unique; + push @other, 'NOT NULL' unless $field->is_nullable; + push @other, $comment if $comment; + my $class = $i++ % 2 ? 'even' : 'odd'; + push @html, + $q->Tr( + { -class => "tr-$class" }, + $q->td({ -class => "FieldCellName" }, $name), + $q->td({ -class => "FieldCellType" }, $data_type), + $q->td({ -class => "FieldCellSize" }, $size), + $q->td({ -class => "FieldCellDefault" }, $default), + $q->td({ -class => "FieldCellOther" }, join(', ', @other)), + $q->td({ -class => "FieldCellFK" }, $fk), + ); } + push @html, $q->end_table; + + # + # Indices + # + if (my @indices = $table->get_indices) { + push @html, + $q->h3('Indices'), + $q->start_table({ -border => 1 }), + $q->Tr({ -class => 'IndexRow' }, $q->th([ 'Name', 'Fields' ])); + + for my $index (@indices) { + my $name = $index->name || ''; + my $fields = join(', ', $index->fields) || ''; + + push @html, $q->Tr({ -class => 'IndexCell' }, $q->td([ $name, $fields ])); + } - for my $table ($schema->get_tables) { - my $table_name = $table->name or next; - my @fields = $table->get_fields or next; - push @html, - $q->comment("Starting table '$table_name'"), - $q->a({ -name => $table_name }), - $q->table({ -class => 'TableHeader', -width => '100%' }, - $q->Tr({ -class => 'TableHeaderRow' }, - $q->td({ -class => 'TableHeaderCell' }, $q->h3($table_name)), - qq[], - $q->td({ -class => 'TableHeaderCell', -align => 'right' }, - qq[Top] - ) - ) - ); - - if ( my @comments = map { $_ ? $_ : () } $table->comments ) { - push @html, - $q->b("Comments:"), - $q->br, - $q->em(map { $q->br, $_ } @comments); - } - - # - # Fields - # - push @html, - $q->start_table({ -border => 1 }), - $q->Tr( - $q->th({ -class => 'FieldHeader' }, - [ - 'Field Name', - 'Data Type', - 'Size', - 'Default Value', - 'Other', - 'Foreign Key' - ] - ) - ); - - my $i = 0; - for my $field ( @fields ) { - my $name = $field->name || ''; - $name = qq[$name]; - my $data_type = $field->data_type || ''; - my $size = defined $field->size ? $field->size : ''; - my $default = defined $field->default_value - ? $field->default_value : ''; - my $comment = $field->comments || ''; - my $fk = ''; - - if ($field->is_foreign_key) { - my $c = $field->foreign_key_reference; - my $ref_table = $c->reference_table || ''; - my $ref_field = ($c->reference_fields)[0] || ''; - $fk = - qq[$ref_table.$ref_field]; - } - - my @other = (); - push @other, 'PRIMARY KEY' if $field->is_primary_key; - push @other, 'UNIQUE' if $field->is_unique; - push @other, 'NOT NULL' unless $field->is_nullable; - push @other, $comment if $comment; - my $class = $i++ % 2 ? 'even' : 'odd'; - push @html, - $q->Tr( - { -class => "tr-$class" }, - $q->td({ -class => "FieldCellName" }, $name), - $q->td({ -class => "FieldCellType" }, $data_type), - $q->td({ -class => "FieldCellSize" }, $size), - $q->td({ -class => "FieldCellDefault" }, $default), - $q->td({ -class => "FieldCellOther" }, join(', ', @other)), - $q->td({ -class => "FieldCellFK" }, $fk), - ); - } - push @html, $q->end_table; - - # - # Indices - # - if ( my @indices = $table->get_indices ) { - push @html, - $q->h3('Indices'), - $q->start_table({ -border => 1 }), - $q->Tr({ -class => 'IndexRow' }, - $q->th([ 'Name', 'Fields' ]) - ); - - for my $index ( @indices ) { - my $name = $index->name || ''; - my $fields = join( ', ', $index->fields ) || ''; - - push @html, - $q->Tr({ -class => 'IndexCell' }, - $q->td( [ $name, $fields ] ) - ); - } - - push @html, $q->end_table; - } - - # - # Constraints - # - my @constraints = - grep { $_->type ne PRIMARY_KEY } $table->get_constraints; - if ( @constraints ) { - push @html, - $q->h3('Constraints'), - $q->start_table({ -border => 1 }), - $q->Tr({ -class => 'IndexRow' }, - $q->th([ 'Type', 'Fields' ]) - ); - - for my $c ( @constraints ) { - my $type = $c->type || ''; - my $fields = join( ', ', $c->fields ) || ''; - - push @html, - $q->Tr({ -class => 'IndexCell' }, - $q->td( [ $type, $fields ] ) - ); - } - - push @html, $q->end_table; - } - - push @html, $q->hr; + push @html, $q->end_table; } - my $sqlt_version = $t->version; - if ($wrap) { - push @html, - qq[Created by ], - qq[SQL::Translator $sqlt_version], - $q->end_html; + # + # Constraints + # + my @constraints = grep { $_->type ne PRIMARY_KEY } $table->get_constraints; + if (@constraints) { + push @html, + $q->h3('Constraints'), + $q->start_table({ -border => 1 }), + $q->Tr({ -class => 'IndexRow' }, $q->th([ 'Type', 'Fields' ])); + + for my $c (@constraints) { + my $type = $c->type || ''; + my $fields = join(', ', $c->fields) || ''; + + push @html, $q->Tr({ -class => 'IndexCell' }, $q->td([ $type, $fields ])); + } + + push @html, $q->end_table; } + push @html, $q->hr; + } + + my $sqlt_version = $t->version; + if ($wrap) { + push @html, + qq[Created by ], + qq[SQL::Translator $sqlt_version], + $q->end_html; + } - return join "\n", @html; + return join "\n", @html; } 1; diff --git a/lib/SQL/Translator/Producer/JSON.pm b/lib/SQL/Translator/Producer/JSON.pm index be7c9fa7d..5f7523dac 100644 --- a/lib/SQL/Translator/Producer/JSON.pm +++ b/lib/SQL/Translator/Producer/JSON.pm @@ -23,163 +23,162 @@ our $VERSION = '1.64'; use JSON::MaybeXS 'to_json'; sub produce { - my $translator = shift; - my $schema = $translator->schema; - - return to_json({ - schema => { - tables => { - map { ($_->name => view_table($_)) } - $schema->get_tables, - }, - views => { - map { ($_->name => view_view($_)) } - $schema->get_views, - }, - triggers => { - map { ($_->name => view_trigger($_)) } - $schema->get_triggers, - }, - procedures => { - map { ($_->name => view_procedure($_)) } - $schema->get_procedures, - }, - }, - translator => { - add_drop_table => $translator->add_drop_table, - filename => $translator->filename, - no_comments => $translator->no_comments, - parser_args => $translator->parser_args, - producer_args => $translator->producer_args, - parser_type => $translator->parser_type, - producer_type => $translator->producer_type, - show_warnings => $translator->show_warnings, - trace => $translator->trace, - version => $translator->version, - }, - keys %{$schema->extra} ? ('extra' => { $schema->extra } ) : (), - }, { - allow_blessed => 1, - allow_unknown => 1, - ( map { $_ => $translator->producer_args->{$_} } - grep { defined $translator->producer_args->{$_} } - qw[ pretty indent canonical ] ), - }); + my $translator = shift; + my $schema = $translator->schema; + + return to_json( + { + schema => { + tables => { map { ($_->name => view_table($_)) } $schema->get_tables, }, + views => { map { ($_->name => view_view($_)) } $schema->get_views, }, + triggers => { map { ($_->name => view_trigger($_)) } $schema->get_triggers, }, + procedures => { map { ($_->name => view_procedure($_)) } $schema->get_procedures, }, + }, + translator => { + add_drop_table => $translator->add_drop_table, + filename => $translator->filename, + no_comments => $translator->no_comments, + parser_args => $translator->parser_args, + producer_args => $translator->producer_args, + parser_type => $translator->parser_type, + producer_type => $translator->producer_type, + show_warnings => $translator->show_warnings, + trace => $translator->trace, + version => $translator->version, + }, + keys %{ $schema->extra } ? ('extra' => { $schema->extra }) : (), + }, + { + allow_blessed => 1, + allow_unknown => 1, + ( + map { $_ => $translator->producer_args->{$_} } + grep { defined $translator->producer_args->{$_} } qw[ pretty indent canonical ] + ), + } + ); } sub view_table { - my $table = shift; - - return { - 'name' => $table->name, - 'order' => $table->order, - 'options' => $table->options || [], - $table->comments ? ('comments' => [ $table->comments ] ) : (), - 'constraints' => [ - map { view_constraint($_) } $table->get_constraints - ], - 'indices' => [ - map { view_index($_) } $table->get_indices - ], - 'fields' => { - map { ($_->name => view_field($_)) } - $table->get_fields - }, - keys %{$table->extra} ? ('extra' => { $table->extra } ) : (), - }; + my $table = shift; + + return { + 'name' => $table->name, + 'order' => $table->order, + 'options' => $table->options || [], + $table->comments ? ('comments' => [ $table->comments ]) : (), + 'constraints' => [ + map { view_constraint($_) } $table->get_constraints + ], + 'indices' => [ + map { view_index($_) } $table->get_indices + ], + 'fields' => { + map { ($_->name => view_field($_)) } + $table->get_fields + }, + keys %{ $table->extra } ? ('extra' => { $table->extra }) : (), + }; } sub view_constraint { - my $constraint = shift; - - return { - 'deferrable' => scalar $constraint->deferrable, - 'expression' => scalar $constraint->expression, - 'fields' => [ map { ref $_ ? $_->name : $_ } $constraint->field_names ], - 'match_type' => scalar $constraint->match_type, - 'name' => scalar $constraint->name, - 'options' => scalar $constraint->options, - 'on_delete' => scalar $constraint->on_delete, - 'on_update' => scalar $constraint->on_update, - 'reference_fields' => [ map { ref $_ ? $_->name : $_ } $constraint->reference_fields ], - 'reference_table' => scalar $constraint->reference_table, - 'type' => scalar $constraint->type, - keys %{$constraint->extra} ? ('extra' => { $constraint->extra } ) : (), - }; + my $constraint = shift; + + return { + 'deferrable' => scalar $constraint->deferrable, + 'expression' => scalar $constraint->expression, + 'fields' => [ map { ref $_ ? $_->name : $_ } $constraint->field_names ], + 'match_type' => scalar $constraint->match_type, + 'name' => scalar $constraint->name, + 'options' => scalar $constraint->options, + 'on_delete' => scalar $constraint->on_delete, + 'on_update' => scalar $constraint->on_update, + 'reference_fields' => [ map { ref $_ ? $_->name : $_ } $constraint->reference_fields ], + 'reference_table' => scalar $constraint->reference_table, + 'type' => scalar $constraint->type, + keys %{ $constraint->extra } + ? ('extra' => { $constraint->extra }) + : (), + }; } sub view_field { - my $field = shift; - - return { - 'order' => scalar $field->order, - 'name' => scalar $field->name, - 'data_type' => scalar $field->data_type, - 'size' => [ $field->size ], - 'default_value' => scalar $field->default_value, - 'is_nullable' => scalar $field->is_nullable, - 'is_primary_key' => scalar $field->is_primary_key, - 'is_unique' => scalar $field->is_unique, - $field->is_auto_increment ? ('is_auto_increment' => 1) : (), - $field->comments ? ('comments' => [ $field->comments ]) : (), - keys %{$field->extra} ? ('extra' => { $field->extra } ) : (), - }; + my $field = shift; + + return { + 'order' => scalar $field->order, + 'name' => scalar $field->name, + 'data_type' => scalar $field->data_type, + 'size' => [ $field->size ], + 'default_value' => scalar $field->default_value, + 'is_nullable' => scalar $field->is_nullable, + 'is_primary_key' => scalar $field->is_primary_key, + 'is_unique' => scalar $field->is_unique, + $field->is_auto_increment ? ('is_auto_increment' => 1) : (), + $field->comments ? ('comments' => [ $field->comments ]) : (), + keys %{ $field->extra } ? ('extra' => { $field->extra }) : (), + }; } sub view_procedure { - my $procedure = shift; - - return { - 'order' => scalar $procedure->order, - 'name' => scalar $procedure->name, - 'sql' => scalar $procedure->sql, - 'parameters' => scalar $procedure->parameters, - 'owner' => scalar $procedure->owner, - $procedure->comments ? ('comments' => [ $procedure->comments ] ) : (), - keys %{$procedure->extra} ? ('extra' => { $procedure->extra } ) : (), - }; + my $procedure = shift; + + return { + 'order' => scalar $procedure->order, + 'name' => scalar $procedure->name, + 'sql' => scalar $procedure->sql, + 'parameters' => scalar $procedure->parameters, + 'owner' => scalar $procedure->owner, + $procedure->comments ? ('comments' => [ $procedure->comments ]) : (), + keys %{ $procedure->extra } ? ('extra' => { $procedure->extra }) : (), + }; } sub view_trigger { - my $trigger = shift; - - return { - 'order' => scalar $trigger->order, - 'name' => scalar $trigger->name, - 'perform_action_when' => scalar $trigger->perform_action_when, - 'database_events' => scalar $trigger->database_events, - 'fields' => scalar $trigger->fields, - 'on_table' => scalar $trigger->on_table, - 'action' => scalar $trigger->action, - (defined $trigger->scope ? ( - 'scope' => scalar $trigger->scope, - ) : ()), - keys %{$trigger->extra} ? ('extra' => { $trigger->extra } ) : (), - }; + my $trigger = shift; + + return { + 'order' => scalar $trigger->order, + 'name' => scalar $trigger->name, + 'perform_action_when' => scalar $trigger->perform_action_when, + 'database_events' => scalar $trigger->database_events, + 'fields' => scalar $trigger->fields, + 'on_table' => scalar $trigger->on_table, + 'action' => scalar $trigger->action, + ( + defined $trigger->scope + ? ('scope' => scalar $trigger->scope,) + : () + ), + keys %{ $trigger->extra } ? ('extra' => { $trigger->extra }) : (), + }; } sub view_view { - my $view = shift; - - return { - 'order' => scalar $view->order, - 'name' => scalar $view->name, - 'sql' => scalar $view->sql, - 'fields' => scalar $view->fields, - keys %{$view->extra} ? ('extra' => { $view->extra } ) : (), - }; + my $view = shift; + + return { + 'order' => scalar $view->order, + 'name' => scalar $view->name, + 'sql' => scalar $view->sql, + 'fields' => scalar $view->fields, + keys %{ $view->extra } ? ('extra' => { $view->extra }) : (), + }; } sub view_index { - my $index = shift; - - return { - 'name' => scalar $index->name, - 'type' => scalar $index->type, - 'fields' => [ map { ref($_) && $_->extra && keys %{$_->extra} ? { name => $_->name, %{$_->extra} } : "$_" } $index->fields ], - 'options' => scalar $index->options, - keys %{$index->extra} ? ('extra' => { $index->extra } ) : (), - }; + my $index = shift; + + return { + 'name' => scalar $index->name, + 'type' => scalar $index->type, + 'fields' => [ + map { ref($_) && $_->extra && keys %{ $_->extra } ? { name => $_->name, %{ $_->extra } } : "$_" } + $index->fields + ], + 'options' => scalar $index->options, + keys %{ $index->extra } ? ('extra' => { $index->extra }) : (), + }; } 1; diff --git a/lib/SQL/Translator/Producer/Latex.pm b/lib/SQL/Translator/Producer/Latex.pm index 1ff2365e6..dceaa5995 100644 --- a/lib/SQL/Translator/Producer/Latex.pm +++ b/lib/SQL/Translator/Producer/Latex.pm @@ -39,14 +39,13 @@ our $VERSION = '1.64'; use SQL::Translator::Utils 'debug'; sub produce { - my $translator = shift; - my $schema = $translator->schema; - my $o = ''; - for my $table ( $schema->get_tables ) { - my $table_name = $table->name or next; - my $n = latex($table_name); - $o .= - sprintf ' + my $translator = shift; + my $schema = $translator->schema; + my $o = ''; + for my $table ($schema->get_tables) { + my $table_name = $table->name or next; + my $n = latex($table_name); + $o .= sprintf ' \subsubsection{%s} %s \begin{table}[htb] @@ -56,28 +55,28 @@ sub produce { { \small \begin{tabular}{l l p{8cm}} Column & Datatype & Description \\\\ \hline -', - $n, latex($table->comments), $n, $table_name; +', $n, latex($table->comments), $n, $table_name; - foreach my $f ($table->get_fields) { - $o .= sprintf '%s & %s & %s \\\\', map {latex($_)} ($f->name, $f->data_type, $f->comments || ''); - $o .= "\n"; + foreach my $f ($table->get_fields) { + $o .= sprintf '%s & %s & %s \\\\', map { latex($_) } ($f->name, $f->data_type, $f->comments || ''); + $o .= "\n"; - } -$o .= sprintf ' + } + $o .= sprintf ' \end{tabular} } \end{table} \clearpage '; - } - return $o; + } + return $o; } + sub latex { - my $s = shift; - return '' unless defined $s; - $s =~ s/([\&\_\$\{\#])/\\$1/g; - return $s; + my $s = shift; + return '' unless defined $s; + $s =~ s/([\&\_\$\{\#])/\\$1/g; + return $s; } 1; diff --git a/lib/SQL/Translator/Producer/MySQL.pm b/lib/SQL/Translator/Producer/MySQL.pm index d9d472049..698a24cb0 100644 --- a/lib/SQL/Translator/Producer/MySQL.pm +++ b/lib/SQL/Translator/Producer/MySQL.pm @@ -81,9 +81,9 @@ Set the fields character set and collation order. use strict; use warnings; -our ( $DEBUG, %used_names ); +our ($DEBUG, %used_names); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; # Maximum length for most identifiers is 64, according to: # http://dev.mysql.com/doc/refman/4.1/en/identifiers.html @@ -103,401 +103,433 @@ use SQL::Translator::Utils qw(debug header_comment # # Use only lowercase for the keys (e.g. "long" and not "LONG") # -my %translate = ( - # - # Oracle types - # - varchar2 => 'varchar', - long => 'text', - clob => 'longtext', +my %translate = ( + # + # Oracle types + # + varchar2 => 'varchar', + long => 'text', + clob => 'longtext', - # - # Sybase types - # - int => 'integer', - money => 'float', - real => 'double', - comment => 'text', - bit => 'tinyint', + # + # Sybase types + # + int => 'integer', + money => 'float', + real => 'double', + comment => 'text', + bit => 'tinyint', - # - # Access types - # - 'long integer' => 'integer', - 'text' => 'text', - 'datetime' => 'datetime', + # + # Access types + # + 'long integer' => 'integer', + 'text' => 'text', + 'datetime' => 'datetime', - # - # PostgreSQL types - # - bytea => 'BLOB', + # + # PostgreSQL types + # + bytea => 'BLOB', ); # # Column types that do not support length attribute # my @no_length_attr = qw/ - date time timestamp datetime year - /; - + date time timestamp datetime year + /; sub preprocess_schema { - my ($schema) = @_; + my ($schema) = @_; - # extra->{mysql_table_type} used to be the type. It belongs in options, so - # move it if we find it. Return Engine type if found in extra or options - # Similarly for mysql_charset and mysql_collate - my $extra_to_options = sub { - my ($table, $extra_name, $opt_name) = @_; + # extra->{mysql_table_type} used to be the type. It belongs in options, so + # move it if we find it. Return Engine type if found in extra or options + # Similarly for mysql_charset and mysql_collate + my $extra_to_options = sub { + my ($table, $extra_name, $opt_name) = @_; - my $extra = $table->extra; + my $extra = $table->extra; - my $extra_type = delete $extra->{$extra_name}; + my $extra_type = delete $extra->{$extra_name}; - # Now just to find if there is already an Engine or Type option... - # and lets normalize it to ENGINE since: - # - # The ENGINE table option specifies the storage engine for the table. - # TYPE is a synonym, but ENGINE is the preferred option name. - # + # Now just to find if there is already an Engine or Type option... + # and lets normalize it to ENGINE since: + # + # The ENGINE table option specifies the storage engine for the table. + # TYPE is a synonym, but ENGINE is the preferred option name. + # - my $options = $table->options; + my $options = $table->options; - # If multiple option names, normalize to the first one - if (ref $opt_name) { - OPT_NAME: for ( @$opt_name[1..$#$opt_name] ) { - for my $idx ( 0..$#{$options} ) { - my ($key, $value) = %{ $options->[$idx] }; + # If multiple option names, normalize to the first one + if (ref $opt_name) { + OPT_NAME: for (@$opt_name[ 1 .. $#$opt_name ]) { + for my $idx (0 .. $#{$options}) { + my ($key, $value) = %{ $options->[$idx] }; - if (uc $key eq $_) { - $options->[$idx] = { $opt_name->[0] => $value }; - last OPT_NAME; - } + if (uc $key eq $_) { + $options->[$idx] = { $opt_name->[0] => $value }; + last OPT_NAME; } } - $opt_name = $opt_name->[0]; - } + $opt_name = $opt_name->[0]; + } - # This assumes that there isn't both a Type and an Engine option. - OPTION: - for my $idx ( 0..$#{$options} ) { - my ($key, $value) = %{ $options->[$idx] }; + # This assumes that there isn't both a Type and an Engine option. +OPTION: + for my $idx (0 .. $#{$options}) { + my ($key, $value) = %{ $options->[$idx] }; - next unless uc $key eq $opt_name; + next unless uc $key eq $opt_name; - # make sure case is right on option name - delete $options->[$idx]{$key}; - return $options->[$idx]{$opt_name} = $value || $extra_type; + # make sure case is right on option name + delete $options->[$idx]{$key}; + return $options->[$idx]{$opt_name} = $value || $extra_type; - } + } - if ($extra_type) { - push @$options, { $opt_name => $extra_type }; - return $extra_type; - } + if ($extra_type) { + push @$options, { $opt_name => $extra_type }; + return $extra_type; + } - }; + }; - # Names are only specific to a given schema - local %used_names = (); + # Names are only specific to a given schema + local %used_names = (); - # - # Work out which tables need to be InnoDB to support foreign key - # constraints. We do this first as we need InnoDB at both ends. - # - foreach my $table ( $schema->get_tables ) { + # + # Work out which tables need to be InnoDB to support foreign key + # constraints. We do this first as we need InnoDB at both ends. + # + foreach my $table ($schema->get_tables) { - $extra_to_options->($table, 'mysql_table_type', ['ENGINE', 'TYPE'] ); - $extra_to_options->($table, 'mysql_charset', 'CHARACTER SET' ); - $extra_to_options->($table, 'mysql_collate', 'COLLATE' ); + $extra_to_options->($table, 'mysql_table_type', [ 'ENGINE', 'TYPE' ]); + $extra_to_options->($table, 'mysql_charset', 'CHARACTER SET'); + $extra_to_options->($table, 'mysql_collate', 'COLLATE'); - foreach my $c ( $table->get_constraints ) { - next unless $c->type eq FOREIGN_KEY; + foreach my $c ($table->get_constraints) { + next unless $c->type eq FOREIGN_KEY; - # Normalize constraint names here. - my $c_name = $c->name; - # Give the constraint a name if it doesn't have one, so it doesn't feel - # left out - $c_name = $table->name . '_fk' unless length $c_name; + # Normalize constraint names here. + my $c_name = $c->name; - $c->name( next_unused_name($c_name) ); + # Give the constraint a name if it doesn't have one, so it doesn't feel + # left out + $c_name = $table->name . '_fk' unless length $c_name; - for my $meth (qw/table reference_table/) { - my $table = $schema->get_table($c->$meth) || next; - # This normalizes the types to ENGINE and returns the value if its there - next if $extra_to_options->($table, 'mysql_table_type', ['ENGINE', 'TYPE']); - $table->options( { 'ENGINE' => 'InnoDB' } ); - } - } # foreach constraints + $c->name(next_unused_name($c_name)); - my %map = ( mysql_collate => 'collate', mysql_charset => 'character set'); - foreach my $f ( $table->get_fields ) { - my $extra = $f->extra; - for (keys %map) { - $extra->{$map{$_}} = delete $extra->{$_} if exists $extra->{$_}; - } + for my $meth (qw/table reference_table/) { + my $table = $schema->get_table($c->$meth) || next; - my @size = $f->size; - if ( !$size[0] && $f->data_type =~ /char$/ ) { - $f->size( (255) ); - } - } + # This normalizes the types to ENGINE and returns the value if its there + next + if $extra_to_options->($table, 'mysql_table_type', [ 'ENGINE', 'TYPE' ]); + $table->options({ 'ENGINE' => 'InnoDB' }); + } + } # foreach constraints + + my %map = (mysql_collate => 'collate', mysql_charset => 'character set'); + foreach my $f ($table->get_fields) { + my $extra = $f->extra; + for (keys %map) { + $extra->{ $map{$_} } = delete $extra->{$_} + if exists $extra->{$_}; + } + my @size = $f->size; + if (!$size[0] && $f->data_type =~ /char$/) { + $f->size((255)); + } } + + } } { - my ($quoting_generator, $nonquoting_generator); - sub _generator { - my $options = shift; - return $options->{generator} if exists $options->{generator}; - - return normalize_quote_options($options) - ? $quoting_generator ||= SQL::Translator::Generator::DDL::MySQL->new() - : $nonquoting_generator ||= SQL::Translator::Generator::DDL::MySQL->new( - quote_chars => [], - ); - } + my ($quoting_generator, $nonquoting_generator); + + sub _generator { + my $options = shift; + return $options->{generator} if exists $options->{generator}; + + return normalize_quote_options($options) + ? $quoting_generator ||= SQL::Translator::Generator::DDL::MySQL->new() + : $nonquoting_generator ||= SQL::Translator::Generator::DDL::MySQL->new(quote_chars => [],); + } } sub produce { - my $translator = shift; - local $DEBUG = $translator->debug; - local %used_names; - my $no_comments = $translator->no_comments; - my $add_drop_table = $translator->add_drop_table; - my $schema = $translator->schema; - my $show_warnings = $translator->show_warnings || 0; - my $producer_args = $translator->producer_args; - my $mysql_version = parse_mysql_version ($producer_args->{mysql_version}, 'perl') || 0; - my $max_id_length = $producer_args->{mysql_max_id_length} || $DEFAULT_MAX_ID_LENGTH; - - my $generator = _generator({ quote_identifiers => $translator->quote_identifiers }); - - debug("PKG: Beginning production\n"); - %used_names = (); - my $create = ''; - $create .= header_comment unless ($no_comments); - # \todo Don't set if MySQL 3.x is set on command line - my @create = "SET foreign_key_checks=0"; - - preprocess_schema($schema); + my $translator = shift; + local $DEBUG = $translator->debug; + local %used_names; + my $no_comments = $translator->no_comments; + my $add_drop_table = $translator->add_drop_table; + my $schema = $translator->schema; + my $show_warnings = $translator->show_warnings || 0; + my $producer_args = $translator->producer_args; + my $mysql_version = parse_mysql_version($producer_args->{mysql_version}, 'perl') || 0; + my $max_id_length = $producer_args->{mysql_max_id_length} || $DEFAULT_MAX_ID_LENGTH; - # - # Generate sql - # - my @table_defs =(); - - for my $table ( $schema->get_tables ) { -# print $table->name, "\n"; - push @table_defs, create_table($table, - { add_drop_table => $add_drop_table, - show_warnings => $show_warnings, - no_comments => $no_comments, - generator => $generator, - max_id_length => $max_id_length, - mysql_version => $mysql_version - }); - } + my $generator = _generator({ quote_identifiers => $translator->quote_identifiers }); - if ($mysql_version >= 5.000001) { - for my $view ( $schema->get_views ) { - push @table_defs, create_view($view, - { add_replace_view => $add_drop_table, - show_warnings => $show_warnings, - no_comments => $no_comments, - generator => $generator, - max_id_length => $max_id_length, - mysql_version => $mysql_version - }); - } - } + debug("PKG: Beginning production\n"); + %used_names = (); + my $create = ''; + $create .= header_comment unless ($no_comments); - if ($mysql_version >= 5.000002) { - for my $trigger ( $schema->get_triggers ) { - push @table_defs, create_trigger($trigger, - { add_drop_trigger => $add_drop_table, - show_warnings => $show_warnings, - no_comments => $no_comments, - generator => $generator, - max_id_length => $max_id_length, - mysql_version => $mysql_version - }); - } + # \todo Don't set if MySQL 3.x is set on command line + my @create = "SET foreign_key_checks=0"; + + preprocess_schema($schema); + + # + # Generate sql + # + my @table_defs = (); + + for my $table ($schema->get_tables) { + + # print $table->name, "\n"; + push @table_defs, + create_table( + $table, + { + add_drop_table => $add_drop_table, + show_warnings => $show_warnings, + no_comments => $no_comments, + generator => $generator, + max_id_length => $max_id_length, + mysql_version => $mysql_version + } + ); + } + + if ($mysql_version >= 5.000001) { + for my $view ($schema->get_views) { + push @table_defs, + create_view( + $view, + { + add_replace_view => $add_drop_table, + show_warnings => $show_warnings, + no_comments => $no_comments, + generator => $generator, + max_id_length => $max_id_length, + mysql_version => $mysql_version + } + ); } + } + if ($mysql_version >= 5.000002) { + for my $trigger ($schema->get_triggers) { + push @table_defs, + create_trigger( + $trigger, + { + add_drop_trigger => $add_drop_table, + show_warnings => $show_warnings, + no_comments => $no_comments, + generator => $generator, + max_id_length => $max_id_length, + mysql_version => $mysql_version + } + ); + } + } -# print "@table_defs\n"; - push @table_defs, "SET foreign_key_checks=1"; + # print "@table_defs\n"; + push @table_defs, "SET foreign_key_checks=1"; - return wantarray ? ($create ? $create : (), @create, @table_defs) : ($create . join('', map { $_ ? "$_;\n\n" : () } (@create, @table_defs))); + return wantarray + ? ($create ? $create : (), @create, @table_defs) + : ($create . join('', map { $_ ? "$_;\n\n" : () } (@create, @table_defs))); } sub create_trigger { - my ($trigger, $options) = @_; - my $generator = _generator($options); + my ($trigger, $options) = @_; + my $generator = _generator($options); - my $trigger_name = $trigger->name; - debug("PKG: Looking at trigger '${trigger_name}'\n"); + my $trigger_name = $trigger->name; + debug("PKG: Looking at trigger '${trigger_name}'\n"); - my @statements; + my @statements; - my $events = $trigger->database_events; - for my $event ( @$events ) { - my $name = $trigger_name; - if (@$events > 1) { - $name .= "_$event"; + my $events = $trigger->database_events; + for my $event (@$events) { + my $name = $trigger_name; + if (@$events > 1) { + $name .= "_$event"; - warn "Multiple database events supplied for trigger '${trigger_name}', ", - "creating trigger '${name}' for the '${event}' event\n" - if $options->{show_warnings}; - } + warn + "Multiple database events supplied for trigger '${trigger_name}', ", + "creating trigger '${name}' for the '${event}' event\n" + if $options->{show_warnings}; + } - my $action = $trigger->action; - if($action !~ /^ \s* BEGIN [\s\;] .*? [\s\;] END [\s\;]* $/six) { - $action .= ";" unless $action =~ /;\s*\z/; - $action = "BEGIN $action END"; - } + my $action = $trigger->action; + if ($action !~ /^ \s* BEGIN [\s\;] .*? [\s\;] END [\s\;]* $/six) { + $action .= ";" unless $action =~ /;\s*\z/; + $action = "BEGIN $action END"; + } - push @statements, "DROP TRIGGER IF EXISTS " . $generator->quote($name) if $options->{add_drop_trigger}; - push @statements, sprintf( - "CREATE TRIGGER %s %s %s ON %s\n FOR EACH ROW %s", - $generator->quote($name), $trigger->perform_action_when, $event, - $generator->quote($trigger->on_table), $action, + push @statements, "DROP TRIGGER IF EXISTS " . $generator->quote($name) + if $options->{add_drop_trigger}; + push @statements, + sprintf( + "CREATE TRIGGER %s %s %s ON %s\n FOR EACH ROW %s", + $generator->quote($name), + $trigger->perform_action_when, + $event, $generator->quote($trigger->on_table), $action, ); - } - # Tack the comment onto the first statement - $statements[0] = "--\n-- Trigger " . $generator->quote($trigger_name) . "\n--\n" . $statements[0] unless $options->{no_comments}; - return @statements; + } + + # Tack the comment onto the first statement + $statements[0] = "--\n-- Trigger " . $generator->quote($trigger_name) . "\n--\n" . $statements[0] + unless $options->{no_comments}; + return @statements; } sub create_view { - my ($view, $options) = @_; - my $generator = _generator($options); + my ($view, $options) = @_; + my $generator = _generator($options); - my $view_name = $view->name; - my $view_name_qt = $generator->quote($view_name); + my $view_name = $view->name; + my $view_name_qt = $generator->quote($view_name); - debug("PKG: Looking at view '${view_name}'\n"); + debug("PKG: Looking at view '${view_name}'\n"); - # Header. Should this look like what mysqldump produces? - my $create = ''; - $create .= "--\n-- View: $view_name_qt\n--\n" unless $options->{no_comments}; - $create .= 'CREATE'; - $create .= ' OR REPLACE' if $options->{add_replace_view}; - $create .= "\n"; + # Header. Should this look like what mysqldump produces? + my $create = ''; + $create .= "--\n-- View: $view_name_qt\n--\n" + unless $options->{no_comments}; + $create .= 'CREATE'; + $create .= ' OR REPLACE' if $options->{add_replace_view}; + $create .= "\n"; - my $extra = $view->extra; - # ALGORITHM - if( exists($extra->{mysql_algorithm}) && defined(my $algorithm = $extra->{mysql_algorithm}) ){ - $create .= " ALGORITHM = ${algorithm}\n" if $algorithm =~ /(?:UNDEFINED|MERGE|TEMPTABLE)/i; - } - # DEFINER - if( exists($extra->{mysql_definer}) && defined(my $user = $extra->{mysql_definer}) ){ - $create .= " DEFINER = ${user}\n"; - } - # SECURITY - if( exists($extra->{mysql_security}) && defined(my $security = $extra->{mysql_security}) ){ - $create .= " SQL SECURITY ${security}\n" if $security =~ /(?:DEFINER|INVOKER)/i; - } + my $extra = $view->extra; - #Header, cont. - $create .= " VIEW $view_name_qt"; + # ALGORITHM + if (exists($extra->{mysql_algorithm}) + && defined(my $algorithm = $extra->{mysql_algorithm})) { + $create .= " ALGORITHM = ${algorithm}\n" + if $algorithm =~ /(?:UNDEFINED|MERGE|TEMPTABLE)/i; + } - if( my @fields = $view->fields ){ - my $list = join ', ', map { $generator->quote($_) } @fields; - $create .= " ( ${list} )"; - } - if( my $sql = $view->sql ){ - # do not wrap parenthesis around the selector, mysql doesn't like this - # http://bugs.mysql.com/bug.php?id=9198 - $create .= " AS\n ${sql}\n"; - } -# $create .= ""; - return $create; + # DEFINER + if (exists($extra->{mysql_definer}) + && defined(my $user = $extra->{mysql_definer})) { + $create .= " DEFINER = ${user}\n"; + } + + # SECURITY + if (exists($extra->{mysql_security}) + && defined(my $security = $extra->{mysql_security})) { + $create .= " SQL SECURITY ${security}\n" + if $security =~ /(?:DEFINER|INVOKER)/i; + } + + #Header, cont. + $create .= " VIEW $view_name_qt"; + + if (my @fields = $view->fields) { + my $list = join ', ', map { $generator->quote($_) } @fields; + $create .= " ( ${list} )"; + } + if (my $sql = $view->sql) { + + # do not wrap parenthesis around the selector, mysql doesn't like this + # http://bugs.mysql.com/bug.php?id=9198 + $create .= " AS\n ${sql}\n"; + } + + # $create .= ""; + return $create; } -sub create_table -{ - my ($table, $options) = @_; - my $generator = _generator($options); +sub create_table { + my ($table, $options) = @_; + my $generator = _generator($options); - my $table_name = $generator->quote($table->name); - debug("PKG: Looking at table '$table_name'\n"); + my $table_name = $generator->quote($table->name); + debug("PKG: Looking at table '$table_name'\n"); - # - # Header. Should this look like what mysqldump produces? - # - my $create = ''; - my $drop; - $create .= "--\n-- Table: $table_name\n--\n" unless $options->{no_comments}; - $drop = qq[DROP TABLE IF EXISTS $table_name] if $options->{add_drop_table}; - $create .= "CREATE TABLE $table_name (\n"; + # + # Header. Should this look like what mysqldump produces? + # + my $create = ''; + my $drop; + $create .= "--\n-- Table: $table_name\n--\n" unless $options->{no_comments}; + $drop = qq[DROP TABLE IF EXISTS $table_name] if $options->{add_drop_table}; + $create .= "CREATE TABLE $table_name (\n"; - # - # Fields - # - my @field_defs; - for my $field ( $table->get_fields ) { - push @field_defs, create_field($field, $options); - } + # + # Fields + # + my @field_defs; + for my $field ($table->get_fields) { + push @field_defs, create_field($field, $options); + } - # - # Indices - # - my @index_defs; - my %indexed_fields; - for my $index ( $table->get_indices ) { - push @index_defs, create_index($index, $options); - $indexed_fields{ $_ } = 1 for $index->fields; - } + # + # Indices + # + my @index_defs; + my %indexed_fields; + for my $index ($table->get_indices) { + push @index_defs, create_index($index, $options); + $indexed_fields{$_} = 1 for $index->fields; + } - # - # Constraints -- need to handle more than just FK. -ky - # - my @constraint_defs; - my @constraints = $table->get_constraints; - for my $c ( @constraints ) { - my $constr = create_constraint($c, $options); - push @constraint_defs, $constr if($constr); - - unless ( $indexed_fields{ ($c->fields())[0] } || $c->type ne FOREIGN_KEY ) { - push @index_defs, "INDEX (" . $generator->quote(($c->fields())[0]) . ")"; - $indexed_fields{ ($c->fields())[0] } = 1; - } + # + # Constraints -- need to handle more than just FK. -ky + # + my @constraint_defs; + my @constraints = $table->get_constraints; + for my $c (@constraints) { + my $constr = create_constraint($c, $options); + push @constraint_defs, $constr if ($constr); + + unless ($indexed_fields{ ($c->fields())[0] } + || $c->type ne FOREIGN_KEY) { + push @index_defs, "INDEX (" . $generator->quote(($c->fields())[0]) . ")"; + $indexed_fields{ ($c->fields())[0] } = 1; } + } - $create .= join(",\n", map { " $_" } - @field_defs, @index_defs, @constraint_defs - ); + $create .= join(",\n", map {" $_"} @field_defs, @index_defs, @constraint_defs); - # - # Footer - # - $create .= "\n)"; - $create .= generate_table_options($table, $options) || ''; -# $create .= ";\n\n"; + # + # Footer + # + $create .= "\n)"; + $create .= generate_table_options($table, $options) || ''; + + # $create .= ";\n\n"; - return $drop ? ($drop,$create) : $create; + return $drop ? ($drop, $create) : $create; } -sub generate_table_options -{ +sub generate_table_options { my ($table, $options) = @_; my $create; my $table_type_defined = 0; - my $generator = _generator($options); - my $charset = $table->extra('mysql_charset'); - my $collate = $table->extra('mysql_collate'); - my $union = undef; - for my $t1_option_ref ( $table->options ) { - my($key, $value) = %{$t1_option_ref}; + my $generator = _generator($options); + my $charset = $table->extra('mysql_charset'); + my $collate = $table->extra('mysql_collate'); + my $union = undef; + for my $t1_option_ref ($table->options) { + my ($key, $value) = %{$t1_option_ref}; $table_type_defined = 1 - if uc $key eq 'ENGINE' or uc $key eq 'TYPE'; + if uc $key eq 'ENGINE' + or uc $key eq 'TYPE'; if (uc $key eq 'CHARACTER SET') { $charset = $value; next; @@ -513,391 +545,326 @@ sub generate_table_options my $mysql_table_type = $table->extra('mysql_table_type'); $create .= " ENGINE=$mysql_table_type" - if $mysql_table_type && !$table_type_defined; - my $comments = $table->comments; + if $mysql_table_type && !$table_type_defined; + my $comments = $table->comments; $create .= " DEFAULT CHARACTER SET $charset" if $charset; - $create .= " COLLATE $collate" if $collate; - $create .= " UNION=$union" if $union; - $create .= qq[ comment='$comments'] if $comments; + $create .= " COLLATE $collate" if $collate; + $create .= " UNION=$union" if $union; + $create .= qq[ comment='$comments'] if $comments; return $create; } -sub create_field -{ - my ($field, $options) = @_; +sub create_field { + my ($field, $options) = @_; - my $generator = _generator($options); + my $generator = _generator($options); - my $field_name = $field->name; - debug("PKG: Looking at field '$field_name'\n"); - my $field_def = $generator->quote($field_name); + my $field_name = $field->name; + debug("PKG: Looking at field '$field_name'\n"); + my $field_def = $generator->quote($field_name); - # data type and size - my $data_type = $field->data_type; - my @size = $field->size; - my %extra = $field->extra; - my $list = $extra{'list'} || []; - my $commalist = join( ', ', map { __PACKAGE__->_quote_string($_) } @$list ); - my $charset = $extra{'mysql_charset'}; - my $collate = $extra{'mysql_collate'}; + # data type and size + my $data_type = $field->data_type; + my @size = $field->size; + my %extra = $field->extra; + my $list = $extra{'list'} || []; + my $commalist = join(', ', map { __PACKAGE__->_quote_string($_) } @$list); + my $charset = $extra{'mysql_charset'}; + my $collate = $extra{'mysql_collate'}; - my $mysql_version = $options->{mysql_version} || 0; - # - # Oracle "number" type -- figure best MySQL type - # - if ( lc $data_type eq 'number' ) { - # not an integer - if ( scalar @size > 1 ) { - $data_type = 'double'; - } - elsif ( $size[0] && $size[0] >= 12 ) { - $data_type = 'bigint'; - } - elsif ( $size[0] && $size[0] <= 1 ) { - $data_type = 'tinyint'; - } - else { - $data_type = 'int'; - } - } - # - # Convert a large Oracle varchar to "text" - # (not necessary as of 5.0.3 http://dev.mysql.com/doc/refman/5.0/en/char.html) - # - elsif ( $data_type =~ /char/i && $size[0] > 255 ) { - unless ($size[0] <= 65535 && $mysql_version >= 5.000003 ) { - $data_type = 'text'; - @size = (); - } - } - elsif ( $data_type =~ /boolean/i ) { - if ($mysql_version >= 4) { - $data_type = 'boolean'; - } else { - $data_type = 'enum'; - $commalist = "'0','1'"; - } - } - elsif ( exists $translate{ lc $data_type } ) { - $data_type = $translate{ lc $data_type }; + my $mysql_version = $options->{mysql_version} || 0; + # + # Oracle "number" type -- figure best MySQL type + # + if (lc $data_type eq 'number') { + + # not an integer + if (scalar @size > 1) { + $data_type = 'double'; + } elsif ($size[0] && $size[0] >= 12) { + $data_type = 'bigint'; + } elsif ($size[0] && $size[0] <= 1) { + $data_type = 'tinyint'; + } else { + $data_type = 'int'; } + } + # + # Convert a large Oracle varchar to "text" + # (not necessary as of 5.0.3 http://dev.mysql.com/doc/refman/5.0/en/char.html) + # + elsif ($data_type =~ /char/i && $size[0] > 255) { + unless ($size[0] <= 65535 && $mysql_version >= 5.000003) { + $data_type = 'text'; + @size = (); + } + } elsif ($data_type =~ /boolean/i) { + if ($mysql_version >= 4) { + $data_type = 'boolean'; + } else { + $data_type = 'enum'; + $commalist = "'0','1'"; + } + } elsif (exists $translate{ lc $data_type }) { + $data_type = $translate{ lc $data_type }; + } - @size = () if $data_type =~ /(text|blob)/i; + @size = () if $data_type =~ /(text|blob)/i; - if ( $data_type =~ /(double|float)/ && scalar @size == 1 ) { - push @size, '0'; - } + if ($data_type =~ /(double|float)/ && scalar @size == 1) { + push @size, '0'; + } - $field_def .= " $data_type"; + $field_def .= " $data_type"; - if ( lc($data_type) eq 'enum' || lc($data_type) eq 'set') { - $field_def .= '(' . $commalist . ')'; - } - elsif ( - defined $size[0] && $size[0] > 0 - && - ! grep lc($data_type) eq $_, @no_length_attr - ) { - $field_def .= '(' . join( ', ', @size ) . ')'; - } + if (lc($data_type) eq 'enum' || lc($data_type) eq 'set') { + $field_def .= '(' . $commalist . ')'; + } elsif (defined $size[0] && $size[0] > 0 && !grep lc($data_type) eq $_, @no_length_attr) { + $field_def .= '(' . join(', ', @size) . ')'; + } - # char sets - $field_def .= " CHARACTER SET $charset" if $charset; - $field_def .= " COLLATE $collate" if $collate; + # char sets + $field_def .= " CHARACTER SET $charset" if $charset; + $field_def .= " COLLATE $collate" if $collate; - # MySQL qualifiers - for my $qual ( qw[ binary unsigned zerofill ] ) { - my $val = $extra{ $qual } || $extra{ uc $qual } or next; - $field_def .= " $qual"; - } - for my $qual ( 'character set', 'collate', 'on update' ) { - my $val = $extra{ $qual } || $extra{ uc $qual } or next; - if ( ref $val ) { - $field_def .= " $qual ${$val}"; - } - else { - $field_def .= " $qual $val"; - } + # MySQL qualifiers + for my $qual (qw[ binary unsigned zerofill ]) { + my $val = $extra{$qual} || $extra{ uc $qual } or next; + $field_def .= " $qual"; + } + for my $qual ('character set', 'collate', 'on update') { + my $val = $extra{$qual} || $extra{ uc $qual } or next; + if (ref $val) { + $field_def .= " $qual ${$val}"; + } else { + $field_def .= " $qual $val"; } + } - # Null? - if ( $field->is_nullable ) { - $field_def .= ' NULL'; - } - else { - $field_def .= ' NOT NULL'; - } + # Null? + if ($field->is_nullable) { + $field_def .= ' NULL'; + } else { + $field_def .= ' NOT NULL'; + } - # Default? - __PACKAGE__->_apply_default_value( - $field, - \$field_def, - [ - 'NULL' => \'NULL', - ], - ); - - if ( my $comments = $field->comments ) { - $comments = __PACKAGE__->_quote_string($comments); - $field_def .= qq[ comment $comments]; - } + # Default? + __PACKAGE__->_apply_default_value( + $field, + \$field_def, + [ + 'NULL' => \'NULL', + ], + ); + + if (my $comments = $field->comments) { + $comments = __PACKAGE__->_quote_string($comments); + $field_def .= qq[ comment $comments]; + } - # auto_increment? - $field_def .= " auto_increment" if $field->is_auto_increment; + # auto_increment? + $field_def .= " auto_increment" if $field->is_auto_increment; - return $field_def; + return $field_def; } sub _quote_string { - my ($self, $string) = @_; + my ($self, $string) = @_; - $string =~ s/([\\'])/$1$1/g; - return qq{'$string'}; + $string =~ s/([\\'])/$1$1/g; + return qq{'$string'}; } -sub alter_create_index -{ - my ($index, $options) = @_; - - my $table_name = _generator($options)->quote($index->table->name); - return join( ' ', - 'ALTER TABLE', - $table_name, - 'ADD', - create_index(@_) - ); +sub alter_create_index { + my ($index, $options) = @_; + + my $table_name = _generator($options)->quote($index->table->name); + return join(' ', 'ALTER TABLE', $table_name, 'ADD', create_index(@_)); } -sub create_index -{ - my ( $index, $options ) = @_; - my $generator = _generator($options); - - my @fields; - for my $field ($index->fields) { - my $name = $generator->quote($field->name); - if (my $len = $field->extra->{prefix_length}) { - $name .= "($len)"; - } - push @fields, $name; +sub create_index { + my ($index, $options) = @_; + my $generator = _generator($options); + my @fields; + for my $field ($index->fields) { + my $name = $generator->quote($field->name); + if (my $len = $field->extra->{prefix_length}) { + $name .= "($len)"; } - return join( - ' ', - map { $_ || () } - lc $index->type eq 'normal' ? 'INDEX' : $index->type . ' INDEX', - $index->name - ? $generator->quote(truncate_id_uniquely( - $index->name, - $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH - )) - : '', - '(' . join( ', ', @fields) . ')' - ); + push @fields, $name; + + } + return join(' ', + map { $_ || () } lc $index->type eq 'normal' ? 'INDEX' : $index->type . ' INDEX', + $index->name + ? $generator->quote(truncate_id_uniquely($index->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH)) + : '', + '(' . join(', ', @fields) . ')'); } -sub alter_drop_index -{ - my ($index, $options) = @_; +sub alter_drop_index { + my ($index, $options) = @_; - my $table_name = _generator($options)->quote($index->table->name); + my $table_name = _generator($options)->quote($index->table->name); - return join( ' ', - 'ALTER TABLE', - $table_name, - 'DROP', - 'INDEX', - $index->name || $index->fields - ); + return join(' ', 'ALTER TABLE', $table_name, 'DROP', 'INDEX', $index->name || $index->fields); } -sub alter_drop_constraint -{ - my ($c, $options) = @_; - - my $generator = _generator($options); - my $table_name = $generator->quote($c->table->name); +sub alter_drop_constraint { + my ($c, $options) = @_; - my @out = ('ALTER','TABLE',$table_name,'DROP'); - if($c->type eq PRIMARY_KEY) { - push @out, $c->type; - } - else { - push @out, ($c->type eq FOREIGN_KEY ? $c->type : "CONSTRAINT"), - $generator->quote($c->name); - } - return join(' ',@out); -} + my $generator = _generator($options); + my $table_name = $generator->quote($c->table->name); -sub alter_create_constraint -{ - my ($index, $options) = @_; - - my $table_name = _generator($options)->quote($index->table->name); - return join( ' ', - 'ALTER TABLE', - $table_name, - 'ADD', - create_constraint(@_) ); + my @out = ('ALTER', 'TABLE', $table_name, 'DROP'); + if ($c->type eq PRIMARY_KEY) { + push @out, $c->type; + } else { + push @out, ($c->type eq FOREIGN_KEY ? $c->type : "CONSTRAINT"), $generator->quote($c->name); + } + return join(' ', @out); } -sub create_constraint -{ - my ($c, $options) = @_; - - my $generator = _generator($options); - my $leave_name = $options->{leave_name} || undef; +sub alter_create_constraint { + my ($index, $options) = @_; - my $reference_table_name = $generator->quote($c->reference_table); - - my @fields = $c->fields; + my $table_name = _generator($options)->quote($index->table->name); + return join(' ', 'ALTER TABLE', $table_name, 'ADD', create_constraint(@_)); +} - if ( $c->type eq PRIMARY_KEY ) { - return unless @fields; - return 'PRIMARY KEY (' . join(", ", map { $generator->quote($_) } @fields) . ')'; - } - elsif ( $c->type eq UNIQUE ) { - return unless @fields; - return sprintf 'UNIQUE %s(%s)', - ((defined $c->name && $c->name) - ? $generator->quote( - truncate_id_uniquely( $c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH ), - ) . ' ' - : '' - ), - ( join ', ', map { $generator->quote($_) } @fields ), +sub create_constraint { + my ($c, $options) = @_; + + my $generator = _generator($options); + my $leave_name = $options->{leave_name} || undef; + + my $reference_table_name = $generator->quote($c->reference_table); + + my @fields = $c->fields; + + if ($c->type eq PRIMARY_KEY) { + return unless @fields; + return 'PRIMARY KEY (' . join(", ", map { $generator->quote($_) } @fields) . ')'; + } elsif ($c->type eq UNIQUE) { + return unless @fields; + return sprintf 'UNIQUE %s(%s)', + ( + (defined $c->name && $c->name) + ? $generator->quote(truncate_id_uniquely($c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH),) + . ' ' + : '' + ), + (join ', ', map { $generator->quote($_) } @fields), ; - } - elsif ( $c->type eq FOREIGN_KEY ) { - return unless @fields; - # - # Make sure FK field is indexed or MySQL complains. - # - - my $table = $c->table; - my $c_name = truncate_id_uniquely( $c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH ); - - my $def = join(' ', - 'CONSTRAINT', - ($c_name ? $generator->quote($c_name) : () ), - 'FOREIGN KEY' - ); + } elsif ($c->type eq FOREIGN_KEY) { + return unless @fields; + # + # Make sure FK field is indexed or MySQL complains. + # + my $table = $c->table; + my $c_name = truncate_id_uniquely($c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH); - $def .= ' ('. join( ', ', map { $generator->quote($_) } @fields ) . ')'; + my $def = join(' ', 'CONSTRAINT', ($c_name ? $generator->quote($c_name) : ()), 'FOREIGN KEY'); - $def .= ' REFERENCES ' . $reference_table_name; + $def .= ' (' . join(', ', map { $generator->quote($_) } @fields) . ')'; - my @rfields = map { $_ || () } $c->reference_fields; - unless ( @rfields ) { - my $rtable_name = $c->reference_table; - if ( my $ref_table = $table->schema->get_table( $rtable_name ) ) { - push @rfields, $ref_table->primary_key; - } - else { - warn "Can't find reference table '$rtable_name' " . - "in schema\n" if $options->{show_warnings}; - } - } + $def .= ' REFERENCES ' . $reference_table_name; - if ( @rfields ) { - $def .= ' (' . join( ', ', map { $generator->quote($_) } @rfields ) . ')'; - } - else { - warn "FK constraint on " . $table->name . '.' . - join('', @fields) . " has no reference fields\n" - if $options->{show_warnings}; - } + my @rfields = map { $_ || () } $c->reference_fields; + unless (@rfields) { + my $rtable_name = $c->reference_table; + if (my $ref_table = $table->schema->get_table($rtable_name)) { + push @rfields, $ref_table->primary_key; + } else { + warn "Can't find reference table '$rtable_name' " . "in schema\n" + if $options->{show_warnings}; + } + } - if ( $c->match_type ) { - $def .= ' MATCH ' . - ( $c->match_type =~ /full/i ) ? 'FULL' : 'PARTIAL'; - } + if (@rfields) { + $def .= ' (' . join(', ', map { $generator->quote($_) } @rfields) . ')'; + } else { + warn "FK constraint on " . $table->name . '.' . join('', @fields) . " has no reference fields\n" + if $options->{show_warnings}; + } - if ( $c->on_delete ) { - $def .= ' ON DELETE '. $c->on_delete; - } + if ($c->match_type) { + $def .= ' MATCH ' . ($c->match_type =~ /full/i) ? 'FULL' : 'PARTIAL'; + } - if ( $c->on_update ) { - $def .= ' ON UPDATE '. $c->on_update; - } - return $def; + if ($c->on_delete) { + $def .= ' ON DELETE ' . $c->on_delete; } - elsif ( $c->type eq CHECK_C ) { - my $table = $c->table; - my $c_name = truncate_id_uniquely( $c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH ); - my $def = join(' ', - 'CONSTRAINT', - ($c_name ? $generator->quote($c_name) : () ), - 'CHECK' - ); + if ($c->on_update) { + $def .= ' ON UPDATE ' . $c->on_update; + } + return $def; + } elsif ($c->type eq CHECK_C) { + my $table = $c->table; + my $c_name = truncate_id_uniquely($c->name, $options->{max_id_length} || $DEFAULT_MAX_ID_LENGTH); + my $def = join(' ', 'CONSTRAINT', ($c_name ? $generator->quote($c_name) : ()), 'CHECK'); - $def .= ' ('. $c->expression . ')'; - return $def; - } + $def .= ' (' . $c->expression . ')'; + return $def; + } - return undef; + return undef; } -sub alter_table -{ - my ($to_table, $options) = @_; +sub alter_table { + my ($to_table, $options) = @_; - my $table_options = generate_table_options($to_table, $options) || ''; - my $table_name = _generator($options)->quote($to_table->name); - my $out = sprintf('ALTER TABLE %s%s', - $table_name, - $table_options); + my $table_options = generate_table_options($to_table, $options) || ''; + my $table_name = _generator($options)->quote($to_table->name); + my $out = sprintf('ALTER TABLE %s%s', $table_name, $table_options); - return $out; + return $out; } sub rename_field { alter_field(@_) } -sub alter_field -{ - my ($from_field, $to_field, $options) = @_; - my $generator = _generator($options); - my $table_name = $generator->quote($to_field->table->name); +sub alter_field { + my ($from_field, $to_field, $options) = @_; - my $out = sprintf('ALTER TABLE %s CHANGE COLUMN %s %s', - $table_name, - $generator->quote($from_field->name), - create_field($to_field, $options)); + my $generator = _generator($options); + my $table_name = $generator->quote($to_field->table->name); - return $out; + my $out = sprintf( + 'ALTER TABLE %s CHANGE COLUMN %s %s', + $table_name, + $generator->quote($from_field->name), + create_field($to_field, $options) + ); + + return $out; } -sub add_field -{ - my ($new_field, $options) = @_; +sub add_field { + my ($new_field, $options) = @_; - my $table_name = _generator($options)->quote($new_field->table->name); + my $table_name = _generator($options)->quote($new_field->table->name); - my $out = sprintf('ALTER TABLE %s ADD COLUMN %s', - $table_name, - create_field($new_field, $options)); + my $out = sprintf('ALTER TABLE %s ADD COLUMN %s', $table_name, create_field($new_field, $options)); - return $out; + return $out; } -sub drop_field -{ - my ($old_field, $options) = @_; +sub drop_field { + my ($old_field, $options) = @_; - my $generator = _generator($options); - my $table_name = $generator->quote($old_field->table->name); + my $generator = _generator($options); + my $table_name = $generator->quote($old_field->table->name); - my $out = sprintf('ALTER TABLE %s DROP COLUMN %s', - $table_name, - $generator->quote($old_field->name)); + my $out = sprintf('ALTER TABLE %s DROP COLUMN %s', $table_name, $generator->quote($old_field->name)); - return $out; + return $out; } @@ -910,24 +877,22 @@ sub batch_alter_table { # We have to work round this. my %fks_to_alter; - my %fks_to_drop = map { - $_->type eq FOREIGN_KEY - ? ( $_->name => $_ ) - : ( ) - } @{$diff_hash->{alter_drop_constraint} }; + my %fks_to_drop = map { $_->type eq FOREIGN_KEY ? ($_->name => $_) : () } @{ $diff_hash->{alter_drop_constraint} }; my %fks_to_create = map { - if ( $_->type eq FOREIGN_KEY) { - $fks_to_alter{$_->name} = $fks_to_drop{$_->name} if $fks_to_drop{$_->name}; - ( $_->name => $_ ); - } else { ( ) } - } @{$diff_hash->{alter_create_constraint} }; + if ($_->type eq FOREIGN_KEY) { + $fks_to_alter{ $_->name } = $fks_to_drop{ $_->name } + if $fks_to_drop{ $_->name }; + ($_->name => $_); + } else { + () + } + } @{ $diff_hash->{alter_create_constraint} }; my @drop_stmt; if (scalar keys %fks_to_alter) { - $diff_hash->{alter_drop_constraint} = [ - grep { !$fks_to_alter{$_->name} } @{ $diff_hash->{alter_drop_constraint} } - ]; + $diff_hash->{alter_drop_constraint} + = [ grep { !$fks_to_alter{ $_->name } } @{ $diff_hash->{alter_drop_constraint} } ]; @drop_stmt = batch_alter_table($table, { alter_drop_constraint => [ values %fks_to_alter ] }, $options); @@ -941,26 +906,28 @@ sub batch_alter_table { # rename_table makes things a bit more complex my $renamed_from = ""; $renamed_from = $generator->quote($diff_hash->{rename_table}[0][0]->name) - if $diff_hash->{rename_table} && @{$diff_hash->{rename_table}}; + if $diff_hash->{rename_table} && @{ $diff_hash->{rename_table} }; return unless @stmts; + # Just zero or one stmts. return now - return (@drop_stmt,@stmts) unless @stmts > 1; + return (@drop_stmt, @stmts) unless @stmts > 1; # Now strip off the 'ALTER TABLE xyz' of all but the first one my $table_name = $generator->quote($table->name); - my $re = $renamed_from - ? qr/^ALTER TABLE (?:\Q$table_name\E|\Q$renamed_from\E) / - : qr/^ALTER TABLE \Q$table_name\E /; + my $re + = $renamed_from + ? qr/^ALTER TABLE (?:\Q$table_name\E|\Q$renamed_from\E) / + : qr/^ALTER TABLE \Q$table_name\E /; - my $first = shift @stmts; + my $first = shift @stmts; my ($alter_table) = $first =~ /($re)/; my $padd = " " x length($alter_table); - return @drop_stmt, join( ",\n", $first, map { s/$re//; $padd . $_ } @stmts); + return @drop_stmt, join(",\n", $first, map { s/$re//; $padd . $_ } @stmts); } @@ -970,7 +937,11 @@ sub drop_table { return ( # Drop (foreign key) constraints so table drops cleanly batch_alter_table( - $table, { alter_drop_constraint => [ grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints ] }, $options + $table, + { + alter_drop_constraint => [ grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints ] + }, + $options ), 'DROP TABLE ' . _generator($options)->quote($table), ); @@ -987,14 +958,14 @@ sub rename_table { } sub next_unused_name { - my $name = shift || ''; - if ( !defined($used_names{$name}) ) { + my $name = shift || ''; + if (!defined($used_names{$name})) { $used_names{$name} = $name; return $name; } my $i = 1; - while ( defined($used_names{$name . '_' . $i}) ) { + while (defined($used_names{ $name . '_' . $i })) { ++$i; } $name .= '_' . $i; diff --git a/lib/SQL/Translator/Producer/Oracle.pm b/lib/SQL/Translator/Producer/Oracle.pm index 53e454a22..c2a23047e 100644 --- a/lib/SQL/Translator/Producer/Oracle.pm +++ b/lib/SQL/Translator/Producer/Oracle.pm @@ -89,78 +89,78 @@ context the slash will be still there to ensure compatibility with SQLPlus. use strict; use warnings; -our ( $DEBUG, $WARN ); +our ($DEBUG, $WARN); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use base 'SQL::Translator::Producer'; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(debug header_comment); use Data::Dumper; -my %translate = ( - # - # MySQL types - # - bigint => 'number', - double => 'float', - decimal => 'number', - float => 'float', - int => 'number', - integer => 'number', - mediumint => 'number', - smallint => 'number', - tinyint => 'number', - char => 'char', - varchar => 'varchar2', - tinyblob => 'blob', - blob => 'blob', - mediumblob => 'blob', - longblob => 'blob', - tinytext => 'varchar2', - text => 'clob', - longtext => 'clob', - mediumtext => 'clob', - enum => 'varchar2', - set => 'varchar2', - date => 'date', - datetime => 'date', - time => 'date', - timestamp => 'date', - year => 'date', - - # - # PostgreSQL types - # - numeric => 'number', - 'double precision' => 'number', - serial => 'number', - bigserial => 'number', - money => 'number', - character => 'char', - 'character varying' => 'varchar2', - bytea => 'BLOB', - interval => 'number', - boolean => 'number', - point => 'number', - line => 'number', - lseg => 'number', - box => 'number', - path => 'number', - polygon => 'number', - circle => 'number', - cidr => 'number', - inet => 'varchar2', - macaddr => 'varchar2', - bit => 'number', - 'bit varying' => 'number', - - # - # Oracle types - # - number => 'number', - varchar2 => 'varchar2', - long => 'clob', +my %translate = ( + # + # MySQL types + # + bigint => 'number', + double => 'float', + decimal => 'number', + float => 'float', + int => 'number', + integer => 'number', + mediumint => 'number', + smallint => 'number', + tinyint => 'number', + char => 'char', + varchar => 'varchar2', + tinyblob => 'blob', + blob => 'blob', + mediumblob => 'blob', + longblob => 'blob', + tinytext => 'varchar2', + text => 'clob', + longtext => 'clob', + mediumtext => 'clob', + enum => 'varchar2', + set => 'varchar2', + date => 'date', + datetime => 'date', + time => 'date', + timestamp => 'date', + year => 'date', + + # + # PostgreSQL types + # + numeric => 'number', + 'double precision' => 'number', + serial => 'number', + bigserial => 'number', + money => 'number', + character => 'char', + 'character varying' => 'varchar2', + bytea => 'BLOB', + interval => 'number', + boolean => 'number', + point => 'number', + line => 'number', + lseg => 'number', + box => 'number', + path => 'number', + polygon => 'number', + circle => 'number', + cidr => 'number', + inet => 'varchar2', + macaddr => 'varchar2', + bit => 'number', + 'bit varying' => 'number', + + # + # Oracle types + # + number => 'number', + varchar2 => 'varchar2', + long => 'clob', ); # @@ -168,14 +168,14 @@ my %translate = ( # http://www.ss64.com/orasyntax/datatypes.html # my %max_size = ( - char => 2000, - float => 126, - nchar => 2000, - nvarchar2 => 4000, - number => [ 38, 127 ], - raw => 2000, - varchar => 4000, # only synonym for varchar2 - varchar2 => 4000, + char => 2000, + float => 126, + nchar => 2000, + nvarchar2 => 4000, + number => [ 38, 127 ], + raw => 2000, + varchar => 4000, # only synonym for varchar2 + varchar2 => 4000, ); my $max_id_length = 30; @@ -184,691 +184,671 @@ my %global_names; my %truncated; # Quote used to escape table, field, sequence and trigger names -my $quote_char = '"'; +my $quote_char = '"'; sub produce { - my $translator = shift; - $DEBUG = $translator->debug; - $WARN = $translator->show_warnings || 0; - my $no_comments = $translator->no_comments; - my $add_drop_table = $translator->add_drop_table; - my $schema = $translator->schema; - my $oracle_version = $translator->producer_args->{oracle_version} || 0; - my $delay_constraints = $translator->producer_args->{delay_constraints}; - my ($output, $create, @table_defs, @fk_defs, @trigger_defs, @index_defs, @constraint_defs); - - debug("ORA: Beginning production"); - $create .= header_comment unless ($no_comments); - my $qt = 1 if $translator->quote_table_names; - my $qf = 1 if $translator->quote_field_names; - - if ( $translator->parser_type =~ /mysql/i ) { - $create .= - "-- We assume that default NLS_DATE_FORMAT has been changed\n". - "-- but we set it here anyway to be self-consistent.\n" - unless $no_comments; - - $create .= - "ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';\n\n"; - } - - for my $table ( $schema->get_tables ) { - debug("ORA: Producing for table " . $table->name); - my ( $table_def, $fk_def, $trigger_def, $index_def, $constraint_def ) = create_table( - $table, - { - add_drop_table => $add_drop_table, - show_warnings => $WARN, - no_comments => $no_comments, - delay_constraints => $delay_constraints, - quote_table_names => $qt, - quote_field_names => $qf, - } - ); - push @table_defs, @$table_def; - push @fk_defs, @$fk_def; - push @trigger_defs, @$trigger_def; - push @index_defs, @$index_def; - push @constraint_defs, @$constraint_def; - } - - my (@view_defs); - foreach my $view ( $schema->get_views ) { - my ( $view_def ) = create_view( - $view, - { - add_drop_view => $add_drop_table, - quote_table_names => $qt, - } - ); - push @view_defs, @$view_def; - } - - if (wantarray) { - return defined $create ? $create : (), @table_defs, @view_defs, @fk_defs, @trigger_defs, @index_defs, @constraint_defs; - } - else { - $create .= join (";\n\n", @table_defs, @view_defs, @fk_defs, @index_defs, @constraint_defs); - $create .= ";\n\n"; - # If wantarray is not set we have to add "/" in this statement - # DBI->do() needs them omitted - # triggers may NOT end with a semicolon but a "/" instead - $create .= "$_/\n\n" - for @trigger_defs; - return $create; - } + my $translator = shift; + $DEBUG = $translator->debug; + $WARN = $translator->show_warnings || 0; + my $no_comments = $translator->no_comments; + my $add_drop_table = $translator->add_drop_table; + my $schema = $translator->schema; + my $oracle_version = $translator->producer_args->{oracle_version} || 0; + my $delay_constraints = $translator->producer_args->{delay_constraints}; + my ($output, $create, @table_defs, @fk_defs, @trigger_defs, @index_defs, @constraint_defs); + + debug("ORA: Beginning production"); + $create .= header_comment unless ($no_comments); + my $qt = 1 if $translator->quote_table_names; + my $qf = 1 if $translator->quote_field_names; + + if ($translator->parser_type =~ /mysql/i) { + $create + .= "-- We assume that default NLS_DATE_FORMAT has been changed\n" + . "-- but we set it here anyway to be self-consistent.\n" + unless $no_comments; + + $create .= "ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS';\n\n"; + } + + for my $table ($schema->get_tables) { + debug("ORA: Producing for table " . $table->name); + my ($table_def, $fk_def, $trigger_def, $index_def, $constraint_def) = create_table( + $table, + { + add_drop_table => $add_drop_table, + show_warnings => $WARN, + no_comments => $no_comments, + delay_constraints => $delay_constraints, + quote_table_names => $qt, + quote_field_names => $qf, + } + ); + push @table_defs, @$table_def; + push @fk_defs, @$fk_def; + push @trigger_defs, @$trigger_def; + push @index_defs, @$index_def; + push @constraint_defs, @$constraint_def; + } + + my (@view_defs); + foreach my $view ($schema->get_views) { + my ($view_def) = create_view( + $view, + { + add_drop_view => $add_drop_table, + quote_table_names => $qt, + } + ); + push @view_defs, @$view_def; + } + + if (wantarray) { + return defined $create ? $create : (), @table_defs, @view_defs, + @fk_defs, @trigger_defs, @index_defs, @constraint_defs; + } else { + $create .= join(";\n\n", @table_defs, @view_defs, @fk_defs, @index_defs, @constraint_defs); + $create .= ";\n\n"; + + # If wantarray is not set we have to add "/" in this statement + # DBI->do() needs them omitted + # triggers may NOT end with a semicolon but a "/" instead + $create .= "$_/\n\n" for @trigger_defs; + return $create; + } } sub create_table { - my ($table, $options) = @_; - my $qt = $options->{quote_table_names}; - my $qf = $options->{quote_field_names}; - my $table_name = $table->name; - my $table_name_q = quote($table_name,$qt); - - my $item = ''; - my $drop; - my (@create, @field_defs, @constraint_defs, @fk_defs, @trigger_defs); - - push @create, "--\n-- Table: $table_name\n--" unless $options->{no_comments}; - push @create, qq[DROP TABLE $table_name_q CASCADE CONSTRAINTS] if $options->{add_drop_table}; - - my ( %field_name_scope, @field_comments ); - for my $field ( $table->get_fields ) { - debug("ORA: Creating field " . $field->name . "(" . $field->data_type . ")"); - my ($field_create, $field_defs, $trigger_defs, $field_comments) = - create_field($field, $options, \%field_name_scope); - push @create, @$field_create if ref $field_create; - push @field_defs, @$field_defs if ref $field_defs; - push @trigger_defs, @$trigger_defs if ref $trigger_defs; - push @field_comments, @$field_comments if ref $field_comments; + my ($table, $options) = @_; + my $qt = $options->{quote_table_names}; + my $qf = $options->{quote_field_names}; + my $table_name = $table->name; + my $table_name_q = quote($table_name, $qt); + + my $item = ''; + my $drop; + my (@create, @field_defs, @constraint_defs, @fk_defs, @trigger_defs); + + push @create, "--\n-- Table: $table_name\n--" + unless $options->{no_comments}; + push @create, qq[DROP TABLE $table_name_q CASCADE CONSTRAINTS] + if $options->{add_drop_table}; + + my (%field_name_scope, @field_comments); + for my $field ($table->get_fields) { + debug("ORA: Creating field " . $field->name . "(" . $field->data_type . ")"); + my ($field_create, $field_defs, $trigger_defs, $field_comments) + = create_field($field, $options, \%field_name_scope); + push @create, @$field_create if ref $field_create; + push @field_defs, @$field_defs if ref $field_defs; + push @trigger_defs, @$trigger_defs if ref $trigger_defs; + push @field_comments, @$field_comments if ref $field_comments; + } + + # + # Table options + # + my @table_options; + for my $opt ($table->options) { + if (ref $opt eq 'HASH') { + my ($key, $value) = each %$opt; + if (ref $value eq 'ARRAY') { + push @table_options, + "$key\n(\n" + . join( + "\n", map {" $_->[0]\t$_->[1]"} + map { [ each %$_ ] } @$value + ) . "\n)"; + } elsif (!defined $value) { + push @table_options, $key; + } else { + push @table_options, "$key $value"; + } } - - # - # Table options - # - my @table_options; - for my $opt ( $table->options ) { - if ( ref $opt eq 'HASH' ) { - my ( $key, $value ) = each %$opt; - if ( ref $value eq 'ARRAY' ) { - push @table_options, "$key\n(\n". join ("\n", - map { " $_->[0]\t$_->[1]" } - map { [ each %$_ ] } - @$value - )."\n)"; - } - elsif ( !defined $value ) { - push @table_options, $key; - } - else { - push @table_options, "$key $value"; - } - } + } + + # + # Table constraints + # + for my $c ($table->get_constraints) { + my $constr = create_constraint($c, $options); + if ($constr) { + if ($c->type eq FOREIGN_KEY) { # FK defs always come later as alters + push @fk_defs, sprintf("ALTER TABLE %s ADD %s", $table_name_q, $constr); + } else { + push @constraint_defs, $constr; + } } + } - # - # Table constraints - # - for my $c ( $table->get_constraints ) { - my $constr = create_constraint($c, $options); - if ($constr) { - if ($c->type eq FOREIGN_KEY) { # FK defs always come later as alters - push @fk_defs, sprintf("ALTER TABLE %s ADD %s", $table_name_q, $constr); - } - else { - push @constraint_defs, $constr; - } + # + # Index Declarations + # + my @index_defs = (); + for my $index ($table->get_indices) { + my $index_name = $index->name || ''; + my $index_type = $index->type || NORMAL; + my @fields = map { quote($_, $qf) } $index->fields; + next unless @fields; + debug("ORA: Creating $index_type index on fields (" . join(', ', @fields) . ") named $index_name"); + my @index_options; + for my $opt ($index->options) { + if (ref $opt eq 'HASH') { + my ($key, $value) = each %$opt; + if (ref $value eq 'ARRAY') { + push @table_options, + "$key\n(\n" + . join( + "\n", map {" $_->[0]\t$_->[1]"} + map { [ each %$_ ] } @$value + ) . "\n)"; + } elsif (!defined $value) { + push @index_options, $key; + } else { + push @index_options, "$key $value"; } + } } - - # - # Index Declarations - # - my @index_defs = (); - for my $index ( $table->get_indices ) { - my $index_name = $index->name || ''; - my $index_type = $index->type || NORMAL; - my @fields = map { quote($_, $qf) } $index->fields; - next unless @fields; - debug("ORA: Creating $index_type index on fields (" . join(', ', @fields) . ") named $index_name"); - my @index_options; - for my $opt ( $index->options ) { - if ( ref $opt eq 'HASH' ) { - my ( $key, $value ) = each %$opt; - if ( ref $value eq 'ARRAY' ) { - push @table_options, "$key\n(\n". join ("\n", - map { " $_->[0]\t$_->[1]" } - map { [ each %$_ ] } - @$value - )."\n)"; - } - elsif ( !defined $value ) { - push @index_options, $key; - } - else { - push @index_options, "$key $value"; - } - } - } - my $index_options = @index_options - ? "\n".join("\n", @index_options) : ''; - - if ( $index_type eq PRIMARY_KEY ) { - $index_name = $index_name ? mk_name( $index_name ) - : mk_name( $table_name, 'pk' ); - $index_name = quote($index_name, $qf); - push @field_defs, 'CONSTRAINT '.$index_name.' PRIMARY KEY '. - '(' . join( ', ', @fields ) . ')'; - } - elsif ($index_type eq NORMAL or $index_type eq UNIQUE) { - push @index_defs, create_index($index, $options, $index_options); - } - else { - warn "Unknown index type ($index_type) on table $table_name.\n" - if $WARN; - } + my $index_options = @index_options ? "\n" . join("\n", @index_options) : ''; + + if ($index_type eq PRIMARY_KEY) { + $index_name + = $index_name + ? mk_name($index_name) + : mk_name($table_name, 'pk'); + $index_name = quote($index_name, $qf); + push @field_defs, 'CONSTRAINT ' . $index_name . ' PRIMARY KEY ' . '(' . join(', ', @fields) . ')'; + } elsif ($index_type eq NORMAL or $index_type eq UNIQUE) { + push @index_defs, create_index($index, $options, $index_options); + } else { + warn "Unknown index type ($index_type) on table $table_name.\n" + if $WARN; } + } - if ( my @table_comments = $table->comments ) { - for my $comment ( @table_comments ) { - next unless $comment; - $comment = __PACKAGE__->_quote_string($comment); - push @field_comments, "COMMENT ON TABLE $table_name_q is\n $comment" - unless $options->{no_comments}; - } + if (my @table_comments = $table->comments) { + for my $comment (@table_comments) { + next unless $comment; + $comment = __PACKAGE__->_quote_string($comment); + push @field_comments, "COMMENT ON TABLE $table_name_q is\n $comment" + unless $options->{no_comments}; } + } - my $table_options = @table_options ? "\n".join("\n", @table_options) : ''; - push @create, "CREATE TABLE $table_name_q (\n" . - join( ",\n", map { " $_" } @field_defs, - ($options->{delay_constraints} ? () : @constraint_defs) ) . - "\n)$table_options"; + my $table_options = @table_options ? "\n" . join("\n", @table_options) : ''; + push @create, + "CREATE TABLE $table_name_q (\n" + . join(",\n", map {" $_"} @field_defs, ($options->{delay_constraints} ? () : @constraint_defs)) + . "\n)$table_options"; - @constraint_defs = map { "ALTER TABLE $table_name_q ADD $_" } @constraint_defs; + @constraint_defs = map {"ALTER TABLE $table_name_q ADD $_"} @constraint_defs; - if ( $WARN ) { - if ( %truncated ) { - warn "Truncated " . keys( %truncated ) . " names:\n"; - warn "\t" . join( "\n\t", sort keys %truncated ) . "\n"; - } + if ($WARN) { + if (%truncated) { + warn "Truncated " . keys(%truncated) . " names:\n"; + warn "\t" . join("\n\t", sort keys %truncated) . "\n"; } + } - return \@create, \@fk_defs, \@trigger_defs, \@index_defs, ($options->{delay_constraints} ? \@constraint_defs : []); + return \@create, \@fk_defs, \@trigger_defs, \@index_defs, ($options->{delay_constraints} ? \@constraint_defs : []); } sub alter_field { - my ($from_field, $to_field, $options) = @_; + my ($from_field, $to_field, $options) = @_; - my $qt = $options->{quote_table_names}; - my ($field_create, $field_defs, $trigger_defs, $field_comments) = - create_field($to_field, $options, {}); + my $qt = $options->{quote_table_names}; + my ($field_create, $field_defs, $trigger_defs, $field_comments) + = create_field($to_field, $options, {}); - # Fix ORA-01442 - if (!$from_field->is_nullable && $to_field->is_nullable) { - if ($from_field->data_type =~ /text/) { - die 'Cannot alter CLOB field in this way'; - } - else { - @$field_defs = map { $_ .= ' NULL' } @$field_defs; - } - } elsif (!$from_field->is_nullable && !$to_field->is_nullable) { - @$field_defs = map { s/ NOT NULL//; $_} @$field_defs; + # Fix ORA-01442 + if (!$from_field->is_nullable && $to_field->is_nullable) { + if ($from_field->data_type =~ /text/) { + die 'Cannot alter CLOB field in this way'; + } else { + @$field_defs = map { $_ .= ' NULL' } @$field_defs; } + } elsif (!$from_field->is_nullable && !$to_field->is_nullable) { + @$field_defs = map { s/ NOT NULL//; $_ } @$field_defs; + } - my $table_name = quote($to_field->table->name,$qt); + my $table_name = quote($to_field->table->name, $qt); - return 'ALTER TABLE '.$table_name.' MODIFY ( '.join('', @$field_defs).' )'; + return 'ALTER TABLE ' . $table_name . ' MODIFY ( ' . join('', @$field_defs) . ' )'; } -sub drop_field -{ - my ($old_field, $options) = @_; - my $qi = $options->{quote_identifiers}; - my $table_name = quote($old_field->table->name, $qi); +sub drop_field { + my ($old_field, $options) = @_; + my $qi = $options->{quote_identifiers}; + my $table_name = quote($old_field->table->name, $qi); - my $out = sprintf('ALTER TABLE %s DROP COLUMN %s', - $table_name, - quote($old_field->name, $qi)); + my $out = sprintf('ALTER TABLE %s DROP COLUMN %s', $table_name, quote($old_field->name, $qi)); - return $out; + return $out; } sub add_field { - my ($new_field, $options) = @_; + my ($new_field, $options) = @_; - my $qt = $options->{quote_table_names}; - my ($field_create, $field_defs, $trigger_defs, $field_comments) = - create_field($new_field, $options, {}); + my $qt = $options->{quote_table_names}; + my ($field_create, $field_defs, $trigger_defs, $field_comments) + = create_field($new_field, $options, {}); - my $table_name = quote($new_field->table->name,$qt); + my $table_name = quote($new_field->table->name, $qt); - my $out = sprintf('ALTER TABLE %s ADD ( %s )', - $table_name, - join('', @$field_defs)); - return $out; + my $out = sprintf('ALTER TABLE %s ADD ( %s )', $table_name, join('', @$field_defs)); + return $out; } sub create_field { - my ($field, $options, $field_name_scope) = @_; - my $qf = $options->{quote_field_names}; - my $qt = $options->{quote_table_names}; - - my (@create, @field_defs, @trigger_defs, @field_comments); - - my $table_name = $field->table->name; - my $table_name_q = quote($table_name, $qt); - - # - # Field name - # - my $field_name = mk_name( - $field->name, '', $field_name_scope, 1 - ); - my $field_name_q = quote($field_name, $qf); - my $field_def = quote($field_name, $qf); - $field->name( $field_name ); - - # - # Datatype - # - my $check; - my $data_type = lc $field->data_type; - my @size = $field->size; - my %extra = $field->extra; - my $list = $extra{'list'} || []; - my $commalist = join( ', ', map { __PACKAGE__->_quote_string($_) } @$list ); - - if ( $data_type eq 'enum' ) { - $check = "CHECK ($field_name_q IN ($commalist))"; - $data_type = 'varchar2'; - } - elsif ( $data_type eq 'set' ) { - # XXX add a CHECK constraint maybe - # (trickier and slower, than enum :) - $data_type = 'varchar2'; - } - else { - if (defined $translate{ $data_type }) { - if (ref $translate{ $data_type } eq "ARRAY") { - ($data_type,$size[0]) = @{$translate{ $data_type }}; - } else { - $data_type = $translate{ $data_type }; - } + my ($field, $options, $field_name_scope) = @_; + my $qf = $options->{quote_field_names}; + my $qt = $options->{quote_table_names}; + + my (@create, @field_defs, @trigger_defs, @field_comments); + + my $table_name = $field->table->name; + my $table_name_q = quote($table_name, $qt); + + # + # Field name + # + my $field_name = mk_name($field->name, '', $field_name_scope, 1); + my $field_name_q = quote($field_name, $qf); + my $field_def = quote($field_name, $qf); + $field->name($field_name); + + # + # Datatype + # + my $check; + my $data_type = lc $field->data_type; + my @size = $field->size; + my %extra = $field->extra; + my $list = $extra{'list'} || []; + my $commalist = join(', ', map { __PACKAGE__->_quote_string($_) } @$list); + + if ($data_type eq 'enum') { + $check = "CHECK ($field_name_q IN ($commalist))"; + $data_type = 'varchar2'; + } elsif ($data_type eq 'set') { + + # XXX add a CHECK constraint maybe + # (trickier and slower, than enum :) + $data_type = 'varchar2'; + } else { + if (defined $translate{$data_type}) { + if (ref $translate{$data_type} eq "ARRAY") { + ($data_type, $size[0]) = @{ $translate{$data_type} }; + } else { + $data_type = $translate{$data_type}; } - $data_type ||= 'varchar2'; } - - # ensure size is not bigger than max size oracle allows for data type - if ( defined $max_size{$data_type} ) { - for ( my $i = 0 ; $i < scalar @size ; $i++ ) { - my $max = - ref( $max_size{$data_type} ) eq 'ARRAY' - ? $max_size{$data_type}->[$i] - : $max_size{$data_type}; - $size[$i] = $max if $size[$i] > $max; - } - } - + $data_type ||= 'varchar2'; + } + + # ensure size is not bigger than max size oracle allows for data type + if (defined $max_size{$data_type}) { + for (my $i = 0; $i < scalar @size; $i++) { + my $max + = ref($max_size{$data_type}) eq 'ARRAY' + ? $max_size{$data_type}->[$i] + : $max_size{$data_type}; + $size[$i] = $max if $size[$i] > $max; + } + } + + # + # Fixes ORA-02329: column of datatype LOB cannot be + # unique or a primary key + # + if ($data_type eq 'clob' && $field->is_primary_key) { + $data_type = 'varchar2'; + $size[0] = 4000; + warn "CLOB cannot be a primary key, changing to VARCHAR2\n" + if $WARN; + } + + if ($data_type eq 'clob' && $field->is_unique) { + $data_type = 'varchar2'; + $size[0] = 4000; + warn "CLOB cannot be a unique key, changing to VARCHAR2\n" + if $WARN; + } + + # + # Fixes ORA-00907: missing right parenthesis + # + if ($data_type =~ /(date|clob)/i) { + undef @size; + } + + # + # Fixes ORA-00906: missing right parenthesis + # if size is 0 or undefined + # + for (qw/varchar2/) { + if ($data_type =~ /^($_)$/i) { + $size[0] ||= $max_size{$_}; + } + } + + $field_def .= " $data_type"; + if (defined $size[0] && $size[0] > 0) { + $field_def .= '(' . join(',', @size) . ')'; + } + + # + # Default value + # + my $default = $field->default_value; + if (defined $default) { + debug("ORA: Handling default value: $default"); # - # Fixes ORA-02329: column of datatype LOB cannot be - # unique or a primary key + # Wherein we try to catch a string being used as + # a default value for a numerical field. If "true/false," + # then sub "1/0," otherwise just test the truthity of the + # argument and use that (naive?). # - if ( $data_type eq 'clob' && $field->is_primary_key ) { - $data_type = 'varchar2'; - $size[0] = 4000; - warn "CLOB cannot be a primary key, changing to VARCHAR2\n" - if $WARN; - } - - if ( $data_type eq 'clob' && $field->is_unique ) { - $data_type = 'varchar2'; - $size[0] = 4000; - warn "CLOB cannot be a unique key, changing to VARCHAR2\n" - if $WARN; - } - - # - # Fixes ORA-00907: missing right parenthesis - # - if ( $data_type =~ /(date|clob)/i ) { - undef @size; - } - - # - # Fixes ORA-00906: missing right parenthesis - # if size is 0 or undefined - # - for (qw/varchar2/) { - if ( $data_type =~ /^($_)$/i ) { - $size[0] ||= $max_size{$_}; - } - } - - $field_def .= " $data_type"; - if ( defined $size[0] && $size[0] > 0 ) { - $field_def .= '(' . join( ',', @size ) . ')'; - } - - # - # Default value - # - my $default = $field->default_value; - if ( defined $default ) { - debug("ORA: Handling default value: $default"); - # - # Wherein we try to catch a string being used as - # a default value for a numerical field. If "true/false," - # then sub "1/0," otherwise just test the truthity of the - # argument and use that (naive?). - # - if (ref $default and defined $$default) { - $default = $$default; - } elsif (ref $default) { - $default = 'NULL'; - } elsif ( - $data_type =~ /^number$/i && - $default !~ /^-?\d+$/ && - $default !~ m/null/i - ) { - if ( $default =~ /^true$/i ) { - $default = "'1'"; - } elsif ( $default =~ /^false$/i ) { - $default = "'0'"; - } else { - $default = $default ? "'1'" : "'0'"; - } - } elsif ( - $data_type =~ /date/ && ( - $default eq 'current_timestamp' - || - $default eq 'now()' - ) - ) { - $default = 'SYSDATE'; - } else { - $default = $default =~ m/null/i ? 'NULL' : __PACKAGE__->_quote_string($default); - } - - $field_def .= " DEFAULT $default", - } - - # - # Not null constraint - # - unless ( $field->is_nullable ) { - debug("ORA: Field is NOT NULL"); - $field_def .= ' NOT NULL'; - } - - $field_def .= " $check" if $check; - - # - # Auto_increment - # - if ( $field->is_auto_increment ) { - debug("ORA: Handling auto increment"); - my $base_name = $table_name . "_". $field_name; - my $seq_name = quote(mk_name( $base_name, 'sq' ),$qt); - my $trigger_name = quote(mk_name( $base_name, 'ai' ),$qt); - - push @create, qq[DROP SEQUENCE $seq_name] if $options->{add_drop_table}; - push @create, "CREATE SEQUENCE $seq_name"; - my $trigger = - "CREATE OR REPLACE TRIGGER $trigger_name\n" . - "BEFORE INSERT ON $table_name_q\n" . - "FOR EACH ROW WHEN (\n" . - " new.$field_name_q IS NULL". - " OR new.$field_name_q = 0\n". - ")\n". - "BEGIN\n" . - " SELECT $seq_name.nextval\n" . - " INTO :new." . $field_name_q."\n" . - " FROM dual;\n" . - "END;\n"; - - push @trigger_defs, $trigger; - } - - push @field_defs, $field_def; - - if ( my $comment = $field->comments ) { - debug("ORA: Handling comment"); - $comment =~ __PACKAGE__->_quote_string($comment); - push @field_comments, - "COMMENT ON COLUMN $table_name_q.$field_name_q is\n $comment;" - unless $options->{no_comments}; - } - - return \@create, \@field_defs, \@trigger_defs, \@field_comments; + if (ref $default and defined $$default) { + $default = $$default; + } elsif (ref $default) { + $default = 'NULL'; + } elsif ($data_type =~ /^number$/i + && $default !~ /^-?\d+$/ + && $default !~ m/null/i) { + if ($default =~ /^true$/i) { + $default = "'1'"; + } elsif ($default =~ /^false$/i) { + $default = "'0'"; + } else { + $default = $default ? "'1'" : "'0'"; + } + } elsif ( + $data_type =~ /date/ + && ( $default eq 'current_timestamp' + || $default eq 'now()') + ) { + $default = 'SYSDATE'; + } else { + $default + = $default =~ m/null/i + ? 'NULL' + : __PACKAGE__->_quote_string($default); + } + + $field_def .= " DEFAULT $default",; + } + + # + # Not null constraint + # + unless ($field->is_nullable) { + debug("ORA: Field is NOT NULL"); + $field_def .= ' NOT NULL'; + } + + $field_def .= " $check" if $check; + + # + # Auto_increment + # + if ($field->is_auto_increment) { + debug("ORA: Handling auto increment"); + my $base_name = $table_name . "_" . $field_name; + my $seq_name = quote(mk_name($base_name, 'sq'), $qt); + my $trigger_name = quote(mk_name($base_name, 'ai'), $qt); + + push @create, qq[DROP SEQUENCE $seq_name] if $options->{add_drop_table}; + push @create, "CREATE SEQUENCE $seq_name"; + my $trigger + = "CREATE OR REPLACE TRIGGER $trigger_name\n" + . "BEFORE INSERT ON $table_name_q\n" + . "FOR EACH ROW WHEN (\n" + . " new.$field_name_q IS NULL" + . " OR new.$field_name_q = 0\n" . ")\n" + . "BEGIN\n" + . " SELECT $seq_name.nextval\n" + . " INTO :new." + . $field_name_q . "\n" + . " FROM dual;\n" + . "END;\n"; + + push @trigger_defs, $trigger; + } + + push @field_defs, $field_def; + + if (my $comment = $field->comments) { + debug("ORA: Handling comment"); + $comment =~ __PACKAGE__->_quote_string($comment); + push @field_comments, "COMMENT ON COLUMN $table_name_q.$field_name_q is\n $comment;" + unless $options->{no_comments}; + } + + return \@create, \@field_defs, \@trigger_defs, \@field_comments; } sub drop_table { - my ($table, $options) = @_; + my ($table, $options) = @_; - my $qi = $options->{quote_identifiers}; - my @foreign_key_constraints = grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints; - my @statements; - for my $constraint(@foreign_key_constraints) { - push @statements, alter_drop_constraint($constraint, $options); - } + my $qi = $options->{quote_identifiers}; + my @foreign_key_constraints = grep { $_->type eq 'FOREIGN KEY' } $table->get_constraints; + my @statements; + for my $constraint (@foreign_key_constraints) { + push @statements, alter_drop_constraint($constraint, $options); + } - return @statements, 'DROP TABLE ' . quote($table, $qi); + return @statements, 'DROP TABLE ' . quote($table, $qi); } sub alter_create_index { - my ($index, $options) = @_; - return create_index($index, $options); + my ($index, $options) = @_; + return create_index($index, $options); } sub create_index { - my ( $index, $options, $index_options) = @_; - $index_options = $index_options || ''; - my $qf = $options->{quote_field_names} || $options->{quote_identifiers}; - my $qt = $options->{quote_table_names} || $options->{quote_identifiers}; - my $index_name = $index->name || ''; - $index_name = $index_name ? mk_name( $index_name ) : mk_name( $index->table, $index_name || 'i' ); - return join( - ' ', - map { $_ || () } - 'CREATE', - lc $index->type eq 'normal' ? 'INDEX' : $index->type . ' INDEX', - $index_name ? quote($index_name, $qf): '', - 'ON', - quote($index->table, $qt), - '(' . join( ', ', map { quote($_, $qf) } $index->fields ) . ")$index_options" - ); + my ($index, $options, $index_options) = @_; + $index_options = $index_options || ''; + my $qf = $options->{quote_field_names} || $options->{quote_identifiers}; + my $qt = $options->{quote_table_names} || $options->{quote_identifiers}; + my $index_name = $index->name || ''; + $index_name + = $index_name + ? mk_name($index_name) + : mk_name($index->table, $index_name || 'i'); + return join(' ', + map { $_ || () } 'CREATE', + lc $index->type eq 'normal' ? 'INDEX' : $index->type . ' INDEX', + $index_name ? quote($index_name, $qf) : '', + 'ON', + quote($index->table, $qt), + '(' . join(', ', map { quote($_, $qf) } $index->fields) . ")$index_options"); } sub alter_drop_index { - my ($index, $options) = @_; - return 'DROP INDEX ' . $index->name; + my ($index, $options) = @_; + return 'DROP INDEX ' . $index->name; } sub alter_drop_constraint { - my ($c, $options) = @_; - my $qi = $options->{quote_identifiers}; - my $table_name = quote($c->table->name, $qi); - my @out = ('ALTER','TABLE',$table_name,'DROP',); - if ($c->name) { - push @out, ('CONSTRAINT',quote($c->name, $qi)); - } - elsif ($c->type eq PRIMARY_KEY) { - push @out, 'PRIMARY KEY'; - } - return join(' ',@out); + my ($c, $options) = @_; + my $qi = $options->{quote_identifiers}; + my $table_name = quote($c->table->name, $qi); + my @out = ('ALTER', 'TABLE', $table_name, 'DROP',); + if ($c->name) { + push @out, ('CONSTRAINT', quote($c->name, $qi)); + } elsif ($c->type eq PRIMARY_KEY) { + push @out, 'PRIMARY KEY'; + } + return join(' ', @out); } sub alter_create_constraint { - my ($c, $options) = @_; - my $qi = $options->{quote_identifiers}; - my $table_name = quote($c->table->name, $qi); - return join( ' ', - 'ALTER TABLE', - $table_name, - 'ADD', - create_constraint($c, $options) ); + my ($c, $options) = @_; + my $qi = $options->{quote_identifiers}; + my $table_name = quote($c->table->name, $qi); + return join(' ', 'ALTER TABLE', $table_name, 'ADD', create_constraint($c, $options)); } sub create_constraint { - my ($c, $options) = @_; - - my $qt = $options->{quote_table_names}; - my $qf = $options->{quote_field_names}; - my $table = $c->table; - my $table_name = $table->name; - my $table_name_q = quote($table_name,$qt); - my $name = $c->name || ''; - my @fields = map { quote($_,$qf) } $c->fields; - my @rfields = map { quote($_,$qf) } $c->reference_fields; - - return undef if !@fields && $c->type ne 'CHECK'; - - my $definition; - - if ( $c->type eq PRIMARY_KEY ) { - debug("ORA: Creating PK constraint on fields (" . join(', ', @fields) . ")"); - # create a name if delay_constraints - $name ||= mk_name( $table_name, 'pk' ) - if $options->{delay_constraints}; - $name = quote($name,$qf); - $definition = ($name ? "CONSTRAINT $name " : '') . - 'PRIMARY KEY (' . join( ', ', @fields ) . ')'; - } - elsif ( $c->type eq UNIQUE ) { - # Don't create UNIQUE constraints identical to the primary key - if ( my $pk = $table->primary_key ) { - my $u_fields = join(":", @fields); - my $pk_fields = join(":", $pk->fields); - next if $u_fields eq $pk_fields; + my ($c, $options) = @_; + + my $qt = $options->{quote_table_names}; + my $qf = $options->{quote_field_names}; + my $table = $c->table; + my $table_name = $table->name; + my $table_name_q = quote($table_name, $qt); + my $name = $c->name || ''; + my @fields = map { quote($_, $qf) } $c->fields; + my @rfields = map { quote($_, $qf) } $c->reference_fields; + + return undef if !@fields && $c->type ne 'CHECK'; + + my $definition; + + if ($c->type eq PRIMARY_KEY) { + debug("ORA: Creating PK constraint on fields (" . join(', ', @fields) . ")"); + + # create a name if delay_constraints + $name ||= mk_name($table_name, 'pk') + if $options->{delay_constraints}; + $name = quote($name, $qf); + $definition = ($name ? "CONSTRAINT $name " : '') . 'PRIMARY KEY (' . join(', ', @fields) . ')'; + } elsif ($c->type eq UNIQUE) { + + # Don't create UNIQUE constraints identical to the primary key + if (my $pk = $table->primary_key) { + my $u_fields = join(":", @fields); + my $pk_fields = join(":", $pk->fields); + next if $u_fields eq $pk_fields; + } + + if ($name) { + + # Force prepend of table_name as ORACLE doesn't allow duplicate + # CONSTRAINT names even for different tables (ORA-02264) + $name = mk_name("${table_name}_$name", 'u') + unless $name =~ /^$table_name/; + } else { + $name = mk_name($table_name, 'u'); + } + debug("ORA: Creating UNIQUE constraint on fields (" . join(', ', @fields) . ") named $name"); + $name = quote($name, $qf); + + for my $f ($c->fields) { + my $field_def = $table->get_field($f) or next; + my $dtype = $translate{ + ref $field_def->data_type eq "ARRAY" + ? $field_def->data_type->[0] + : $field_def->data_type + } + or next; + if ($WARN && $dtype =~ /clob/i) { + warn "Oracle will not allow UNIQUE constraints on " + . "CLOB field '" + . $field_def->table->name . '.' + . $field_def->name . ".'\n"; } - - if ($name) { - # Force prepend of table_name as ORACLE doesn't allow duplicate - # CONSTRAINT names even for different tables (ORA-02264) - $name = mk_name( "${table_name}_$name", 'u' ) unless $name =~ /^$table_name/; - } - else { - $name = mk_name( $table_name, 'u' ); - } - debug("ORA: Creating UNIQUE constraint on fields (" . join(', ', @fields) . ") named $name"); - $name = quote($name, $qf); - - for my $f ( $c->fields ) { - my $field_def = $table->get_field( $f ) or next; - my $dtype = $translate{ ref $field_def->data_type eq "ARRAY" ? $field_def->data_type->[0] : $field_def->data_type} or next; - if ( $WARN && $dtype =~ /clob/i ) { - warn "Oracle will not allow UNIQUE constraints on " . - "CLOB field '" . $field_def->table->name . '.' . - $field_def->name . ".'\n" - } - } - - $definition = "CONSTRAINT $name UNIQUE " . - '(' . join( ', ', @fields ) . ')'; - } - elsif ( $c->type eq CHECK_C ) { - $name ||= mk_name( $name || $table_name, 'ck' ); - $name = quote($name, $qf); - my $expression = $c->expression || ''; - debug("ORA: Creating CHECK constraint on fields (" . join(', ', @fields) . ") named $name"); - $definition = "CONSTRAINT $name CHECK ($expression)"; } - elsif ( $c->type eq FOREIGN_KEY ) { - $name = mk_name( join('_', $table_name, $c->fields). '_fk' ); - $name = quote($name, $qf); - my $on_delete = uc ($c->on_delete || ''); - $definition = "CONSTRAINT $name FOREIGN KEY "; + $definition = "CONSTRAINT $name UNIQUE " . '(' . join(', ', @fields) . ')'; + } elsif ($c->type eq CHECK_C) { + $name ||= mk_name($name || $table_name, 'ck'); + $name = quote($name, $qf); + my $expression = $c->expression || ''; + debug("ORA: Creating CHECK constraint on fields (" . join(', ', @fields) . ") named $name"); + $definition = "CONSTRAINT $name CHECK ($expression)"; + } elsif ($c->type eq FOREIGN_KEY) { + $name = mk_name(join('_', $table_name, $c->fields) . '_fk'); + $name = quote($name, $qf); + my $on_delete = uc($c->on_delete || ''); - if ( @fields ) { - $definition .= '(' . join( ', ', @fields ) . ')'; - } + $definition = "CONSTRAINT $name FOREIGN KEY "; - my $ref_table = quote($c->reference_table,$qt); - debug("ORA: Creating FK constraint on fields (" . join(', ', @fields) . ") named $name referencing $ref_table"); - $definition .= " REFERENCES $ref_table"; + if (@fields) { + $definition .= '(' . join(', ', @fields) . ')'; + } - if ( @rfields ) { - $definition .= ' (' . join( ', ', @rfields ) . ')'; - } + my $ref_table = quote($c->reference_table, $qt); + debug("ORA: Creating FK constraint on fields (" . join(', ', @fields) . ") named $name referencing $ref_table"); + $definition .= " REFERENCES $ref_table"; - if ( $c->match_type ) { - $definition .= ' MATCH ' . - ( $c->match_type =~ /full/i ) ? 'FULL' : 'PARTIAL'; - } + if (@rfields) { + $definition .= ' (' . join(', ', @rfields) . ')'; + } - if ( $on_delete && $on_delete ne "RESTRICT") { - $definition .= ' ON DELETE '.$c->on_delete; - } + if ($c->match_type) { + $definition .= ' MATCH ' . ($c->match_type =~ /full/i) ? 'FULL' : 'PARTIAL'; } - return $definition ? $definition : undef; + if ($on_delete && $on_delete ne "RESTRICT") { + $definition .= ' ON DELETE ' . $c->on_delete; + } + } + + return $definition ? $definition : undef; } sub create_view { - my ($view, $options) = @_; - my $qt = $options->{quote_table_names}; - my $view_name = quote($view->name,$qt); - my $extra = $view->extra; - - my $view_type = 'VIEW'; - my $view_options = ''; - if ( my $materialized = $extra->{materialized} ) { - $view_type = 'MATERIALIZED VIEW'; - $view_options .= ' '.$materialized; - } + my ($view, $options) = @_; + my $qt = $options->{quote_table_names}; + my $view_name = quote($view->name, $qt); + my $extra = $view->extra; + + my $view_type = 'VIEW'; + my $view_options = ''; + if (my $materialized = $extra->{materialized}) { + $view_type = 'MATERIALIZED VIEW'; + $view_options .= ' ' . $materialized; + } - my @create; - push @create, qq[DROP $view_type $view_name] - if $options->{add_drop_view}; + my @create; + push @create, qq[DROP $view_type $view_name] + if $options->{add_drop_view}; - push @create, sprintf("CREATE %s %s%s AS\n%s", - $view_type, - $view_name, - $view_options, - $view->sql); + push @create, sprintf("CREATE %s %s%s AS\n%s", $view_type, $view_name, $view_options, $view->sql); - return \@create; + return \@create; } sub mk_name { - my $basename = shift || ''; - my $type = shift || ''; - $type = '' if $type =~ /^\d/; - my $scope = shift || ''; - my $critical = shift || ''; - my $basename_orig = $basename; - my $max_name = $type - ? $max_id_length - (length($type) + 1) - : $max_id_length; - $basename = substr( $basename, 0, $max_name ) - if length( $basename ) > $max_name; - my $name = $type ? "${type}_$basename" : $basename; - - if ( $basename ne $basename_orig and $critical ) { - my $show_type = $type ? "+'$type'" : ""; - warn "Truncating '$basename_orig'$show_type to $max_id_length ", - "character limit to make '$name'\n" if $WARN; - $truncated{ $basename_orig } = $name; - } - - $scope ||= \%global_names; - if ( my $prev = $scope->{ $name } ) { - my $name_orig = $name; - substr($name, $max_id_length - 2) = "" - if length( $name ) >= $max_id_length - 1; - $name .= sprintf( "%02d", $prev++ ); - - warn "The name '$name_orig' has been changed to ", - "'$name' to make it unique.\n" if $WARN; - - $scope->{ $name_orig }++; - } - - $scope->{ $name }++; - return $name; + my $basename = shift || ''; + my $type = shift || ''; + $type = '' if $type =~ /^\d/; + my $scope = shift || ''; + my $critical = shift || ''; + my $basename_orig = $basename; + my $max_name + = $type + ? $max_id_length - (length($type) + 1) + : $max_id_length; + $basename = substr($basename, 0, $max_name) + if length($basename) > $max_name; + my $name = $type ? "${type}_$basename" : $basename; + + if ($basename ne $basename_orig and $critical) { + my $show_type = $type ? "+'$type'" : ""; + warn "Truncating '$basename_orig'$show_type to $max_id_length ", "character limit to make '$name'\n" + if $WARN; + $truncated{$basename_orig} = $name; + } + + $scope ||= \%global_names; + if (my $prev = $scope->{$name}) { + my $name_orig = $name; + substr($name, $max_id_length - 2) = "" + if length($name) >= $max_id_length - 1; + $name .= sprintf("%02d", $prev++); + + warn "The name '$name_orig' has been changed to ", "'$name' to make it unique.\n" + if $WARN; + + $scope->{$name_orig}++; + } + + $scope->{$name}++; + return $name; } 1; @@ -880,7 +860,6 @@ sub quote { return "$quote_char$name$quote_char"; } - # ------------------------------------------------------------------- # All bad art is the result of good intentions. # Oscar Wilde diff --git a/lib/SQL/Translator/Producer/POD.pm b/lib/SQL/Translator/Producer/POD.pm index 8b577ddfb..e4e7d502c 100644 --- a/lib/SQL/Translator/Producer/POD.pm +++ b/lib/SQL/Translator/Producer/POD.pm @@ -28,94 +28,88 @@ use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(header_comment); sub produce { - my $t = shift; - my $schema = $t->schema; - my $schema_name = $schema->name || 'Schema'; - my $args = $t->producer_args; - my $title = $args->{'title'} || $schema_name; + my $t = shift; + my $schema = $t->schema; + my $schema_name = $schema->name || 'Schema'; + my $args = $t->producer_args; + my $title = $args->{'title'} || $schema_name; - my $pod = "=pod\n\n=head1 DESCRIPTION\n\n$title\n\n=head1 TABLES\n\n"; + my $pod = "=pod\n\n=head1 DESCRIPTION\n\n$title\n\n=head1 TABLES\n\n"; - for my $table ( $schema->get_tables ) { - my $table_name = $table->name or next; - my @fields = $table->get_fields or next; - $pod .= "=head2 $table_name\n\n=head3 FIELDS\n\n"; + for my $table ($schema->get_tables) { + my $table_name = $table->name or next; + my @fields = $table->get_fields or next; + $pod .= "=head2 $table_name\n\n=head3 FIELDS\n\n"; - # - # Fields - # - for my $field ( @fields ) { - $pod .= "=head4 " . $field->name . "\n\n=over 4\n\n"; + # + # Fields + # + for my $field (@fields) { + $pod .= "=head4 " . $field->name . "\n\n=over 4\n\n"; - my $data_type = $field->data_type; - my $size = $field->size; - $data_type .= "($size)" if $size; + my $data_type = $field->data_type; + my $size = $field->size; + $data_type .= "($size)" if $size; - $pod .= "=item * $data_type\n\n"; - $pod .= "=item * PRIMARY KEY\n\n" if $field->is_primary_key; + $pod .= "=item * $data_type\n\n"; + $pod .= "=item * PRIMARY KEY\n\n" if $field->is_primary_key; - my $default = $field->default_value; - $pod .= "=item * Default '$default' \n\n" if defined $default; + my $default = $field->default_value; + $pod .= "=item * Default '$default' \n\n" if defined $default; - $pod .= sprintf( "=item * Nullable '%s' \n\n", - $field->is_nullable ? 'Yes' : 'No' ); + $pod .= sprintf("=item * Nullable '%s' \n\n", $field->is_nullable ? 'Yes' : 'No'); - $pod .= "=back\n\n"; - } + $pod .= "=back\n\n"; + } - # - # Indices - # - if ( my @indices = $table->get_indices ) { - $pod .= "=head3 INDICES\n\n"; - for my $index ( @indices ) { - $pod .= "=head4 " . $index->type . "\n\n=over 4\n\n"; - $pod .= "=item * Fields = " . - join(', ', $index->fields ) . "\n\n"; - $pod .= "=back\n\n"; - } - } + # + # Indices + # + if (my @indices = $table->get_indices) { + $pod .= "=head3 INDICES\n\n"; + for my $index (@indices) { + $pod .= "=head4 " . $index->type . "\n\n=over 4\n\n"; + $pod .= "=item * Fields = " . join(', ', $index->fields) . "\n\n"; + $pod .= "=back\n\n"; + } + } - # - # Constraints - # - if ( my @constraints = $table->get_constraints ) { - $pod .= "=head3 CONSTRAINTS\n\n"; - for my $c ( @constraints ) { - $pod .= "=head4 " . $c->type . "\n\n=over 4\n\n"; - if($c->type eq CHECK_C) { - $pod .= "=item * Expression = " . $c->expression . "\n\n"; - } else { - $pod .= "=item * Fields = " . - join(', ', $c->fields ) . "\n\n"; - - if ( $c->type eq FOREIGN_KEY ) { - $pod .= "=item * Reference Table = Lreference_table . ">\n\n"; - $pod .= "=item * Reference Fields = " . - join(', ', map {"L"} $c->reference_fields ) . - "\n\n"; - } - - if ( my $update = $c->on_update ) { - $pod .= "=item * On update = $update\n\n"; - } - - if ( my $delete = $c->on_delete ) { - $pod .= "=item * On delete = $delete\n\n"; - } - } - - $pod .= "=back\n\n"; - } + # + # Constraints + # + if (my @constraints = $table->get_constraints) { + $pod .= "=head3 CONSTRAINTS\n\n"; + for my $c (@constraints) { + $pod .= "=head4 " . $c->type . "\n\n=over 4\n\n"; + if ($c->type eq CHECK_C) { + $pod .= "=item * Expression = " . $c->expression . "\n\n"; + } else { + $pod .= "=item * Fields = " . join(', ', $c->fields) . "\n\n"; + + if ($c->type eq FOREIGN_KEY) { + $pod .= "=item * Reference Table = Lreference_table . ">\n\n"; + $pod .= "=item * Reference Fields = " . join(', ', map {"L"} $c->reference_fields) . "\n\n"; + } + + if (my $update = $c->on_update) { + $pod .= "=item * On update = $update\n\n"; + } + + if (my $delete = $c->on_delete) { + $pod .= "=item * On delete = $delete\n\n"; + } } + + $pod .= "=back\n\n"; + } } + } - my $header = ( map { $_ || () } split( /\n/, header_comment('', '') ) )[0]; - $header =~ s/^Created by //; - $pod .= "=head1 PRODUCED BY\n\n$header\n\n=cut"; + my $header = (map { $_ || () } split(/\n/, header_comment('', '')))[0]; + $header =~ s/^Created by //; + $pod .= "=head1 PRODUCED BY\n\n$header\n\n=cut"; - return $pod; + return $pod; } 1; diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm index bda2f27ac..cefe27c5f 100644 --- a/lib/SQL/Translator/Producer/PostgreSQL.pm +++ b/lib/SQL/Translator/Producer/PostgreSQL.pm @@ -104,13 +104,14 @@ Fields for use with PostGIS types. use strict; use warnings; -our ( $DEBUG, $WARN ); +our ($DEBUG, $WARN); our $VERSION = '1.64'; $DEBUG = 0 unless defined $DEBUG; use base qw(SQL::Translator::Producer); use SQL::Translator::Schema::Constants; -use SQL::Translator::Utils qw(debug header_comment parse_dbms_version batch_alter_table_statements normalize_quote_options); +use SQL::Translator::Utils + qw(debug header_comment parse_dbms_version batch_alter_table_statements normalize_quote_options); use SQL::Translator::Generator::DDL::PostgreSQL; use Data::Dumper; @@ -118,23 +119,22 @@ use constant MAX_ID_LENGTH => 62; { my ($quoting_generator, $nonquoting_generator); + sub _generator { my $options = shift; return $options->{generator} if exists $options->{generator}; return normalize_quote_options($options) - ? $quoting_generator ||= SQL::Translator::Generator::DDL::PostgreSQL->new - : $nonquoting_generator ||= SQL::Translator::Generator::DDL::PostgreSQL->new( - quote_chars => [], - ); + ? $quoting_generator ||= SQL::Translator::Generator::DDL::PostgreSQL->new + : $nonquoting_generator ||= SQL::Translator::Generator::DDL::PostgreSQL->new(quote_chars => [],); } } -my ( %translate ); +my (%translate); BEGIN { - %translate = ( + %translate = ( # # MySQL types # @@ -160,21 +160,21 @@ BEGIN { # # Oracle types # - number => 'integer', - varchar2 => 'character varying', - long => 'text', - clob => 'text', + number => 'integer', + varchar2 => 'character varying', + long => 'text', + clob => 'text', # # Sybase types # - comment => 'text', + comment => 'text', # # MS Access types # - memo => 'text', -); + memo => 'text', + ); } my %truncated; @@ -222,398 +222,422 @@ and table_constraint is: =cut sub produce { - my $translator = shift; - local $DEBUG = $translator->debug; - local $WARN = $translator->show_warnings; - my $no_comments = $translator->no_comments; - my $add_drop_table = $translator->add_drop_table; - my $schema = $translator->schema; - my $pargs = $translator->producer_args; - my $postgres_version = parse_dbms_version( - $pargs->{postgres_version}, 'perl' + my $translator = shift; + local $DEBUG = $translator->debug; + local $WARN = $translator->show_warnings; + my $no_comments = $translator->no_comments; + my $add_drop_table = $translator->add_drop_table; + my $schema = $translator->schema; + my $pargs = $translator->producer_args; + my $postgres_version = parse_dbms_version($pargs->{postgres_version}, 'perl'); + + my $generator = _generator({ quote_identifiers => $translator->quote_identifiers }); + + my @output; + push @output, header_comment unless ($no_comments); + + my (@table_defs, @fks); + my %type_defs; + for my $table ($schema->get_tables) { + + my ($table_def, $fks) = create_table( + $table, + { + generator => $generator, + no_comments => $no_comments, + postgres_version => $postgres_version, + add_drop_table => $add_drop_table, + type_defs => \%type_defs, + attach_comments => $pargs->{attach_comments} + } ); - my $generator = _generator({ quote_identifiers => $translator->quote_identifiers }); - - my @output; - push @output, header_comment unless ($no_comments); - - my (@table_defs, @fks); - my %type_defs; - for my $table ( $schema->get_tables ) { - - my ($table_def, $fks) = create_table($table, { - generator => $generator, - no_comments => $no_comments, - postgres_version => $postgres_version, - add_drop_table => $add_drop_table, - type_defs => \%type_defs, - attach_comments => $pargs->{attach_comments} - }); - - push @table_defs, $table_def; - push @fks, @$fks; - } + push @table_defs, $table_def; + push @fks, @$fks; + } - for my $view ( $schema->get_views ) { - push @table_defs, create_view($view, { - postgres_version => $postgres_version, - add_drop_view => $add_drop_table, - generator => $generator, - no_comments => $no_comments, - }); - } + for my $view ($schema->get_views) { + push @table_defs, + create_view( + $view, + { + postgres_version => $postgres_version, + add_drop_view => $add_drop_table, + generator => $generator, + no_comments => $no_comments, + } + ); + } - for my $trigger ( $schema->get_triggers ) { - push @table_defs, create_trigger( $trigger, { - add_drop_trigger => $add_drop_table, - generator => $generator, - no_comments => $no_comments, - }); - } + for my $trigger ($schema->get_triggers) { + push @table_defs, + create_trigger( + $trigger, + { + add_drop_trigger => $add_drop_table, + generator => $generator, + no_comments => $no_comments, + } + ); + } - push @output, map { "$_;\n\n" } values %type_defs; - push @output, map { "$_;\n\n" } @table_defs; - if ( @fks ) { - push @output, "--\n-- Foreign Key Definitions\n--\n\n" unless $no_comments; - push @output, map { "$_;\n\n" } @fks; - } + push @output, map {"$_;\n\n"} values %type_defs; + push @output, map {"$_;\n\n"} @table_defs; + if (@fks) { + push @output, "--\n-- Foreign Key Definitions\n--\n\n" + unless $no_comments; + push @output, map {"$_;\n\n"} @fks; + } - if ( $WARN ) { - if ( %truncated ) { - warn "Truncated " . keys( %truncated ) . " names:\n"; - warn "\t" . join( "\n\t", sort keys %truncated ) . "\n"; - } + if ($WARN) { + if (%truncated) { + warn "Truncated " . keys(%truncated) . " names:\n"; + warn "\t" . join("\n\t", sort keys %truncated) . "\n"; } + } - return wantarray - ? @output - : join ('', @output); + return wantarray + ? @output + : join('', @output); } { - my %global_names; - sub mk_name { - my $basename = shift || ''; - my $type = shift || ''; - my $scope = shift || ''; - my $critical = shift || ''; - my $basename_orig = $basename; - - my $max_name = $type - ? MAX_ID_LENGTH - (length($type) + 1) - : MAX_ID_LENGTH; - $basename = substr( $basename, 0, $max_name ) - if length( $basename ) > $max_name; - my $name = $type ? "${type}_$basename" : $basename; - - if ( $basename ne $basename_orig and $critical ) { - my $show_type = $type ? "+'$type'" : ""; - warn "Truncating '$basename_orig'$show_type to ", MAX_ID_LENGTH, - " character limit to make '$name'\n" if $WARN; - $truncated{ $basename_orig } = $name; - } - - $scope ||= \%global_names; - if ( my $prev = $scope->{ $name } ) { - my $name_orig = $name; - $name .= sprintf( "%02d", ++$prev ); - substr($name, MAX_ID_LENGTH - 3) = "00" - if length( $name ) > MAX_ID_LENGTH; + my %global_names; + + sub mk_name { + my $basename = shift || ''; + my $type = shift || ''; + my $scope = shift || ''; + my $critical = shift || ''; + my $basename_orig = $basename; + + my $max_name + = $type + ? MAX_ID_LENGTH - (length($type) + 1) + : MAX_ID_LENGTH; + $basename = substr($basename, 0, $max_name) + if length($basename) > $max_name; + my $name = $type ? "${type}_$basename" : $basename; + + if ($basename ne $basename_orig and $critical) { + my $show_type = $type ? "+'$type'" : ""; + warn "Truncating '$basename_orig'$show_type to ", MAX_ID_LENGTH, " character limit to make '$name'\n" + if $WARN; + $truncated{$basename_orig} = $name; + } - warn "The name '$name_orig' has been changed to ", - "'$name' to make it unique.\n" if $WARN; + $scope ||= \%global_names; + if (my $prev = $scope->{$name}) { + my $name_orig = $name; + $name .= sprintf("%02d", ++$prev); + substr($name, MAX_ID_LENGTH - 3) = "00" + if length($name) > MAX_ID_LENGTH; - $scope->{ $name_orig }++; - } + warn "The name '$name_orig' has been changed to ", "'$name' to make it unique.\n" + if $WARN; - $scope->{ $name }++; - return $name; + $scope->{$name_orig}++; } + + $scope->{$name}++; + return $name; + } } sub is_geometry { - my $field = shift; - return 1 if $field->data_type eq 'geometry'; + my $field = shift; + return 1 if $field->data_type eq 'geometry'; } sub is_geography { - my $field = shift; - return 1 if $field->data_type eq 'geography'; + my $field = shift; + return 1 if $field->data_type eq 'geography'; } -sub create_table -{ - my ($table, $options) = @_; +sub create_table { + my ($table, $options) = @_; - my $generator = _generator($options); - my $no_comments = $options->{no_comments} || 0; - my $add_drop_table = $options->{add_drop_table} || 0; - my $postgres_version = $options->{postgres_version} || 0; - my $type_defs = $options->{type_defs} || {}; - my $attach_comments = $options->{attach_comments}; - - my $table_name = $table->name or next; - my $table_name_qt = $generator->quote($table_name); - - my ( @comments, @field_defs, @index_defs, @constraint_defs, @fks ); - - push @comments, "--\n-- Table: $table_name\n--\n" unless $no_comments; - - my @comment_statements; - if ( my $comments = $table->comments ) { - if ( $attach_comments) { - # this follows the example in the MySQL producer, where all comments are added as - # table comments, even though they could have originally been parsed as DDL comments - # quoted via $$ string so there can be 'quotes' inside the comments - my $comment_ddl = "COMMENT on TABLE $table_name_qt IS \$comment\$$comments\$comment\$"; - push @comment_statements, $comment_ddl; - } elsif (!$no_comments) { - $comments =~ s/^/-- /mg; - push @comments, "-- Comments:\n$comments\n--\n"; - } - } + my $generator = _generator($options); + my $no_comments = $options->{no_comments} || 0; + my $add_drop_table = $options->{add_drop_table} || 0; + my $postgres_version = $options->{postgres_version} || 0; + my $type_defs = $options->{type_defs} || {}; + my $attach_comments = $options->{attach_comments}; - # - # Fields - # - for my $field ( $table->get_fields ) { - push @field_defs, create_field($field, { - generator => $generator, - postgres_version => $postgres_version, - type_defs => $type_defs, - constraint_defs => \@constraint_defs, - attach_comments => $attach_comments - }); - if ( $attach_comments ) { - my $field_comments = $field->comments; - next unless $field_comments; - my $field_name_qt = $generator->quote($field->name); - my $comment_ddl = - "COMMENT on COLUMN $table_name_qt.$field_name_qt IS \$comment\$$field_comments\$comment\$"; - push @comment_statements, $comment_ddl; - } + my $table_name = $table->name or next; + my $table_name_qt = $generator->quote($table_name); + + my (@comments, @field_defs, @index_defs, @constraint_defs, @fks); + push @comments, "--\n-- Table: $table_name\n--\n" unless $no_comments; + + my @comment_statements; + if (my $comments = $table->comments) { + if ($attach_comments) { + +# this follows the example in the MySQL producer, where all comments are added as +# table comments, even though they could have originally been parsed as DDL comments +# quoted via $$ string so there can be 'quotes' inside the comments + my $comment_ddl = "COMMENT on TABLE $table_name_qt IS \$comment\$$comments\$comment\$"; + push @comment_statements, $comment_ddl; + } elsif (!$no_comments) { + $comments =~ s/^/-- /mg; + push @comments, "-- Comments:\n$comments\n--\n"; } + } - # - # Index Declarations - # - for my $index ( $table->get_indices ) { - my ($idef, $constraints) = create_index($index, { - generator => $generator, + # + # Fields + # + for my $field ($table->get_fields) { + push @field_defs, + create_field( + $field, + { + generator => $generator, postgres_version => $postgres_version, - }); - $idef and push @index_defs, $idef; - push @constraint_defs, @$constraints; + type_defs => $type_defs, + constraint_defs => \@constraint_defs, + attach_comments => $attach_comments + } + ); + if ($attach_comments) { + my $field_comments = $field->comments; + next unless $field_comments; + my $field_name_qt = $generator->quote($field->name); + my $comment_ddl = "COMMENT on COLUMN $table_name_qt.$field_name_qt IS \$comment\$$field_comments\$comment\$"; + push @comment_statements, $comment_ddl; } - # - # Table constraints - # - for my $c ( $table->get_constraints ) { - my ($cdefs, $fks) = create_constraint($c, { - generator => $generator, - }); - push @constraint_defs, @$cdefs; - push @fks, @$fks; - } + } + # + # Index Declarations + # + for my $index ($table->get_indices) { + my ($idef, $constraints) = create_index( + $index, + { + generator => $generator, + postgres_version => $postgres_version, + } + ); + $idef and push @index_defs, $idef; + push @constraint_defs, @$constraints; + } - my $create_statement = join("\n", @comments); - if ($add_drop_table) { - if ($postgres_version >= 8.002) { - $create_statement .= "DROP TABLE IF EXISTS $table_name_qt CASCADE;\n"; - } else { - $create_statement .= "DROP TABLE $table_name_qt CASCADE;\n"; - } - } - my $temporary = $table->extra->{temporary} ? "TEMPORARY " : ""; - $create_statement .= "CREATE ${temporary}TABLE $table_name_qt (\n" . - join( ",\n", map { " $_" } @field_defs, @constraint_defs ). - "\n)" - ; - $create_statement .= @index_defs ? ';' : q{}; - $create_statement .= ( $create_statement =~ /;$/ ? "\n" : q{} ) - . join(";\n", @index_defs); + # + # Table constraints + # + for my $c ($table->get_constraints) { + my ($cdefs, $fks) = create_constraint( + $c, + { + generator => $generator, + } + ); + push @constraint_defs, @$cdefs; + push @fks, @$fks; + } - # - # Geometry - # - if (my @geometry_columns = grep { is_geometry($_) } $table->get_fields) { - $create_statement .= join(";\n", '', map{ drop_geometry_column($_, $options) } @geometry_columns) if $options->{add_drop_table}; - $create_statement .= join(";\n", '', map{ add_geometry_column($_, $options) } @geometry_columns); + my $create_statement = join("\n", @comments); + if ($add_drop_table) { + if ($postgres_version >= 8.002) { + $create_statement .= "DROP TABLE IF EXISTS $table_name_qt CASCADE;\n"; + } else { + $create_statement .= "DROP TABLE $table_name_qt CASCADE;\n"; } + } + my $temporary = $table->extra->{temporary} ? "TEMPORARY " : ""; + $create_statement .= "CREATE ${temporary}TABLE $table_name_qt (\n" + . join(",\n", map {" $_"} @field_defs, @constraint_defs) . "\n)"; + $create_statement .= @index_defs ? ';' : q{}; + $create_statement .= ($create_statement =~ /;$/ ? "\n" : q{}) . join(";\n", @index_defs); + + # + # Geometry + # + if (my @geometry_columns = grep { is_geometry($_) } $table->get_fields) { + $create_statement .= join(";\n", '', map { drop_geometry_column($_, $options) } @geometry_columns) + if $options->{add_drop_table}; + $create_statement .= join(";\n", '', map { add_geometry_column($_, $options) } @geometry_columns); + } - if (@comment_statements) { - $create_statement .= join(";\n", '', @comment_statements); - } + if (@comment_statements) { + $create_statement .= join(";\n", '', @comment_statements); + } - return $create_statement, \@fks; + return $create_statement, \@fks; } sub create_view { - my ($view, $options) = @_; - my $generator = _generator($options); - my $postgres_version = $options->{postgres_version} || 0; - my $add_drop_view = $options->{add_drop_view}; - - my $view_name = $view->name; - debug("PKG: Looking at view '${view_name}'\n"); - - my $create = ''; - $create .= "--\n-- View: " . $generator->quote($view_name) . "\n--\n" - unless $options->{no_comments}; - if ($add_drop_view) { - if ($postgres_version >= 8.002) { - $create .= "DROP VIEW IF EXISTS " . $generator->quote($view_name) . ";\n"; - } else { - $create .= "DROP VIEW " . $generator->quote($view_name) . ";\n"; - } - } - $create .= 'CREATE'; - - my $extra = $view->extra; - $create .= " TEMPORARY" if exists($extra->{temporary}) && $extra->{temporary}; - $create .= " MATERIALIZED" if exists($extra->{materialized}) && $extra->{materialized}; - $create .= " VIEW " . $generator->quote($view_name); - - if ( my @fields = $view->fields ) { - my $field_list = join ', ', map { $generator->quote($_) } @fields; - $create .= " ( ${field_list} )"; + my ($view, $options) = @_; + my $generator = _generator($options); + my $postgres_version = $options->{postgres_version} || 0; + my $add_drop_view = $options->{add_drop_view}; + + my $view_name = $view->name; + debug("PKG: Looking at view '${view_name}'\n"); + + my $create = ''; + $create .= "--\n-- View: " . $generator->quote($view_name) . "\n--\n" + unless $options->{no_comments}; + if ($add_drop_view) { + if ($postgres_version >= 8.002) { + $create .= "DROP VIEW IF EXISTS " . $generator->quote($view_name) . ";\n"; + } else { + $create .= "DROP VIEW " . $generator->quote($view_name) . ";\n"; } + } + $create .= 'CREATE'; + + my $extra = $view->extra; + $create .= " TEMPORARY" + if exists($extra->{temporary}) && $extra->{temporary}; + $create .= " MATERIALIZED" + if exists($extra->{materialized}) && $extra->{materialized}; + $create .= " VIEW " . $generator->quote($view_name); + + if (my @fields = $view->fields) { + my $field_list = join ', ', map { $generator->quote($_) } @fields; + $create .= " ( ${field_list} )"; + } - if ( my $sql = $view->sql ) { - $create .= " AS\n ${sql}\n"; - } + if (my $sql = $view->sql) { + $create .= " AS\n ${sql}\n"; + } - if ( $extra->{check_option} ) { - $create .= ' WITH ' . uc $extra->{check_option} . ' CHECK OPTION'; - } + if ($extra->{check_option}) { + $create .= ' WITH ' . uc $extra->{check_option} . ' CHECK OPTION'; + } - return $create; + return $create; } # Returns a enum custom type name and list of values iff the field looks like an enum. sub _enum_typename_and_values { - my $field = shift; - if (ref $field->extra->{list} eq 'ARRAY') { # can't do anything unless we know the list - if ($field->extra->{custom_type_name}) { - return ( $field->extra->{custom_type_name}, $field->extra->{list} ); - } elsif ($field->data_type eq 'enum') { - my $name= $field->table->name . '_' . $field->name . '_type'; - return ( $name, $field->extra->{list} ); - } + my $field = shift; + if (ref $field->extra->{list} eq 'ARRAY') { # can't do anything unless we know the list + if ($field->extra->{custom_type_name}) { + return ($field->extra->{custom_type_name}, $field->extra->{list}); + } elsif ($field->data_type eq 'enum') { + my $name = $field->table->name . '_' . $field->name . '_type'; + return ($name, $field->extra->{list}); } - return (); + } + return (); } { - my %field_name_scope; + my %field_name_scope; - sub create_field - { - my ($field, $options) = @_; - - my $generator = _generator($options); - my $table_name = $field->table->name; - my $constraint_defs = $options->{constraint_defs} || []; - my $postgres_version = $options->{postgres_version} || 0; - my $type_defs = $options->{type_defs} || {}; - my $attach_comments = $options->{attach_comments}; - - $field_name_scope{$table_name} ||= {}; - my $field_name = $field->name; - - my $field_comments = ''; - if ( !$attach_comments and my $comments = $field->comments ) { - $comments =~ s/(?quote($field_name); - - # - # Datatype - # - my $data_type = lc $field->data_type; - my %extra = $field->extra; - my ($enum_typename, $list) = _enum_typename_and_values($field); - - if ($postgres_version >= 8.003 && $enum_typename) { - my $commalist = join( ', ', map { __PACKAGE__->_quote_string($_) } @$list ); - $field_def .= ' '. $enum_typename; - my $new_type_def = "DROP TYPE IF EXISTS $enum_typename CASCADE;\n" . - "CREATE TYPE $enum_typename AS ENUM ($commalist)"; - if (! exists $type_defs->{$enum_typename} ) { - $type_defs->{$enum_typename} = $new_type_def; - } elsif ( $type_defs->{$enum_typename} ne $new_type_def ) { - die "Attempted to redefine type name '$enum_typename' as a different type.\n"; - } - } else { - $field_def .= ' '. convert_datatype($field); - } + my $generator = _generator($options); + my $table_name = $field->table->name; + my $constraint_defs = $options->{constraint_defs} || []; + my $postgres_version = $options->{postgres_version} || 0; + my $type_defs = $options->{type_defs} || {}; + my $attach_comments = $options->{attach_comments}; - # - # Default value - # - __PACKAGE__->_apply_default_value( - $field, - \$field_def, - [ - 'NULL' => \'NULL', - 'now()' => 'now()', - 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP', - ], - ); + $field_name_scope{$table_name} ||= {}; + my $field_name = $field->name; - # - # Not null constraint - # - $field_def .= ' NOT NULL' unless $field->is_nullable; - - # - # Geometry constraints - # - if (is_geometry($field)) { - foreach ( create_geometry_constraints($field, $options) ) { - my ($cdefs, $fks) = create_constraint($_, $options); - push @$constraint_defs, @$cdefs; - push @$fks, @$fks; - } - } + my $field_comments = ''; + if (!$attach_comments and my $comments = $field->comments) { + $comments =~ s/(?quote($field_name); + + # + # Datatype + # + my $data_type = lc $field->data_type; + my %extra = $field->extra; + my ($enum_typename, $list) = _enum_typename_and_values($field); + + if ($postgres_version >= 8.003 && $enum_typename) { + my $commalist = join(', ', map { __PACKAGE__->_quote_string($_) } @$list); + $field_def .= ' ' . $enum_typename; + my $new_type_def + = "DROP TYPE IF EXISTS $enum_typename CASCADE;\n" . "CREATE TYPE $enum_typename AS ENUM ($commalist)"; + if (!exists $type_defs->{$enum_typename}) { + $type_defs->{$enum_typename} = $new_type_def; + } elsif ($type_defs->{$enum_typename} ne $new_type_def) { + die "Attempted to redefine type name '$enum_typename' as a different type.\n"; + } + } else { + $field_def .= ' ' . convert_datatype($field); + } + + # + # Default value + # + __PACKAGE__->_apply_default_value( + $field, + \$field_def, + [ + 'NULL' => \'NULL', + 'now()' => 'now()', + 'CURRENT_TIMESTAMP' => 'CURRENT_TIMESTAMP', + ], + ); + + # + # Not null constraint + # + $field_def .= ' NOT NULL' unless $field->is_nullable; + + # + # Geometry constraints + # + if (is_geometry($field)) { + foreach (create_geometry_constraints($field, $options)) { + my ($cdefs, $fks) = create_constraint($_, $options); + push @$constraint_defs, @$cdefs; + push @$fks, @$fks; + } } + + return $field_def; + } } sub create_geometry_constraints { - my ($field, $options) = @_; - - my $fname = _generator($options)->quote($field); - my @constraints; - push @constraints, SQL::Translator::Schema::Constraint->new( - name => "enforce_dims_".$field->name, - expression => "(ST_NDims($fname) = ".$field->extra->{dimensions}.")", - table => $field->table, + my ($field, $options) = @_; + + my $fname = _generator($options)->quote($field); + my @constraints; + push @constraints, + SQL::Translator::Schema::Constraint->new( + name => "enforce_dims_" . $field->name, + expression => "(ST_NDims($fname) = " . $field->extra->{dimensions} . ")", + table => $field->table, type => CHECK_C, - ); + ); - push @constraints, SQL::Translator::Schema::Constraint->new( - name => "enforce_srid_".$field->name, - expression => "(ST_SRID($fname) = ".$field->extra->{srid}.")", - table => $field->table, + push @constraints, + SQL::Translator::Schema::Constraint->new( + name => "enforce_srid_" . $field->name, + expression => "(ST_SRID($fname) = " . $field->extra->{srid} . ")", + table => $field->table, type => CHECK_C, - ); - push @constraints, SQL::Translator::Schema::Constraint->new( - name => "enforce_geotype_".$field->name, - expression => "(GeometryType($fname) = ". __PACKAGE__->_quote_string($field->extra->{geometry_type}) ."::text OR $fname IS NULL)", - table => $field->table, - type => CHECK_C, - ); + ); + push @constraints, + SQL::Translator::Schema::Constraint->new( + name => "enforce_geotype_" . $field->name, + expression => "(GeometryType($fname) = " + . __PACKAGE__->_quote_string($field->extra->{geometry_type}) + . "::text OR $fname IS NULL)", + table => $field->table, + type => CHECK_C, + ); - return @constraints; + return @constraints; } sub _extract_extras_from_options { @@ -623,590 +647,555 @@ sub _extract_extras_from_options { for my $key (keys %$opt) { my $val = $opt->{$key}; next unless defined $val; - $dispatcher->{lc $key}->($val); + $dispatcher->{ lc $key }->($val); } } } } { - my %index_name; - sub create_index - { - my ($index, $options) = @_; - - my $generator = _generator($options); - my $table_name = $index->table->name; - my $postgres_version = $options->{postgres_version} || 0; - - my ($index_def, @constraint_defs); - - my $name - = $index->name - || join('_', $table_name, 'idx', ++$index_name{ $table_name }); - - my $type = $index->type || NORMAL; - my @fields = $index->fields; - return unless @fields; - - my %index_extras; - _extract_extras_from_options($index, { - using => sub { $index_extras{using} = "USING $_[0]" }, - where => sub { $index_extras{where} = "WHERE $_[0]" }, - include => sub { - my ($value) = @_; - return unless $postgres_version >= 11; - die 'Include list must be an arrayref' unless ref $value eq 'ARRAY'; - my $value_list = join ', ', @$value; - $index_extras{include} = "INCLUDE ($value_list)" - } - }); - - my $def_start = 'CONSTRAINT ' . $generator->quote($name) . ' '; - my $field_names = '(' . join(", ", (map { $_ =~ /\(.*\)/ ? $_ : ( $generator->quote($_) ) } @fields)) . ')'; - if ( $type eq PRIMARY_KEY ) { - push @constraint_defs, "${def_start}PRIMARY KEY ".$field_names; - } - elsif ( $type eq UNIQUE ) { - push @constraint_defs, "${def_start}UNIQUE " .$field_names; - } - elsif ( $type eq NORMAL ) { - $index_def = - 'CREATE INDEX ' . $generator->quote($name) . ' on ' . $generator->quote($table_name) . ' ' . - join ' ', grep { defined } $index_extras{using}, $field_names, @index_extras{'include', 'where'}; - } - else { - warn "Unknown index type ($type) on table $table_name.\n" - if $WARN; - } - - return $index_def, \@constraint_defs; - } -} + my %index_name; -sub create_constraint -{ - my ($c, $options) = @_; + sub create_index { + my ($index, $options) = @_; - my $generator = _generator($options); + my $generator = _generator($options); + my $table_name = $index->table->name; my $postgres_version = $options->{postgres_version} || 0; - my $table_name = $c->table->name; - my (@constraint_defs, @fks); - my %constraint_extras; - _extract_extras_from_options($c, { - using => sub { $constraint_extras{using} = "USING $_[0]" }, - where => sub { $constraint_extras{where} = "WHERE ( $_[0] )" }, + + my ($index_def, @constraint_defs); + + my $name = $index->name + || join('_', $table_name, 'idx', ++$index_name{$table_name}); + + my $type = $index->type || NORMAL; + my @fields = $index->fields; + return unless @fields; + + my %index_extras; + _extract_extras_from_options( + $index, + { + using => sub { $index_extras{using} = "USING $_[0]" }, + where => sub { $index_extras{where} = "WHERE $_[0]" }, include => sub { my ($value) = @_; return unless $postgres_version >= 11; - die 'Include list must be an arrayref' unless ref $value eq 'ARRAY'; + die 'Include list must be an arrayref' + unless ref $value eq 'ARRAY'; my $value_list = join ', ', @$value; - $constraint_extras{include} = "INCLUDE ( $value_list )" - }, - }); + $index_extras{include} = "INCLUDE ($value_list)"; + } + } + ); - my $name = $c->name || ''; + my $def_start = 'CONSTRAINT ' . $generator->quote($name) . ' '; + my $field_names = '(' . join(", ", (map { $_ =~ /\(.*\)/ ? $_ : ($generator->quote($_)) } @fields)) . ')'; + if ($type eq PRIMARY_KEY) { + push @constraint_defs, "${def_start}PRIMARY KEY " . $field_names; + } elsif ($type eq UNIQUE) { + push @constraint_defs, "${def_start}UNIQUE " . $field_names; + } elsif ($type eq NORMAL) { + $index_def + = 'CREATE INDEX ' . $generator->quote($name) . ' on ' . $generator->quote($table_name) . ' ' . join ' ', + grep {defined} $index_extras{using}, $field_names, + @index_extras{ 'include', 'where' }; + } else { + warn "Unknown index type ($type) on table $table_name.\n" + if $WARN; + } - my @fields = grep { defined } $c->fields; + return $index_def, \@constraint_defs; + } +} - my @rfields = grep { defined } $c->reference_fields; +sub create_constraint { + my ($c, $options) = @_; - return if !@fields && ($c->type ne CHECK_C && $c->type ne EXCLUDE); - my $def_start = $name ? 'CONSTRAINT ' . $generator->quote($name) : ''; - my $field_names = '(' . join(", ", (map { $_ =~ /\(.*\)/ ? $_ : ( $generator->quote($_) ) } @fields)) . ')'; - my $include = $constraint_extras{include} || ''; - if ( $c->type eq PRIMARY_KEY ) { - push @constraint_defs, join ' ', grep $_, $def_start, "PRIMARY KEY", $field_names, $include; - } - elsif ( $c->type eq UNIQUE ) { - push @constraint_defs, join ' ', grep $_, $def_start, "UNIQUE", $field_names, $include; - } - elsif ( $c->type eq CHECK_C ) { - my $expression = $c->expression; - push @constraint_defs, join ' ', grep $_, $def_start, "CHECK ($expression)"; + my $generator = _generator($options); + my $postgres_version = $options->{postgres_version} || 0; + my $table_name = $c->table->name; + my (@constraint_defs, @fks); + my %constraint_extras; + _extract_extras_from_options( + $c, + { + using => sub { $constraint_extras{using} = "USING $_[0]" }, + where => sub { $constraint_extras{where} = "WHERE ( $_[0] )" }, + include => sub { + my ($value) = @_; + return unless $postgres_version >= 11; + die 'Include list must be an arrayref' + unless ref $value eq 'ARRAY'; + my $value_list = join ', ', @$value; + $constraint_extras{include} = "INCLUDE ( $value_list )"; + }, } - elsif ( $c->type eq FOREIGN_KEY ) { - my $def .= join ' ', grep $_, "ALTER TABLE", $generator->quote($table_name), 'ADD', $def_start, "FOREIGN KEY $field_names"; - $def .= "\n REFERENCES " . $generator->quote($c->reference_table); - - if ( @rfields ) { - $def .= ' (' . join( ', ', map { $generator->quote($_) } @rfields ) . ')'; - } - - if ( $c->match_type ) { - $def .= ' MATCH ' . - ( $c->match_type =~ /full/i ) ? 'FULL' : 'PARTIAL'; - } + ); - if ( $c->on_delete ) { - $def .= ' ON DELETE '. $c->on_delete; - } + my $name = $c->name || ''; + + my @fields = grep {defined} $c->fields; + + my @rfields = grep {defined} $c->reference_fields; + + return if !@fields && ($c->type ne CHECK_C && $c->type ne EXCLUDE); + my $def_start = $name ? 'CONSTRAINT ' . $generator->quote($name) : ''; + my $field_names = '(' . join(", ", (map { $_ =~ /\(.*\)/ ? $_ : ($generator->quote($_)) } @fields)) . ')'; + my $include = $constraint_extras{include} || ''; + if ($c->type eq PRIMARY_KEY) { + push @constraint_defs, join ' ', grep $_, $def_start, "PRIMARY KEY", $field_names, $include; + } elsif ($c->type eq UNIQUE) { + push @constraint_defs, join ' ', grep $_, $def_start, "UNIQUE", $field_names, $include; + } elsif ($c->type eq CHECK_C) { + my $expression = $c->expression; + push @constraint_defs, join ' ', grep $_, $def_start, "CHECK ($expression)"; + } elsif ($c->type eq FOREIGN_KEY) { + my $def .= join ' ', grep $_, "ALTER TABLE", + $generator->quote($table_name), 'ADD', $def_start, + "FOREIGN KEY $field_names"; + $def .= "\n REFERENCES " . $generator->quote($c->reference_table); + + if (@rfields) { + $def .= ' (' . join(', ', map { $generator->quote($_) } @rfields) . ')'; + } - if ( $c->on_update ) { - $def .= ' ON UPDATE '. $c->on_update; - } + if ($c->match_type) { + $def .= ' MATCH ' . ($c->match_type =~ /full/i) ? 'FULL' : 'PARTIAL'; + } - if ( $c->deferrable ) { - $def .= ' DEFERRABLE'; - } + if ($c->on_delete) { + $def .= ' ON DELETE ' . $c->on_delete; + } - push @fks, "$def"; + if ($c->on_update) { + $def .= ' ON UPDATE ' . $c->on_update; } - elsif( $c->type eq EXCLUDE ) { - my $using = $constraint_extras{using} || ''; - my $expression = $c->expression; - my $where = $constraint_extras{where} || ''; - push @constraint_defs, join ' ', grep $_, $def_start, 'EXCLUDE', $using, "( $expression )", $include, $where; + + if ($c->deferrable) { + $def .= ' DEFERRABLE'; } - return \@constraint_defs, \@fks; + push @fks, "$def"; + } elsif ($c->type eq EXCLUDE) { + my $using = $constraint_extras{using} || ''; + my $expression = $c->expression; + my $where = $constraint_extras{where} || ''; + push @constraint_defs, join ' ', grep $_, $def_start, 'EXCLUDE', $using, "( $expression )", $include, $where; + } + + return \@constraint_defs, \@fks; } sub create_trigger { - my ($trigger,$options) = @_; + my ($trigger, $options) = @_; my $generator = _generator($options); my @statements; - push @statements, sprintf( 'DROP TRIGGER IF EXISTS %s', $generator->quote($trigger->name) ) - if $options->{add_drop_trigger}; + push @statements, sprintf('DROP TRIGGER IF EXISTS %s', $generator->quote($trigger->name)) + if $options->{add_drop_trigger}; my $scope = $trigger->scope || ''; $scope = " FOR EACH $scope" if $scope; - push @statements, sprintf( - 'CREATE TRIGGER %s %s %s ON %s%s %s', - $generator->quote($trigger->name), - $trigger->perform_action_when, - join( ' OR ', @{ $trigger->database_events } ), - $generator->quote($trigger->on_table), - $scope, - $trigger->action, - ); + push @statements, + sprintf( + 'CREATE TRIGGER %s %s %s ON %s%s %s', + $generator->quote($trigger->name), + $trigger->perform_action_when, + join(' OR ', @{ $trigger->database_events }), + $generator->quote($trigger->on_table), + $scope, $trigger->action, + ); return @statements; } -sub convert_datatype -{ - my ($field) = @_; - - my @size = $field->size; - my $data_type = lc $field->data_type; - my $array = $data_type =~ s/\[\]$//; - - if ( $data_type eq 'enum' ) { -# my $len = 0; -# $len = ($len < length($_)) ? length($_) : $len for (@$list); -# my $chk_name = mk_name( $table_name.'_'.$field_name, 'chk' ); -# push @$constraint_defs, -# 'CONSTRAINT "$chk_name" CHECK (' . $generator->quote(field_name) . -# qq[IN ($commalist))]; - $data_type = 'character varying'; - } - elsif ( $data_type eq 'set' ) { - $data_type = 'character varying'; - } - elsif ( $field->is_auto_increment ) { - if ( (defined $size[0] && $size[0] > 11) or $data_type eq 'bigint' ) { - $data_type = 'bigserial'; - } - else { - $data_type = 'serial'; - } - undef @size; - } - else { - $data_type = defined $translate{ lc $data_type } ? - $translate{ lc $data_type } : - $data_type; +sub convert_datatype { + my ($field) = @_; + + my @size = $field->size; + my $data_type = lc $field->data_type; + my $array = $data_type =~ s/\[\]$//; + + if ($data_type eq 'enum') { + + # my $len = 0; + # $len = ($len < length($_)) ? length($_) : $len for (@$list); + # my $chk_name = mk_name( $table_name.'_'.$field_name, 'chk' ); + # push @$constraint_defs, + # 'CONSTRAINT "$chk_name" CHECK (' . $generator->quote(field_name) . + # qq[IN ($commalist))]; + $data_type = 'character varying'; + } elsif ($data_type eq 'set') { + $data_type = 'character varying'; + } elsif ($field->is_auto_increment) { + if ((defined $size[0] && $size[0] > 11) or $data_type eq 'bigint') { + $data_type = 'bigserial'; + } else { + $data_type = 'serial'; } + undef @size; + } else { + $data_type + = defined $translate{ lc $data_type } + ? $translate{ lc $data_type } + : $data_type; + } - if ( $data_type =~ /^time/i || $data_type =~ /^interval/i ) { - if ( defined $size[0] && $size[0] > 6 ) { - $size[0] = 6; - } + if ($data_type =~ /^time/i || $data_type =~ /^interval/i) { + if (defined $size[0] && $size[0] > 6) { + $size[0] = 6; } + } - if ( $data_type eq 'integer' ) { - if ( defined $size[0] && $size[0] > 0) { - if ( $size[0] > 10 ) { - $data_type = 'bigint'; - } - elsif ( $size[0] < 5 ) { - $data_type = 'smallint'; - } - else { - $data_type = 'integer'; - } - } - else { - $data_type = 'integer'; - } + if ($data_type eq 'integer') { + if (defined $size[0] && $size[0] > 0) { + if ($size[0] > 10) { + $data_type = 'bigint'; + } elsif ($size[0] < 5) { + $data_type = 'smallint'; + } else { + $data_type = 'integer'; + } + } else { + $data_type = 'integer'; } + } - my $type_with_size = join('|', - 'bit', 'varbit', 'character', 'bit varying', 'character varying', - 'time', 'timestamp', 'interval', 'numeric', 'float' - ); + my $type_with_size = join('|', + 'bit', 'varbit', 'character', 'bit varying', 'character varying', + 'time', 'timestamp', 'interval', 'numeric', 'float'); - if ( $data_type !~ /$type_with_size/ ) { - @size = (); - } + if ($data_type !~ /$type_with_size/) { + @size = (); + } - if (defined $size[0] && $size[0] > 0 && $data_type =~ /^time/i ) { - $data_type =~ s/^(time.*?)( with.*)?$/$1($size[0])/; - $data_type .= $2 if(defined $2); - } elsif ( defined $size[0] && $size[0] > 0 ) { - $data_type .= '(' . join( ',', @size ) . ')'; - } - if($array) - { - $data_type .= '[]'; - } + if (defined $size[0] && $size[0] > 0 && $data_type =~ /^time/i) { + $data_type =~ s/^(time.*?)( with.*)?$/$1($size[0])/; + $data_type .= $2 if (defined $2); + } elsif (defined $size[0] && $size[0] > 0) { + $data_type .= '(' . join(',', @size) . ')'; + } + if ($array) { + $data_type .= '[]'; + } - # - # Geography - # - if($data_type eq 'geography'){ - $data_type .= '('.$field->extra->{geography_type}.','. $field->extra->{srid} .')' - } + # + # Geography + # + if ($data_type eq 'geography') { + $data_type .= '(' . $field->extra->{geography_type} . ',' . $field->extra->{srid} . ')'; + } - return $data_type; + return $data_type; } +sub alter_field { + my ($from_field, $to_field, $options) = @_; -sub alter_field -{ - my ($from_field, $to_field, $options) = @_; - - die "Can't alter field in another table" - if($from_field->table->name ne $to_field->table->name); - - my $generator = _generator($options); - my @out; - - # drop geometry column and constraints - push @out, - drop_geometry_column($from_field, $options), - drop_geometry_constraints($from_field, $options), - if is_geometry($from_field); - - # it's necessary to start with rename column cause this would affect - # all of the following statements which would be broken if do the - # rename later - # BUT: drop geometry is done before the rename, cause it work's on the - # $from_field directly - push @out, sprintf('ALTER TABLE %s RENAME COLUMN %s TO %s', - map($generator->quote($_), - $to_field->table->name, - $from_field->name, - $to_field->name, - ), - ) - if($from_field->name ne $to_field->name); - - push @out, sprintf('ALTER TABLE %s ALTER COLUMN %s SET NOT NULL', - map($generator->quote($_), - $to_field->table->name, - $to_field->name - ), - ) - if(!$to_field->is_nullable and $from_field->is_nullable); - - push @out, sprintf('ALTER TABLE %s ALTER COLUMN %s DROP NOT NULL', - map($generator->quote($_), - $to_field->table->name, - $to_field->name - ), - ) - if (!$from_field->is_nullable and $to_field->is_nullable); - - - my $from_dt = convert_datatype($from_field); - my $to_dt = convert_datatype($to_field); - push @out, sprintf('ALTER TABLE %s ALTER COLUMN %s TYPE %s', - map($generator->quote($_), - $to_field->table->name, - $to_field->name - ), - $to_dt, - ) - if($to_dt ne $from_dt); - - my ($from_enum_typename, $from_list) = _enum_typename_and_values($from_field); - my ($to_enum_typename, $to_list ) = _enum_typename_and_values($to_field); - if ($from_enum_typename && $to_enum_typename && $from_enum_typename eq $to_enum_typename) { - # See if new enum values were added, and update the enum - my %existing_vals = map +($_ => 1), @$from_list; - my %desired_vals = map +($_ => 1), @$to_list; - my @add_vals = grep !$existing_vals{$_}, keys %desired_vals; - my @del_vals = grep !$desired_vals{$_}, keys %existing_vals; - my $pg_ver_ok= ($options->{postgres_version} || 0) >= 9.001; - push @out, '-- Set $sqlt->producer_args->{postgres_version} >= 9.001 to alter enums' - if !$pg_ver_ok && @add_vals; - for (@add_vals) { - push @out, sprintf '%sALTER TYPE %s ADD VALUE IF NOT EXISTS %s', - ($pg_ver_ok? '':'-- '), $to_enum_typename, $generator->quote_string($_); - } - push @out, "-- Unimplemented: delete values from enum type '$to_enum_typename': ".join(", ", @del_vals) - if @del_vals; + die "Can't alter field in another table" + if ($from_field->table->name ne $to_field->table->name); + + my $generator = _generator($options); + my @out; + + # drop geometry column and constraints + push @out, drop_geometry_column($from_field, $options), drop_geometry_constraints($from_field, $options), + if is_geometry($from_field); + + # it's necessary to start with rename column cause this would affect + # all of the following statements which would be broken if do the + # rename later + # BUT: drop geometry is done before the rename, cause it work's on the + # $from_field directly + push @out, + sprintf('ALTER TABLE %s RENAME COLUMN %s TO %s', + map($generator->quote($_), $to_field->table->name, $from_field->name, $to_field->name,),) + if ($from_field->name ne $to_field->name); + + push @out, + sprintf('ALTER TABLE %s ALTER COLUMN %s SET NOT NULL', + map($generator->quote($_), $to_field->table->name, $to_field->name),) + if (!$to_field->is_nullable and $from_field->is_nullable); + + push @out, + sprintf('ALTER TABLE %s ALTER COLUMN %s DROP NOT NULL', + map($generator->quote($_), $to_field->table->name, $to_field->name),) + if (!$from_field->is_nullable and $to_field->is_nullable); + + my $from_dt = convert_datatype($from_field); + my $to_dt = convert_datatype($to_field); + push @out, + sprintf('ALTER TABLE %s ALTER COLUMN %s TYPE %s', + map($generator->quote($_), $to_field->table->name, $to_field->name), $to_dt,) + if ($to_dt ne $from_dt); + + my ($from_enum_typename, $from_list) = _enum_typename_and_values($from_field); + my ($to_enum_typename, $to_list) = _enum_typename_and_values($to_field); + if ( $from_enum_typename + && $to_enum_typename + && $from_enum_typename eq $to_enum_typename) { + # See if new enum values were added, and update the enum + my %existing_vals = map +($_ => 1), @$from_list; + my %desired_vals = map +($_ => 1), @$to_list; + my @add_vals = grep !$existing_vals{$_}, keys %desired_vals; + my @del_vals = grep !$desired_vals{$_}, keys %existing_vals; + my $pg_ver_ok = ($options->{postgres_version} || 0) >= 9.001; + push @out, '-- Set $sqlt->producer_args->{postgres_version} >= 9.001 to alter enums' + if !$pg_ver_ok && @add_vals; + for (@add_vals) { + push @out, sprintf '%sALTER TYPE %s ADD VALUE IF NOT EXISTS %s', + ($pg_ver_ok ? '' : '-- '), $to_enum_typename, + $generator->quote_string($_); } + push @out, "-- Unimplemented: delete values from enum type '$to_enum_typename': " . join(", ", @del_vals) + if @del_vals; + } - my $old_default = $from_field->default_value; - my $new_default = $to_field->default_value; - my $default_value = $to_field->default_value; + my $old_default = $from_field->default_value; + my $new_default = $to_field->default_value; + my $default_value = $to_field->default_value; + + # fixes bug where output like this was created: + # ALTER TABLE users ALTER COLUMN column SET DEFAULT ThisIsUnescaped; + if (ref $default_value eq "SCALAR") { + $default_value = $$default_value; + } elsif (defined $default_value + && $to_dt =~ /^(character|text|timestamp|date)/xsmi) { + $default_value = __PACKAGE__->_quote_string($default_value); + } - # fixes bug where output like this was created: - # ALTER TABLE users ALTER COLUMN column SET DEFAULT ThisIsUnescaped; - if(ref $default_value eq "SCALAR" ) { - $default_value = $$default_value; - } elsif( defined $default_value && $to_dt =~ /^(character|text|timestamp|date)/xsmi ) { - $default_value = __PACKAGE__->_quote_string($default_value); - } + push @out, + sprintf( + 'ALTER TABLE %s ALTER COLUMN %s SET DEFAULT %s', + map($generator->quote($_), $to_field->table->name, $to_field->name,), + $default_value, + ) + if (defined $new_default + && (!defined $old_default || $old_default ne $new_default)); - push @out, sprintf('ALTER TABLE %s ALTER COLUMN %s SET DEFAULT %s', - map($generator->quote($_), - $to_field->table->name, - $to_field->name, - ), - $default_value, - ) - if ( defined $new_default && - (!defined $old_default || $old_default ne $new_default) ); - - # fixes bug where removing the DEFAULT statement of a column - # would result in no change - - push @out, sprintf('ALTER TABLE %s ALTER COLUMN %s DROP DEFAULT', - map($generator->quote($_), - $to_field->table->name, - $to_field->name, - ), - ) - if ( !defined $new_default && defined $old_default ); - - # add geometry column and constraints - push @out, - add_geometry_column($to_field, $options), - add_geometry_constraints($to_field, $options), - if is_geometry($to_field); - - return wantarray ? @out : join(";\n", @out); + # fixes bug where removing the DEFAULT statement of a column + # would result in no change + + push @out, + sprintf('ALTER TABLE %s ALTER COLUMN %s DROP DEFAULT', + map($generator->quote($_), $to_field->table->name, $to_field->name,),) + if (!defined $new_default && defined $old_default); + + # add geometry column and constraints + push @out, add_geometry_column($to_field, $options), add_geometry_constraints($to_field, $options), + if is_geometry($to_field); + + return wantarray ? @out : join(";\n", @out); } sub rename_field { alter_field(@_) } -sub add_field -{ - my ($new_field,$options) = @_; +sub add_field { + my ($new_field, $options) = @_; - my $out = sprintf('ALTER TABLE %s ADD COLUMN %s', - _generator($options)->quote($new_field->table->name), - create_field($new_field, $options)); - $out .= ";\n".add_geometry_column($new_field, $options) - . ";\n".add_geometry_constraints($new_field, $options) - if is_geometry($new_field); - return $out; + my $out = sprintf( + 'ALTER TABLE %s ADD COLUMN %s', + _generator($options)->quote($new_field->table->name), + create_field($new_field, $options) + ); + $out .= ";\n" . add_geometry_column($new_field, $options) . ";\n" . add_geometry_constraints($new_field, $options) + if is_geometry($new_field); + return $out; } -sub drop_field -{ - my ($old_field, $options) = @_; +sub drop_field { + my ($old_field, $options) = @_; - my $generator = _generator($options); + my $generator = _generator($options); - my $out = sprintf('ALTER TABLE %s DROP COLUMN %s', - $generator->quote($old_field->table->name), - $generator->quote($old_field->name)); - $out .= ";\n".drop_geometry_column($old_field, $options) - if is_geometry($old_field); - return $out; + my $out = sprintf( + 'ALTER TABLE %s DROP COLUMN %s', + $generator->quote($old_field->table->name), + $generator->quote($old_field->name) + ); + $out .= ";\n" . drop_geometry_column($old_field, $options) + if is_geometry($old_field); + return $out; } sub add_geometry_column { - my ($field, $options) = @_; - - return sprintf( - "INSERT INTO geometry_columns VALUES (%s,%s,%s,%s,%s,%s,%s)", - map(__PACKAGE__->_quote_string($_), - '', - $field->table->schema->name, - $options->{table} ? $options->{table} : $field->table->name, - $field->name, - $field->extra->{dimensions}, - $field->extra->{srid}, - $field->extra->{geometry_type}, - ), - ); + my ($field, $options) = @_; + + return sprintf( + "INSERT INTO geometry_columns VALUES (%s,%s,%s,%s,%s,%s,%s)", + map(__PACKAGE__->_quote_string($_), + '', + $field->table->schema->name, + $options->{table} ? $options->{table} : $field->table->name, + $field->name, + $field->extra->{dimensions}, + $field->extra->{srid}, + $field->extra->{geometry_type}, + ), + ); } sub drop_geometry_column { - my ($field) = @_; - - return sprintf( - "DELETE FROM geometry_columns WHERE f_table_schema = %s AND f_table_name = %s AND f_geometry_column = %s", - map(__PACKAGE__->_quote_string($_), - $field->table->schema->name, - $field->table->name, - $field->name, - ), - ); + my ($field) = @_; + + return + sprintf("DELETE FROM geometry_columns WHERE f_table_schema = %s AND f_table_name = %s AND f_geometry_column = %s", + map(__PACKAGE__->_quote_string($_), $field->table->schema->name, $field->table->name, $field->name,),); } sub add_geometry_constraints { - my ($field, $options) = @_; + my ($field, $options) = @_; - return join(";\n", map { alter_create_constraint($_, $options) } - create_geometry_constraints($field, $options)); + return join(";\n", map { alter_create_constraint($_, $options) } create_geometry_constraints($field, $options)); } sub drop_geometry_constraints { - my ($field, $options) = @_; + my ($field, $options) = @_; - return join(";\n", map { alter_drop_constraint($_, $options) } - create_geometry_constraints($field, $options)); + return join(";\n", map { alter_drop_constraint($_, $options) } create_geometry_constraints($field, $options)); } sub alter_table { - my ($to_table, $options) = @_; - my $generator = _generator($options); - my $out = sprintf('ALTER TABLE %s %s', - $generator->quote($to_table->name), - $options->{alter_table_action}); - $out .= ";\n".$options->{geometry_changes} if $options->{geometry_changes}; - return $out; + my ($to_table, $options) = @_; + my $generator = _generator($options); + my $out = sprintf('ALTER TABLE %s %s', $generator->quote($to_table->name), $options->{alter_table_action}); + $out .= ";\n" . $options->{geometry_changes} + if $options->{geometry_changes}; + return $out; } sub rename_table { - my ($old_table, $new_table, $options) = @_; - my $generator = _generator($options); - $options->{alter_table_action} = "RENAME TO " . $generator->quote($new_table); + my ($old_table, $new_table, $options) = @_; + my $generator = _generator($options); + $options->{alter_table_action} = "RENAME TO " . $generator->quote($new_table); - my @geometry_changes = map { - drop_geometry_column($_, $options), - add_geometry_column($_, { %{$options}, table => $new_table }), - } grep { is_geometry($_) } $old_table->get_fields; + my @geometry_changes + = map { drop_geometry_column($_, $options), add_geometry_column($_, { %{$options}, table => $new_table }), } + grep { is_geometry($_) } $old_table->get_fields; - $options->{geometry_changes} = join (";\n",@geometry_changes) if @geometry_changes; + $options->{geometry_changes} = join(";\n", @geometry_changes) + if @geometry_changes; - return alter_table($old_table, $options); + return alter_table($old_table, $options); } sub alter_create_index { - my ($index, $options) = @_; - my $generator = _generator($options); - my ($idef, $constraints) = create_index($index, $options); - return $index->type eq NORMAL ? $idef - : sprintf('ALTER TABLE %s ADD %s', - $generator->quote($index->table->name), - join(q{}, @$constraints) - ); + my ($index, $options) = @_; + my $generator = _generator($options); + my ($idef, $constraints) = create_index($index, $options); + return $index->type eq NORMAL + ? $idef + : sprintf('ALTER TABLE %s ADD %s', $generator->quote($index->table->name), join(q{}, @$constraints)); } sub alter_drop_index { - my ($index, $options) = @_; - return 'DROP INDEX '. _generator($options)->quote($index->name); + my ($index, $options) = @_; + return 'DROP INDEX ' . _generator($options)->quote($index->name); } sub alter_drop_constraint { - my ($c, $options) = @_; - my $generator = _generator($options); + my ($c, $options) = @_; + my $generator = _generator($options); - # NOT NULL constraint does not require a DROP CONSTRAINT statement - if ( $c->type eq NOT_NULL) { - return; - } + # NOT NULL constraint does not require a DROP CONSTRAINT statement + if ($c->type eq NOT_NULL) { + return; + } - # attention: Postgres has a very special naming structure for naming - # foreign keys and primary keys. It names them using the name of the - # table as prefix and fkey or pkey as suffix, concatenated by an underscore - my $c_name; - if( $c->name ) { - # Already has a name, just use it - $c_name = $c->name; - } else { - # if the name is dotted we need the table, not schema nor database - my ($tablename) = reverse split /[.]/, $c->table->name; - if ( $c->type eq FOREIGN_KEY ) { - # Doesn't have a name, and is foreign key, append '_fkey' - $c_name = $tablename . '_' . ($c->fields)[0] . '_fkey'; - } elsif ( $c->type eq PRIMARY_KEY ) { - # Doesn't have a name, and is primary key, append '_pkey' - $c_name = $tablename . '_pkey'; - } + # attention: Postgres has a very special naming structure for naming + # foreign keys and primary keys. It names them using the name of the + # table as prefix and fkey or pkey as suffix, concatenated by an underscore + my $c_name; + if ($c->name) { + + # Already has a name, just use it + $c_name = $c->name; + } else { + # if the name is dotted we need the table, not schema nor database + my ($tablename) = reverse split /[.]/, $c->table->name; + if ($c->type eq FOREIGN_KEY) { + + # Doesn't have a name, and is foreign key, append '_fkey' + $c_name = $tablename . '_' . ($c->fields)[0] . '_fkey'; + } elsif ($c->type eq PRIMARY_KEY) { + + # Doesn't have a name, and is primary key, append '_pkey' + $c_name = $tablename . '_pkey'; + } } - return sprintf( - 'ALTER TABLE %s DROP CONSTRAINT %s', - map { $generator->quote($_) } $c->table->name, $c_name, - ); + return sprintf('ALTER TABLE %s DROP CONSTRAINT %s', map { $generator->quote($_) } $c->table->name, $c_name,); } sub alter_create_constraint { - my ($index, $options) = @_; - my $generator = _generator($options); - my ($defs, $fks) = create_constraint(@_); - - # return if there are no constraint definitions so we don't run - # into output like this: - # ALTER TABLE users ADD ; - - return unless(@{$defs} || @{$fks}); - return $index->type eq FOREIGN_KEY ? join(q{}, @{$fks}) - : join( ' ', 'ALTER TABLE', $generator->quote($index->table->name), - 'ADD', join(q{}, @{$defs}, @{$fks}) - ); + my ($index, $options) = @_; + my $generator = _generator($options); + my ($defs, $fks) = create_constraint(@_); + + # return if there are no constraint definitions so we don't run + # into output like this: + # ALTER TABLE users ADD ; + + return unless (@{$defs} || @{$fks}); + return $index->type eq FOREIGN_KEY + ? join(q{}, @{$fks}) + : join(' ', 'ALTER TABLE', $generator->quote($index->table->name), 'ADD', join(q{}, @{$defs}, @{$fks})); } sub drop_table { - my ($table, $options) = @_; - my $generator = _generator($options); - my $out = "DROP TABLE " . $generator->quote($table) . " CASCADE"; + my ($table, $options) = @_; + my $generator = _generator($options); + my $out = "DROP TABLE " . $generator->quote($table) . " CASCADE"; - my @geometry_drops = map { drop_geometry_column($_); } grep { is_geometry($_) } $table->get_fields; + my @geometry_drops = map { drop_geometry_column($_); } + grep { is_geometry($_) } $table->get_fields; - $out .= join(";\n", '', @geometry_drops) if @geometry_drops; - return $out; + $out .= join(";\n", '', @geometry_drops) if @geometry_drops; + return $out; } sub batch_alter_table { - my ( $table, $diff_hash, $options ) = @_; + my ($table, $diff_hash, $options) = @_; # as long as we're not renaming the table we don't need to be here - if ( @{$diff_hash->{rename_table}} == 0 ) { + if (@{ $diff_hash->{rename_table} } == 0) { return batch_alter_table_statements($diff_hash, $options); } # first we need to perform drops which are on old table - my @sql = batch_alter_table_statements($diff_hash, $options, qw( - alter_drop_constraint - alter_drop_index - drop_field - )); + my @sql = batch_alter_table_statements( + $diff_hash, $options, qw( + alter_drop_constraint + alter_drop_index + drop_field + ) + ); # next comes the rename_table my $old_table = $diff_hash->{rename_table}[0][0]; - push @sql, rename_table( $old_table, $table, $options ); + push @sql, rename_table($old_table, $table, $options); # for alter_field (and so also rename_field) we need to make sure old # field has table name set to new table otherwise calling alter_field dies - $diff_hash->{alter_field} = - [map { $_->[0]->table($table) && $_ } @{$diff_hash->{alter_field}}]; - $diff_hash->{rename_field} = - [map { $_->[0]->table($table) && $_ } @{$diff_hash->{rename_field}}]; + $diff_hash->{alter_field} = [ map { $_->[0]->table($table) && $_ } @{ $diff_hash->{alter_field} } ]; + $diff_hash->{rename_field} = [ map { $_->[0]->table($table) && $_ } @{ $diff_hash->{rename_field} } ]; # now add everything else - push @sql, batch_alter_table_statements($diff_hash, $options, qw( - add_field - alter_field - rename_field - alter_create_index - alter_create_constraint - alter_table - )); + push @sql, batch_alter_table_statements( + $diff_hash, $options, qw( + add_field + alter_field + rename_field + alter_create_index + alter_create_constraint + alter_table + ) + ); return @sql; } diff --git a/lib/SQL/Translator/Producer/SQLServer.pm b/lib/SQL/Translator/Producer/SQLServer.pm index 6070dad92..cbf092cf2 100644 --- a/lib/SQL/Translator/Producer/SQLServer.pm +++ b/lib/SQL/Translator/Producer/SQLServer.pm @@ -2,7 +2,7 @@ package SQL::Translator::Producer::SQLServer; use strict; use warnings; -our ( $DEBUG, $WARN ); +our ($DEBUG, $WARN); our $VERSION = '1.64'; $DEBUG = 1 unless defined $DEBUG; @@ -13,9 +13,9 @@ use SQL::Translator::Generator::DDL::SQLServer; sub produce { my $translator = shift; SQL::Translator::Generator::DDL::SQLServer->new( - add_comments => !$translator->no_comments, + add_comments => !$translator->no_comments, add_drop_table => $translator->add_drop_table, - )->schema($translator->schema) + )->schema($translator->schema); } 1; diff --git a/lib/SQL/Translator/Producer/SQLite.pm b/lib/SQL/Translator/Producer/SQLite.pm index 51f98a807..a72c37d4a 100644 --- a/lib/SQL/Translator/Producer/SQLite.pm +++ b/lib/SQL/Translator/Producer/SQLite.pm @@ -24,12 +24,12 @@ use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(debug header_comment parse_dbms_version batch_alter_table_statements); use SQL::Translator::Generator::DDL::SQLite; -our ( $DEBUG, $WARN ); +our ($DEBUG, $WARN); our $VERSION = '1.64'; $DEBUG = 0 unless defined $DEBUG; -$WARN = 0 unless defined $WARN; +$WARN = 0 unless defined $WARN; -our $max_id_length = 30; +our $max_id_length = 30; my %global_names; # HIDEOUS TEMPORARY DEFAULT WITHOUT QUOTING! @@ -37,293 +37,293 @@ our $NO_QUOTES = 1; { my ($quoting_generator, $nonquoting_generator); + sub _generator { $NO_QUOTES - ? $nonquoting_generator ||= SQL::Translator::Generator::DDL::SQLite->new(quote_chars => []) - : $quoting_generator ||= SQL::Translator::Generator::DDL::SQLite->new + ? $nonquoting_generator ||= SQL::Translator::Generator::DDL::SQLite->new(quote_chars => []) + : $quoting_generator ||= SQL::Translator::Generator::DDL::SQLite->new; } } sub produce { - my $translator = shift; - local $DEBUG = $translator->debug; - local $WARN = $translator->show_warnings; - my $no_comments = $translator->no_comments; - my $add_drop_table = $translator->add_drop_table; - my $schema = $translator->schema; - my $producer_args = $translator->producer_args; - my $sqlite_version = parse_dbms_version( - $producer_args->{sqlite_version}, 'perl' - ); - my $no_txn = $producer_args->{no_transaction}; - - debug("PKG: Beginning production\n"); - - %global_names = (); #reset - - # only quote if quotes were requested for real - # 0E0 indicates "the default of true" was assumed - local $NO_QUOTES = 0 - if $translator->quote_identifiers and $translator->quote_identifiers ne '0E0'; - - my $head; - $head = (header_comment() . "\n") unless $no_comments; - - my @create = (); - - push @create, "BEGIN TRANSACTION" unless $no_txn; - - for my $table ( $schema->get_tables ) { - push @create, create_table($table, { no_comments => $no_comments, - sqlite_version => $sqlite_version, - add_drop_table => $add_drop_table,}); - } + my $translator = shift; + local $DEBUG = $translator->debug; + local $WARN = $translator->show_warnings; + my $no_comments = $translator->no_comments; + my $add_drop_table = $translator->add_drop_table; + my $schema = $translator->schema; + my $producer_args = $translator->producer_args; + my $sqlite_version = parse_dbms_version($producer_args->{sqlite_version}, 'perl'); + my $no_txn = $producer_args->{no_transaction}; + + debug("PKG: Beginning production\n"); + + %global_names = (); #reset + + # only quote if quotes were requested for real + # 0E0 indicates "the default of true" was assumed + local $NO_QUOTES = 0 + if $translator->quote_identifiers + and $translator->quote_identifiers ne '0E0'; + + my $head; + $head = (header_comment() . "\n") unless $no_comments; + + my @create = (); + + push @create, "BEGIN TRANSACTION" unless $no_txn; + + for my $table ($schema->get_tables) { + push @create, + create_table( + $table, + { + no_comments => $no_comments, + sqlite_version => $sqlite_version, + add_drop_table => $add_drop_table, + } + ); + } - for my $view ( $schema->get_views ) { - push @create, create_view($view, { - add_drop_view => $add_drop_table, - no_comments => $no_comments, - }); - } + for my $view ($schema->get_views) { + push @create, + create_view( + $view, + { + add_drop_view => $add_drop_table, + no_comments => $no_comments, + } + ); + } - for my $trigger ( $schema->get_triggers ) { - push @create, create_trigger($trigger, { - add_drop_trigger => $add_drop_table, - no_comments => $no_comments, - }); - } + for my $trigger ($schema->get_triggers) { + push @create, + create_trigger( + $trigger, + { + add_drop_trigger => $add_drop_table, + no_comments => $no_comments, + } + ); + } - push @create, "COMMIT" unless $no_txn; + push @create, "COMMIT" unless $no_txn; - if (wantarray) { - return ($head||(), @create); - } else { - return join ('', - $head||(), - join(";\n\n", @create ), - ";\n", - ); - } + if (wantarray) { + return ($head || (), @create); + } else { + return join('', $head || (), join(";\n\n", @create), ";\n",); + } } sub mk_name { - my ($name, $scope, $critical) = @_; + my ($name, $scope, $critical) = @_; - $scope ||= \%global_names; - if ( my $prev = $scope->{ $name } ) { - my $name_orig = $name; - $name .= sprintf( "%02d", ++$prev ); - substr($name, $max_id_length - 3) = "00" - if length( $name ) > $max_id_length; + $scope ||= \%global_names; + if (my $prev = $scope->{$name}) { + my $name_orig = $name; + $name .= sprintf("%02d", ++$prev); + substr($name, $max_id_length - 3) = "00" + if length($name) > $max_id_length; - warn "The name '$name_orig' has been changed to ", - "'$name' to make it unique.\n" if $WARN; + warn "The name '$name_orig' has been changed to ", "'$name' to make it unique.\n" + if $WARN; - $scope->{ $name_orig }++; - } + $scope->{$name_orig}++; + } - $scope->{ $name }++; - return _generator()->quote($name); + $scope->{$name}++; + return _generator()->quote($name); } sub create_view { - my ($view, $options) = @_; - my $add_drop_view = $options->{add_drop_view}; + my ($view, $options) = @_; + my $add_drop_view = $options->{add_drop_view}; - my $view_name = _generator()->quote($view->name); - $global_names{$view->name} = 1; + my $view_name = _generator()->quote($view->name); + $global_names{ $view->name } = 1; - debug("PKG: Looking at view '${view_name}'\n"); + debug("PKG: Looking at view '${view_name}'\n"); - # Header. Should this look like what mysqldump produces? - my $extra = $view->extra; - my @create; - push @create, "DROP VIEW IF EXISTS $view_name" if $add_drop_view; + # Header. Should this look like what mysqldump produces? + my $extra = $view->extra; + my @create; + push @create, "DROP VIEW IF EXISTS $view_name" if $add_drop_view; - my $create_view = 'CREATE'; - $create_view .= " TEMPORARY" if exists($extra->{temporary}) && $extra->{temporary}; - $create_view .= ' VIEW'; - $create_view .= " IF NOT EXISTS" if exists($extra->{if_not_exists}) && $extra->{if_not_exists}; - $create_view .= " ${view_name}"; + my $create_view = 'CREATE'; + $create_view .= " TEMPORARY" + if exists($extra->{temporary}) && $extra->{temporary}; + $create_view .= ' VIEW'; + $create_view .= " IF NOT EXISTS" + if exists($extra->{if_not_exists}) && $extra->{if_not_exists}; + $create_view .= " ${view_name}"; - if( my $sql = $view->sql ){ - $create_view .= " AS\n ${sql}"; - } - push @create, $create_view; + if (my $sql = $view->sql) { + $create_view .= " AS\n ${sql}"; + } + push @create, $create_view; - # Tack the comment onto the first statement. - unless ($options->{no_comments}) { - $create[0] = "--\n-- View: ${view_name}\n--\n" . $create[0]; - } + # Tack the comment onto the first statement. + unless ($options->{no_comments}) { + $create[0] = "--\n-- View: ${view_name}\n--\n" . $create[0]; + } - return @create; + return @create; } +sub create_table { + my ($table, $options) = @_; -sub create_table -{ - my ($table, $options) = @_; - - my $table_name = _generator()->quote($table->name); - $global_names{$table->name} = 1; - - my $no_comments = $options->{no_comments}; - my $add_drop_table = $options->{add_drop_table}; - my $sqlite_version = $options->{sqlite_version} || 0; - - debug("PKG: Looking at table '$table_name'\n"); - - my ( @index_defs, @constraint_defs ); - my @fields = $table->get_fields or die "No fields in $table_name"; - - my $temp = $options->{temporary_table} ? 'TEMPORARY ' : ''; - # - # Header. - # - my $exists = ($sqlite_version >= 3.003) ? ' IF EXISTS' : ''; - my @create; - my ($comment, $create_table) = ""; - $comment = "--\n-- Table: $table_name\n--\n" unless $no_comments; - if ($add_drop_table) { - push @create, $comment . qq[DROP TABLE$exists $table_name]; - } else { - $create_table = $comment; - } + my $table_name = _generator()->quote($table->name); + $global_names{ $table->name } = 1; - $create_table .= "CREATE ${temp}TABLE $table_name (\n"; + my $no_comments = $options->{no_comments}; + my $add_drop_table = $options->{add_drop_table}; + my $sqlite_version = $options->{sqlite_version} || 0; - # - # Comments - # - if ( $table->comments and !$no_comments ){ - $create_table .= "-- Comments: \n-- "; - $create_table .= join "\n-- ", $table->comments; - $create_table .= "\n--\n\n"; - } + debug("PKG: Looking at table '$table_name'\n"); - # - # How many fields in PK? - # - my $pk = $table->primary_key; - my @pk_fields = $pk ? $pk->fields : (); - - # - # Fields - # - my ( @field_defs, $pk_set ); - for my $field ( @fields ) { - push @field_defs, create_field($field); - } + my (@index_defs, @constraint_defs); + my @fields = $table->get_fields or die "No fields in $table_name"; - if ( - scalar @pk_fields > 1 - || - ( @pk_fields && !grep /INTEGER PRIMARY KEY/, @field_defs ) - ) { - push @field_defs, 'PRIMARY KEY (' . join(', ', map _generator()->quote($_), @pk_fields ) . ')'; - } + my $temp = $options->{temporary_table} ? 'TEMPORARY ' : ''; + # + # Header. + # + my $exists = ($sqlite_version >= 3.003) ? ' IF EXISTS' : ''; + my @create; + my ($comment, $create_table) = ""; + $comment = "--\n-- Table: $table_name\n--\n" unless $no_comments; + if ($add_drop_table) { + push @create, $comment . qq[DROP TABLE$exists $table_name]; + } else { + $create_table = $comment; + } - # - # Indices - # - for my $index ( $table->get_indices ) { - push @index_defs, create_index($index); - } + $create_table .= "CREATE ${temp}TABLE $table_name (\n"; - # - # Constraints - # - for my $c ( $table->get_constraints ) { - if ($c->type eq "FOREIGN KEY") { - push @field_defs, create_foreignkey($c); - } - elsif ($c->type eq "CHECK") { - push @field_defs, create_check_constraint($c); - } - next unless $c->type eq UNIQUE; - push @constraint_defs, create_constraint($c); + # + # Comments + # + if ($table->comments and !$no_comments) { + $create_table .= "-- Comments: \n-- "; + $create_table .= join "\n-- ", $table->comments; + $create_table .= "\n--\n\n"; + } + + # + # How many fields in PK? + # + my $pk = $table->primary_key; + my @pk_fields = $pk ? $pk->fields : (); + + # + # Fields + # + my (@field_defs, $pk_set); + for my $field (@fields) { + push @field_defs, create_field($field); + } + + if (scalar @pk_fields > 1 + || (@pk_fields && !grep /INTEGER PRIMARY KEY/, @field_defs)) { + push @field_defs, 'PRIMARY KEY (' . join(', ', map _generator()->quote($_), @pk_fields) . ')'; + } + + # + # Indices + # + for my $index ($table->get_indices) { + push @index_defs, create_index($index); + } + + # + # Constraints + # + for my $c ($table->get_constraints) { + if ($c->type eq "FOREIGN KEY") { + push @field_defs, create_foreignkey($c); + } elsif ($c->type eq "CHECK") { + push @field_defs, create_check_constraint($c); } + next unless $c->type eq UNIQUE; + push @constraint_defs, create_constraint($c); + } - $create_table .= join(",\n", map { " $_" } @field_defs ) . "\n)"; + $create_table .= join(",\n", map {" $_"} @field_defs) . "\n)"; - return (@create, $create_table, @index_defs, @constraint_defs ); + return (@create, $create_table, @index_defs, @constraint_defs); } sub create_check_constraint { - my $c = shift; - my $check = ''; - $check .= 'CONSTRAINT ' . _generator->quote( $c->name ) . ' ' if $c->name; - $check .= 'CHECK(' . $c->expression . ')'; - return $check; + my $c = shift; + my $check = ''; + $check .= 'CONSTRAINT ' . _generator->quote($c->name) . ' ' if $c->name; + $check .= 'CHECK(' . $c->expression . ')'; + return $check; } sub create_foreignkey { - my $c = shift; - - my @fields = $c->fields; - my @rfields = map { $_ || () } $c->reference_fields; - unless ( @rfields ) { - my $rtable_name = $c->reference_table; - if ( my $ref_table = $c->schema->get_table( $rtable_name ) ) { - push @rfields, $ref_table->primary_key; - - die "FK constraint on " . $rtable_name . '.' . join('', @fields) . " has no reference fields\n" - unless @rfields; - } - else { - die "Can't find reference table '$rtable_name' in schema\n"; - } + my $c = shift; + + my @fields = $c->fields; + my @rfields = map { $_ || () } $c->reference_fields; + unless (@rfields) { + my $rtable_name = $c->reference_table; + if (my $ref_table = $c->schema->get_table($rtable_name)) { + push @rfields, $ref_table->primary_key; + + die "FK constraint on " . $rtable_name . '.' . join('', @fields) . " has no reference fields\n" + unless @rfields; + } else { + die "Can't find reference table '$rtable_name' in schema\n"; } + } - my $fk_sql = sprintf 'FOREIGN KEY (%s) REFERENCES %s(%s)', - join (', ', map { _generator()->quote($_) } @fields ), - _generator()->quote($c->reference_table), - join (', ', map { _generator()->quote($_) } @rfields ) - ; + my $fk_sql = sprintf 'FOREIGN KEY (%s) REFERENCES %s(%s)', + join(', ', map { _generator()->quote($_) } @fields), + _generator()->quote($c->reference_table), + join(', ', map { _generator()->quote($_) } @rfields); - $fk_sql .= " ON DELETE " . $c->{on_delete} if $c->{on_delete}; - $fk_sql .= " ON UPDATE " . $c->{on_update} if $c->{on_update}; + $fk_sql .= " ON DELETE " . $c->{on_delete} if $c->{on_delete}; + $fk_sql .= " ON UPDATE " . $c->{on_update} if $c->{on_update}; - return $fk_sql; + return $fk_sql; } sub create_field { return _generator()->field($_[0]) } -sub create_index -{ - my ($index, $options) = @_; +sub create_index { + my ($index, $options) = @_; - (my $index_table_name = $index->table->name) =~ s/^.+?\.//; # table name may not specify schema - my $name = mk_name($index->name || "${index_table_name}_idx"); + (my $index_table_name = $index->table->name) =~ s/^.+?\.//; # table name may not specify schema + my $name = mk_name($index->name || "${index_table_name}_idx"); - my $type = $index->type eq 'UNIQUE' ? "UNIQUE " : ''; + my $type = $index->type eq 'UNIQUE' ? "UNIQUE " : ''; - # strip any field size qualifiers as SQLite doesn't like these - my @fields = map { s/\(\d+\)$//; _generator()->quote($_) } $index->fields; - $index_table_name = _generator()->quote($index_table_name); - warn "removing schema name from '" . $index->table->name . "' to make '$index_table_name'\n" if $WARN; - my $index_def = - "CREATE ${type}INDEX $name ON " . $index_table_name . - ' (' . join( ', ', @fields ) . ')'; + # strip any field size qualifiers as SQLite doesn't like these + my @fields = map { s/\(\d+\)$//; _generator()->quote($_) } $index->fields; + $index_table_name = _generator()->quote($index_table_name); + warn "removing schema name from '" . $index->table->name . "' to make '$index_table_name'\n" + if $WARN; + my $index_def = "CREATE ${type}INDEX $name ON " . $index_table_name . ' (' . join(', ', @fields) . ')'; - return $index_def; + return $index_def; } -sub create_constraint -{ - my ($c, $options) = @_; +sub create_constraint { + my ($c, $options) = @_; - (my $index_table_name = $c->table->name) =~ s/^.+?\.//; # table name may not specify schema - my $name = mk_name($c->name || "${index_table_name}_idx"); - my @fields = map _generator()->quote($_), $c->fields; - $index_table_name = _generator()->quote($index_table_name); - warn "removing schema name from '" . $c->table->name . "' to make '$index_table_name'\n" if $WARN; + (my $index_table_name = $c->table->name) =~ s/^.+?\.//; # table name may not specify schema + my $name = mk_name($c->name || "${index_table_name}_idx"); + my @fields = map _generator()->quote($_), $c->fields; + $index_table_name = _generator()->quote($index_table_name); + warn "removing schema name from '" . $c->table->name . "' to make '$index_table_name'\n" + if $WARN; - my $c_def = - "CREATE UNIQUE INDEX $name ON " . $index_table_name . - ' (' . join( ', ', @fields ) . ')'; + my $c_def = "CREATE UNIQUE INDEX $name ON " . $index_table_name . ' (' . join(', ', @fields) . ')'; - return $c_def; + return $c_def; } sub create_trigger { @@ -336,33 +336,33 @@ sub create_trigger { $global_names{$trigger_name} = 1; my $events = $trigger->database_events; - for my $evt ( @$events ) { + for my $evt (@$events) { my $trig_name = $trigger_name; if (@$events > 1) { $trig_name .= "_$evt"; - warn "Multiple database events supplied for trigger '$trigger_name', ", - "creating trigger '$trig_name' for the '$evt' event.\n" if $WARN; + warn + "Multiple database events supplied for trigger '$trigger_name', ", + "creating trigger '$trig_name' for the '$evt' event.\n" + if $WARN; } $trig_name = _generator()->quote($trig_name); - push @statements, "DROP TRIGGER IF EXISTS $trig_name" if $add_drop; - + push @statements, "DROP TRIGGER IF EXISTS $trig_name" if $add_drop; $DB::single = 1; my $action = ""; if (not ref $trigger->action) { $action = $trigger->action; $action = "BEGIN " . $action . " END" - unless $action =~ /^ \s* BEGIN [\s\;] .*? [\s\;] END [\s\;]* $/six; - } - else { + unless $action =~ /^ \s* BEGIN [\s\;] .*? [\s\;] END [\s\;]* $/six; + } else { $action = $trigger->action->{for_each} . " " - if $trigger->action->{for_each}; + if $trigger->action->{for_each}; $action = $trigger->action->{when} . " " - if $trigger->action->{when}; + if $trigger->action->{when}; my $steps = $trigger->action->{steps} || []; @@ -371,26 +371,23 @@ sub create_trigger { $action .= "END"; } - push @statements, sprintf ( - 'CREATE TRIGGER %s %s %s on %s %s', - $trig_name, - $trigger->perform_action_when, - $evt, - _generator()->quote($trigger->on_table), - $action - ); + push @statements, + sprintf( + 'CREATE TRIGGER %s %s %s on %s %s', + $trig_name, $trigger->perform_action_when, + $evt, _generator()->quote($trigger->on_table), $action + ); } return @statements; } -sub alter_table { () } # Noop +sub alter_table { () } # Noop sub add_field { my ($field) = @_; - return sprintf("ALTER TABLE %s ADD COLUMN %s", - _generator()->quote($field->table->name), create_field($field)) + return sprintf("ALTER TABLE %s ADD COLUMN %s", _generator()->quote($field->table->name), create_field($field)); } sub alter_create_index { @@ -411,8 +408,7 @@ sub alter_drop_constraint { alter_drop_index(@_) } sub alter_drop_index { my ($constraint) = @_; - return sprintf("DROP INDEX %s", - _generator()->quote($constraint->name)); + return sprintf("DROP INDEX %s", _generator()->quote($constraint->name)); } sub batch_alter_table { @@ -445,10 +441,9 @@ sub batch_alter_table { my $table_name = $table->name; - if ( @{$diffs->{rename_field}} == 0 && - @{$diffs->{alter_field}} == 0 && - @{$diffs->{drop_field}} == 0 - ) { + if ( @{ $diffs->{rename_field} } == 0 + && @{ $diffs->{alter_field} } == 0 + && @{ $diffs->{drop_field} } == 0) { return batch_alter_table_statements($diffs, $options); } @@ -459,7 +454,7 @@ sub batch_alter_table { my $old_table = $table; - if ( $diffs->{rename_table} && @{$diffs->{rename_table}} ) { + if ($diffs->{rename_table} && @{ $diffs->{rename_table} }) { $old_table = $diffs->{rename_table}[0][0]; } @@ -470,35 +465,36 @@ sub batch_alter_table { my %temp_table_fields; do { local $table->{name} = $temp_table_name; + # We only want the table - don't care about indexes on tmp table - my ($table_sql) = create_table($table, {no_comments => 1, temporary_table => 1}); - push @sql,$table_sql; + my ($table_sql) + = create_table($table, { no_comments => 1, temporary_table => 1 }); + push @sql, $table_sql; - %temp_table_fields = map { $_ => 1} $table->get_fields; + %temp_table_fields = map { $_ => 1 } $table->get_fields; }; # record renamed fields for later - my %rename_field = map { $_->[1]->name => $_->[0]->name } @{$diffs->{rename_field}}; + my %rename_field = map { $_->[1]->name => $_->[0]->name } @{ $diffs->{rename_field} }; # drop added fields from %temp_table_fields - delete @temp_table_fields{@{$diffs->{add_field}}}; + delete @temp_table_fields{ @{ $diffs->{add_field} } }; # INSERT INTO t1_backup SELECT a,b FROM t1; - push @sql, sprintf( 'INSERT INTO %s( %s) SELECT %s FROM %s', + push @sql, sprintf( + 'INSERT INTO %s( %s) SELECT %s FROM %s', - _generator()->quote( $temp_table_name ), + _generator()->quote($temp_table_name), - join( ', ', - map _generator()->quote($_), - grep { $temp_table_fields{$_} } $table->get_fields ), + join(', ', map _generator()->quote($_), grep { $temp_table_fields{$_} } $table->get_fields), - join( ', ', - map _generator()->quote($_), - map { $rename_field{$_} ? $rename_field{$_} : $_ } - grep { $temp_table_fields{$_} } $table->get_fields ), + join(', ', + map _generator()->quote($_), + map { $rename_field{$_} ? $rename_field{$_} : $_ } + grep { $temp_table_fields{$_} } $table->get_fields), - _generator()->quote( $old_table->name ) + _generator()->quote($old_table->name) ); # DROP TABLE t1; @@ -511,11 +507,13 @@ sub batch_alter_table { # INSERT INTO t1 SELECT a,b FROM t1_backup; - push @sql, sprintf('INSERT INTO %s SELECT %s FROM %s', - _generator()->quote($table_name), - join(', ', map _generator()->quote($_), $table->get_fields), - _generator()->quote($temp_table_name) - ); + push @sql, + sprintf( + 'INSERT INTO %s SELECT %s FROM %s', + _generator()->quote($table_name), + join(', ', map _generator()->quote($_), $table->get_fields), + _generator()->quote($temp_table_name) + ); # DROP TABLE t1_backup; diff --git a/lib/SQL/Translator/Producer/Storable.pm b/lib/SQL/Translator/Producer/Storable.pm index 3f6d858b6..e87874f61 100644 --- a/lib/SQL/Translator/Producer/Storable.pm +++ b/lib/SQL/Translator/Producer/Storable.pm @@ -23,7 +23,7 @@ takes a long time. use strict; use warnings; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); $DEBUG = 0 unless defined $DEBUG; our $VERSION = '1.64'; @@ -34,12 +34,12 @@ use base qw(Exporter); @EXPORT_OK = qw(produce); sub produce { - my $t = shift; - my $args = $t->producer_args; - my $schema = $t->schema; - my $serialized = Storable::nfreeze($schema); + my $t = shift; + my $args = $t->producer_args; + my $schema = $t->schema; + my $serialized = Storable::nfreeze($schema); - return $serialized; + return $serialized; } 1; diff --git a/lib/SQL/Translator/Producer/Sybase.pm b/lib/SQL/Translator/Producer/Sybase.pm index 562e12a88..a75a00893 100644 --- a/lib/SQL/Translator/Producer/Sybase.pm +++ b/lib/SQL/Translator/Producer/Sybase.pm @@ -19,7 +19,7 @@ This module will produce text output of the schema suitable for Sybase. use strict; use warnings; -our ( $DEBUG, $WARN ); +our ($DEBUG, $WARN); our $VERSION = '1.64'; $DEBUG = 1 unless defined $DEBUG; @@ -27,45 +27,45 @@ use Data::Dumper; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(debug header_comment); -my %translate = ( - # - # Sybase types - # - integer => 'numeric', - int => 'numeric', - number => 'numeric', - money => 'money', - varchar => 'varchar', - varchar2 => 'varchar', - timestamp => 'datetime', - text => 'varchar', - real => 'double precision', - comment => 'text', - bit => 'bit', - tinyint => 'smallint', - float => 'double precision', - serial => 'numeric', - boolean => 'varchar', - char => 'char', - long => 'varchar', +my %translate = ( + # + # Sybase types + # + integer => 'numeric', + int => 'numeric', + number => 'numeric', + money => 'money', + varchar => 'varchar', + varchar2 => 'varchar', + timestamp => 'datetime', + text => 'varchar', + real => 'double precision', + comment => 'text', + bit => 'bit', + tinyint => 'smallint', + float => 'double precision', + serial => 'numeric', + boolean => 'varchar', + char => 'char', + long => 'varchar', ); my %reserved = map { $_, 1 } qw[ - ALL ANALYSE ANALYZE AND ANY AS ASC - BETWEEN BINARY BOTH - CASE CAST CHECK COLLATE COLUMN CONSTRAINT CROSS - CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER - DEFAULT DEFERRABLE DESC DISTINCT DO - ELSE END EXCEPT - FALSE FOR FOREIGN FREEZE FROM FULL - GROUP HAVING - ILIKE IN INITIALLY INNER INTERSECT INTO IS ISNULL - JOIN LEADING LEFT LIKE LIMIT - NATURAL NEW NOT NOTNULL NULL - OFF OFFSET OLD ON ONLY OR ORDER OUTER OVERLAPS - PRIMARY PUBLIC REFERENCES RIGHT - SELECT SESSION_USER SOME TABLE THEN TO TRAILING TRUE - UNION UNIQUE USER USING VERBOSE WHEN WHERE + ALL ANALYSE ANALYZE AND ANY AS ASC + BETWEEN BINARY BOTH + CASE CAST CHECK COLLATE COLUMN CONSTRAINT CROSS + CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP CURRENT_USER + DEFAULT DEFERRABLE DESC DISTINCT DO + ELSE END EXCEPT + FALSE FOR FOREIGN FREEZE FROM FULL + GROUP HAVING + ILIKE IN INITIALLY INNER INTERSECT INTO IS ISNULL + JOIN LEADING LEFT LIKE LIMIT + NATURAL NEW NOT NOTNULL NULL + OFF OFFSET OLD ON ONLY OR ORDER OUTER OVERLAPS + PRIMARY PUBLIC REFERENCES RIGHT + SELECT SESSION_USER SOME TABLE THEN TO TRAILING TRUE + UNION UNIQUE USER USING VERBOSE WHEN WHERE ]; my $max_id_length = 30; @@ -116,301 +116,259 @@ and table_constraint is: =cut sub produce { - my $translator = shift; - $DEBUG = $translator->debug; - $WARN = $translator->show_warnings; - my $no_comments = $translator->no_comments; - my $add_drop_table = $translator->add_drop_table; - my $schema = $translator->schema; - - my @output; - push @output, header_comment unless ($no_comments); - - my @foreign_keys; - - for my $table ( $schema->get_tables ) { - my $table_name = $table->name or next; - $table_name = mk_name( $table_name, '', undef, 1 ); - my $table_name_ur = unreserve($table_name) || ''; - - my ( @comments, @field_defs, @index_defs, @constraint_defs ); - - push @comments, "--\n-- Table: $table_name_ur\n--" unless $no_comments; - - push @comments, map { "-- $_" } $table->comments; - - # - # Fields - # - my %field_name_scope; - for my $field ( $table->get_fields ) { - my $field_name = mk_name( - $field->name, '', \%field_name_scope, undef,1 - ); - my $field_name_ur = unreserve( $field_name, $table_name ); - my $field_def = qq["$field_name_ur"]; - $field_def =~ s/\"//g; - if ( $field_def =~ /identity/ ){ - $field_def =~ s/identity/pidentity/; - } - - # - # Datatype - # - my $data_type = lc $field->data_type; - my $orig_data_type = $data_type; - my %extra = $field->extra; - my $list = $extra{'list'} || []; - # \todo deal with embedded quotes - my $commalist = join( ', ', map { qq['$_'] } @$list ); - my $seq_name; - - my $identity = ''; - - if ( $data_type eq 'enum' ) { - my $check_name = mk_name( - $table_name.'_'.$field_name, 'chk' ,undef, 1 - ); - push @constraint_defs, - "CONSTRAINT $check_name CHECK ($field_name IN ($commalist))"; - $data_type .= 'character varying'; - } - elsif ( $data_type eq 'set' ) { - $data_type .= 'character varying'; - } - else { - if ( $field->is_auto_increment ) { - $identity = 'IDENTITY'; - } - if ( defined $translate{ $data_type } ) { - $data_type = $translate{ $data_type }; - } - else { - warn "Unknown datatype: $data_type ", - "($table_name.$field_name)\n" if $WARN; - } - } - - my $size = $field->size; - unless ( $size ) { - if ( $data_type =~ /numeric/ ) { - $size = '9,0'; - } - elsif ( $orig_data_type eq 'text' ) { - #interpret text fields as long varchars - $size = '255'; - } - elsif ( - $data_type eq 'varchar' && - $orig_data_type eq 'boolean' - ) { - $size = '6'; - } - elsif ( $data_type eq 'varchar' ) { - $size = '255'; - } - } - - $field_def .= " $data_type"; - $field_def .= "($size)" if $size; - $field_def .= " $identity" if $identity; - - # - # Default value - # - my $default = $field->default_value; - if ( defined $default ) { - $field_def .= sprintf( ' DEFAULT %s', - ( $field->is_auto_increment && $seq_name ) - ? qq[nextval('"$seq_name"'::text)] : - ( $default =~ m/null/i ) ? 'NULL' : "'$default'" - ); - } - - # - # Not null constraint - # - unless ( $field->is_nullable ) { - $field_def .= ' NOT NULL'; - } - else { - $field_def .= ' NULL' if $data_type ne 'bit'; - } - - push @field_defs, $field_def; - } + my $translator = shift; + $DEBUG = $translator->debug; + $WARN = $translator->show_warnings; + my $no_comments = $translator->no_comments; + my $add_drop_table = $translator->add_drop_table; + my $schema = $translator->schema; - # - # Constraint Declarations - # - my @constraint_decs = (); - my $c_name_default; - for my $constraint ( $table->get_constraints ) { - my $name = $constraint->name || ''; - my $type = $constraint->type || NORMAL; - my @fields = map { unreserve( $_, $table_name ) } - $constraint->fields; - my @rfields = map { unreserve( $_, $table_name ) } - $constraint->reference_fields; - next unless @fields; - - if ( $type eq PRIMARY_KEY ) { - $name ||= mk_name( $table_name, 'pk', undef,1 ); - push @constraint_defs, - "CONSTRAINT $name PRIMARY KEY ". - '(' . join( ', ', @fields ) . ')'; - } - elsif ( $type eq FOREIGN_KEY ) { - $name ||= mk_name( $table_name, 'fk', undef,1 ); - push @foreign_keys, - "ALTER TABLE $table ADD CONSTRAINT $name FOREIGN KEY". - ' (' . join( ', ', @fields ) . ') REFERENCES '. - $constraint->reference_table. - ' (' . join( ', ', @rfields ) . ')'; - } - elsif ( $type eq UNIQUE ) { - $name ||= mk_name( - $table_name, - $name || ++$c_name_default,undef, 1 - ); - push @constraint_defs, - "CONSTRAINT $name UNIQUE " . - '(' . join( ', ', @fields ) . ')'; - } - } + my @output; + push @output, header_comment unless ($no_comments); - # - # Indices - # - for my $index ( $table->get_indices ) { - push @index_defs, - 'CREATE INDEX ' . $index->name . - " ON $table_name (". - join( ', ', $index->fields ) . ")"; - } + my @foreign_keys; - my $drop_statement = $add_drop_table - ? qq[DROP TABLE $table_name_ur] : ''; - my $create_statement = qq[CREATE TABLE $table_name_ur (\n]. - join( ",\n", - map { " $_" } @field_defs, @constraint_defs - ). - "\n)" - ; - - $create_statement = join("\n\n", @comments) . "\n\n" . $create_statement; - push @output, - $create_statement, - @index_defs, - ; - } + for my $table ($schema->get_tables) { + my $table_name = $table->name or next; + $table_name = mk_name($table_name, '', undef, 1); + my $table_name_ur = unreserve($table_name) || ''; - foreach my $view ( $schema->get_views ) { - my (@comments, $view_name); + my (@comments, @field_defs, @index_defs, @constraint_defs); - $view_name = $view->name(); - push @comments, "--\n-- View: $view_name\n--" unless $no_comments; + push @comments, "--\n-- Table: $table_name_ur\n--" unless $no_comments; - # text of view is already a 'create view' statement so no need - # to do anything fancy. + push @comments, map {"-- $_"} $table->comments; - push @output, join("\n\n", - @comments, - $view->sql(), - ); + # + # Fields + # + my %field_name_scope; + for my $field ($table->get_fields) { + my $field_name = mk_name($field->name, '', \%field_name_scope, undef, 1); + my $field_name_ur = unreserve($field_name, $table_name); + my $field_def = qq["$field_name_ur"]; + $field_def =~ s/\"//g; + if ($field_def =~ /identity/) { + $field_def =~ s/identity/pidentity/; + } + + # + # Datatype + # + my $data_type = lc $field->data_type; + my $orig_data_type = $data_type; + my %extra = $field->extra; + my $list = $extra{'list'} || []; + + # \todo deal with embedded quotes + my $commalist = join(', ', map {qq['$_']} @$list); + my $seq_name; + + my $identity = ''; + + if ($data_type eq 'enum') { + my $check_name = mk_name($table_name . '_' . $field_name, 'chk', undef, 1); + push @constraint_defs, "CONSTRAINT $check_name CHECK ($field_name IN ($commalist))"; + $data_type .= 'character varying'; + } elsif ($data_type eq 'set') { + $data_type .= 'character varying'; + } else { + if ($field->is_auto_increment) { + $identity = 'IDENTITY'; + } + if (defined $translate{$data_type}) { + $data_type = $translate{$data_type}; + } else { + warn "Unknown datatype: $data_type ", "($table_name.$field_name)\n" + if $WARN; + } + } + + my $size = $field->size; + unless ($size) { + if ($data_type =~ /numeric/) { + $size = '9,0'; + } elsif ($orig_data_type eq 'text') { + + #interpret text fields as long varchars + $size = '255'; + } elsif ($data_type eq 'varchar' + && $orig_data_type eq 'boolean') { + $size = '6'; + } elsif ($data_type eq 'varchar') { + $size = '255'; + } + } + + $field_def .= " $data_type"; + $field_def .= "($size)" if $size; + $field_def .= " $identity" if $identity; + + # + # Default value + # + my $default = $field->default_value; + if (defined $default) { + $field_def .= sprintf(' DEFAULT %s', + ($field->is_auto_increment && $seq_name) ? qq[nextval('"$seq_name"'::text)] + : ($default =~ m/null/i) ? 'NULL' + : "'$default'"); + } + + # + # Not null constraint + # + unless ($field->is_nullable) { + $field_def .= ' NOT NULL'; + } else { + $field_def .= ' NULL' if $data_type ne 'bit'; + } + + push @field_defs, $field_def; } + # + # Constraint Declarations + # + my @constraint_decs = (); + my $c_name_default; + for my $constraint ($table->get_constraints) { + my $name = $constraint->name || ''; + my $type = $constraint->type || NORMAL; + my @fields = map { unreserve($_, $table_name) } $constraint->fields; + my @rfields = map { unreserve($_, $table_name) } $constraint->reference_fields; + next unless @fields; + + if ($type eq PRIMARY_KEY) { + $name ||= mk_name($table_name, 'pk', undef, 1); + push @constraint_defs, "CONSTRAINT $name PRIMARY KEY " . '(' . join(', ', @fields) . ')'; + } elsif ($type eq FOREIGN_KEY) { + $name ||= mk_name($table_name, 'fk', undef, 1); + push @foreign_keys, + "ALTER TABLE $table ADD CONSTRAINT $name FOREIGN KEY" . ' (' + . join(', ', @fields) + . ') REFERENCES ' + . $constraint->reference_table . ' (' + . join(', ', @rfields) . ')'; + } elsif ($type eq UNIQUE) { + $name ||= mk_name($table_name, $name || ++$c_name_default, undef, 1); + push @constraint_defs, "CONSTRAINT $name UNIQUE " . '(' . join(', ', @fields) . ')'; + } + } - foreach my $procedure ( $schema->get_procedures ) { - my (@comments, $procedure_name); + # + # Indices + # + for my $index ($table->get_indices) { + push @index_defs, 'CREATE INDEX ' . $index->name . " ON $table_name (" . join(', ', $index->fields) . ")"; + } - $procedure_name = $procedure->name(); - push @comments, - "--\n-- Procedure: $procedure_name\n--" unless $no_comments; + my $drop_statement = $add_drop_table ? qq[DROP TABLE $table_name_ur] : ''; + my $create_statement + = qq[CREATE TABLE $table_name_ur (\n] . join(",\n", map {" $_"} @field_defs, @constraint_defs) . "\n)"; - # text of procedure already has the 'create procedure' stuff - # so there is no need to do anything fancy. However, we should - # think about doing fancy stuff with granting permissions and - # so on. + $create_statement = join("\n\n", @comments) . "\n\n" . $create_statement; + push @output, $create_statement, @index_defs,; + } - push @output, join("\n\n", - @comments, - $procedure->sql(), - ); - } - push @output, @foreign_keys; + foreach my $view ($schema->get_views) { + my (@comments, $view_name); - if ( $WARN ) { - if ( %truncated ) { - warn "Truncated " . keys( %truncated ) . " names:\n"; - warn "\t" . join( "\n\t", sort keys %truncated ) . "\n"; - } + $view_name = $view->name(); + push @comments, "--\n-- View: $view_name\n--" unless $no_comments; - if ( %unreserve ) { - warn "Encounted " . keys( %unreserve ) . - " unsafe names in schema (reserved or invalid):\n"; - warn "\t" . join( "\n\t", sort keys %unreserve ) . "\n"; - } - } + # text of view is already a 'create view' statement so no need + # to do anything fancy. - return wantarray ? @output : join ";\n\n", @output; -} + push @output, join("\n\n", @comments, $view->sql(),); + } -sub mk_name { - my $basename = shift || ''; - my $type = shift || ''; - my $scope = shift || ''; - my $critical = shift || ''; - my $basename_orig = $basename; - my $max_name = $type - ? $max_id_length - (length($type) + 1) - : $max_id_length; - $basename = substr( $basename, 0, $max_name ) - if length( $basename ) > $max_name; - my $name = $type ? "${type}_$basename" : $basename; - - if ( $basename ne $basename_orig and $critical ) { - my $show_type = $type ? "+'$type'" : ""; - warn "Truncating '$basename_orig'$show_type to $max_id_length ", - "character limit to make '$name'\n" if $WARN; - $truncated{ $basename_orig } = $name; - } + foreach my $procedure ($schema->get_procedures) { + my (@comments, $procedure_name); + + $procedure_name = $procedure->name(); + push @comments, "--\n-- Procedure: $procedure_name\n--" + unless $no_comments; - $scope ||= \%global_names; - if ( my $prev = $scope->{ $name } ) { - my $name_orig = $name; - $name .= sprintf( "%02d", ++$prev ); - substr($name, $max_id_length - 3) = "00" - if length( $name ) > $max_id_length; + # text of procedure already has the 'create procedure' stuff + # so there is no need to do anything fancy. However, we should + # think about doing fancy stuff with granting permissions and + # so on. - warn "The name '$name_orig' has been changed to ", - "'$name' to make it unique.\n" if $WARN; + push @output, join("\n\n", @comments, $procedure->sql(),); + } + push @output, @foreign_keys; - $scope->{ $name_orig }++; + if ($WARN) { + if (%truncated) { + warn "Truncated " . keys(%truncated) . " names:\n"; + warn "\t" . join("\n\t", sort keys %truncated) . "\n"; } - $name = substr( $name, 0, $max_id_length ) - if ((length( $name ) > $max_id_length) && $critical); - $scope->{ $name }++; - return $name; + + if (%unreserve) { + warn "Encounted " . keys(%unreserve) . " unsafe names in schema (reserved or invalid):\n"; + warn "\t" . join("\n\t", sort keys %unreserve) . "\n"; + } + } + + return wantarray ? @output : join ";\n\n", @output; +} + +sub mk_name { + my $basename = shift || ''; + my $type = shift || ''; + my $scope = shift || ''; + my $critical = shift || ''; + my $basename_orig = $basename; + my $max_name + = $type + ? $max_id_length - (length($type) + 1) + : $max_id_length; + $basename = substr($basename, 0, $max_name) + if length($basename) > $max_name; + my $name = $type ? "${type}_$basename" : $basename; + + if ($basename ne $basename_orig and $critical) { + my $show_type = $type ? "+'$type'" : ""; + warn "Truncating '$basename_orig'$show_type to $max_id_length ", "character limit to make '$name'\n" + if $WARN; + $truncated{$basename_orig} = $name; + } + + $scope ||= \%global_names; + if (my $prev = $scope->{$name}) { + my $name_orig = $name; + $name .= sprintf("%02d", ++$prev); + substr($name, $max_id_length - 3) = "00" + if length($name) > $max_id_length; + + warn "The name '$name_orig' has been changed to ", "'$name' to make it unique.\n" + if $WARN; + + $scope->{$name_orig}++; + } + $name = substr($name, 0, $max_id_length) + if ((length($name) > $max_id_length) && $critical); + $scope->{$name}++; + return $name; } sub unreserve { - my $name = shift || ''; - my $schema_obj_name = shift || ''; - my ( $suffix ) = ( $name =~ s/(\W.*)$// ) ? $1 : ''; + my $name = shift || ''; + my $schema_obj_name = shift || ''; + my ($suffix) = ($name =~ s/(\W.*)$//) ? $1 : ''; - # also trap fields that don't begin with a letter - return $name if !$reserved{ uc $name } && $name =~ /^[a-z]/i; + # also trap fields that don't begin with a letter + return $name if !$reserved{ uc $name } && $name =~ /^[a-z]/i; - if ( $schema_obj_name ) { - ++$unreserve{"$schema_obj_name.$name"}; - } - else { - ++$unreserve{"$name (table name)"}; - } + if ($schema_obj_name) { + ++$unreserve{"$schema_obj_name.$name"}; + } else { + ++$unreserve{"$name (table name)"}; + } - my $unreserve = sprintf '%s_', $name; - return $unreserve.$suffix; + my $unreserve = sprintf '%s_', $name; + return $unreserve . $suffix; } 1; diff --git a/lib/SQL/Translator/Producer/TT/Base.pm b/lib/SQL/Translator/Producer/TT/Base.pm index 1993ee9c1..dfeb04bc9 100644 --- a/lib/SQL/Translator/Producer/TT/Base.pm +++ b/lib/SQL/Translator/Producer/TT/Base.pm @@ -27,18 +27,18 @@ use SQL::Translator::Utils 'debug'; # Hack to convert the produce call into an object. ALL sub-classes need todo # this so that the correct class gets created. sub produce { - return __PACKAGE__->new( translator => shift )->run; -}; + return __PACKAGE__->new(translator => shift)->run; +} sub new { - my $proto = shift; - my $class = ref $proto || $proto; - my %args = @_; + my $proto = shift; + my $class = ref $proto || $proto; + my %args = @_; - my $me = bless {}, $class; - $me->{translator} = delete $args{translator} || die "Need a translator."; + my $me = bless {}, $class; + $me->{translator} = delete $args{translator} || die "Need a translator."; - return $me; + return $me; } sub translator { shift->{translator}; } @@ -51,84 +51,86 @@ sub schema { shift->{translator}->schema(@_); } # or return as hashref in scalar context. Any names given that don't # exist in the args are returned as undef. sub args { - my $me = shift; - - # No args - unless (@_) { - return wantarray - ? %{ $me->{translator}->producer_args } - : $me->{translator}->producer_args - ; - } - - # 1 arg. Return the value whatever the context. - return $me->{translator}->producer_args->{$_[0]} if @_ == 1; - - # More args so return values list or hash ref - my %args = %{ $me->{translator}->producer_args }; - return wantarray ? @args{@_} : { map { ($_=>$args{$_}) } @_ }; + my $me = shift; + + # No args + unless (@_) { + return wantarray + ? %{ $me->{translator}->producer_args } + : $me->{translator}->producer_args; + } + + # 1 arg. Return the value whatever the context. + return $me->{translator}->producer_args->{ $_[0] } if @_ == 1; + + # More args so return values list or hash ref + my %args = %{ $me->{translator}->producer_args }; + return wantarray ? @args{@_} : { map { ($_ => $args{$_}) } @_ }; } # Run the produce and return the result. sub run { - my $me = shift; - my $scma = $me->schema; - my %args = %{$me->args}; - my $tmpl = $me->tt_schema or die "No template!"; - - debug "Processing template $tmpl\n"; - my $out; - my $tt = Template->new( - #DEBUG => $me->translator->debug, - ABSOLUTE => 1, # Set so we can use from the command line sensibly - RELATIVE => 1, # Maybe the cmd line code should set it! Security! - $me->tt_config, # Hook for sub-classes to add config - %args, # Allow any TT opts to be passed in the producer_args - ) || die "Failed to initialize Template object: ".Template->error; - - $tt->process( $tmpl, { - $me->tt_default_vars, - $me->tt_vars, # Sub-class hook for adding vars - }, \$out ) - or die "Error processing template '$tmpl': ".$tt->error; - - return $out; + my $me = shift; + my $scma = $me->schema; + my %args = %{ $me->args }; + my $tmpl = $me->tt_schema or die "No template!"; + + debug "Processing template $tmpl\n"; + my $out; + my $tt = Template->new( + + #DEBUG => $me->translator->debug, + ABSOLUTE => 1, # Set so we can use from the command line sensibly + RELATIVE => 1, # Maybe the cmd line code should set it! Security! + $me->tt_config, # Hook for sub-classes to add config + %args, # Allow any TT opts to be passed in the producer_args + ) || die "Failed to initialize Template object: " . Template->error; + + $tt->process( + $tmpl, + { + $me->tt_default_vars, + $me->tt_vars, # Sub-class hook for adding vars + }, + \$out + ) or die "Error processing template '$tmpl': " . $tt->error; + + return $out; } - # Sub class hooks #----------------------------------------------------------------------------- -sub tt_config { () }; +sub tt_config { () } sub tt_schema { - my $me = shift; - my $class = ref $me; + my $me = shift; + my $class = ref $me; - my $file = $me->args("ttfile"); - return $file if $file; + my $file = $me->args("ttfile"); + return $file if $file; - no strict 'refs'; - my $ref = *{"$class\:\:DATA"}{IO}; - if ( $ref->opened ) { - local $/ = undef; # Slurp mode - return \<$ref>; - } + no strict 'refs'; + my $ref = *{"$class\:\:DATA"}{IO}; + if ($ref->opened) { + local $/ = undef; # Slurp mode + return \<$ref>; + } - undef; -}; + undef; +} sub tt_default_vars { - my $me = shift; - return ( - translator => $me->translator, - schema => $me->pre_process_schema($me->translator->schema), - ); + my $me = shift; + return ( + translator => $me->translator, + schema => $me->pre_process_schema($me->translator->schema), + ); } sub pre_process_schema { $_[1] } -sub tt_vars { () }; +sub tt_vars { () } 1; diff --git a/lib/SQL/Translator/Producer/TT/Table.pm b/lib/SQL/Translator/Producer/TT/Table.pm index 5f89c239a..8ce8cfa56 100644 --- a/lib/SQL/Translator/Producer/TT/Table.pm +++ b/lib/SQL/Translator/Producer/TT/Table.pm @@ -156,9 +156,9 @@ whitespace either side, to be recognised. use strict; use warnings; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use File::Path; use Template; @@ -172,111 +172,106 @@ use SQL::Translator::Utils 'debug'; my $Translator; sub produce { - $Translator = shift; - local $DEBUG = $Translator->debug; - my $scma = $Translator->schema; - my $pargs = $Translator->producer_args; - my $file = $pargs->{'tt_table'} or die "No template file given!"; - $pargs->{on_exists} ||= "die"; - - debug "Processing template $file\n"; - my $out; - my $tt = Template->new( - DEBUG => $DEBUG, - ABSOLUTE => 1, # Set so we can use from the command line sensibly - RELATIVE => 1, # Maybe the cmd line code should set it! Security! - %$pargs, # Allow any TT opts to be passed in the producer_args - ) || die "Failed to initialize Template object: ".Template->error; - - for my $tbl ( sort {$a->order <=> $b->order} $scma->get_tables ) { - my $outtmp; - $tt->process( $file, { - translator => $Translator, - schema => $scma, - table => $tbl, - }, \$outtmp ) - or die "Error processing template '$file' for table '".$tbl->name - ."': ".$tt->error; - $out .= $outtmp; - - # Write out the file... - write_file( table_file($tbl), $outtmp ) if $pargs->{mk_files}; - } + $Translator = shift; + local $DEBUG = $Translator->debug; + my $scma = $Translator->schema; + my $pargs = $Translator->producer_args; + my $file = $pargs->{'tt_table'} or die "No template file given!"; + $pargs->{on_exists} ||= "die"; + + debug "Processing template $file\n"; + my $out; + my $tt = Template->new( + DEBUG => $DEBUG, + ABSOLUTE => 1, # Set so we can use from the command line sensibly + RELATIVE => 1, # Maybe the cmd line code should set it! Security! + %$pargs, # Allow any TT opts to be passed in the producer_args + ) || die "Failed to initialize Template object: " . Template->error; + + for my $tbl (sort { $a->order <=> $b->order } $scma->get_tables) { + my $outtmp; + $tt->process( + $file, + { + translator => $Translator, + schema => $scma, + table => $tbl, + }, + \$outtmp + ) or die "Error processing template '$file' for table '" . $tbl->name . "': " . $tt->error; + $out .= $outtmp; + + # Write out the file... + write_file(table_file($tbl), $outtmp) if $pargs->{mk_files}; + } - return $out; -}; + return $out; +} # Work out the filename for a given table. sub table_file { - my ($tbl) = shift; - my $pargs = $Translator->producer_args; - my $root = $pargs->{mk_files_base}; - my $ext = $pargs->{mk_file_ext}; - return "$root/$tbl.$ext"; + my ($tbl) = shift; + my $pargs = $Translator->producer_args; + my $root = $pargs->{mk_files_base}; + my $ext = $pargs->{mk_file_ext}; + return "$root/$tbl.$ext"; } # Write the src given to the file given, handling the on_exists arg. sub write_file { - my ($file, $src) = @_; - my $pargs = $Translator->producer_args; - my $root = $pargs->{mk_files_base}; - - if ( -e $file ) { - if ( $pargs->{on_exists} eq "skip" ) { - warn "Skipping existing $file\n"; - return 1; - } - elsif ( $pargs->{on_exists} eq "die" ) { - die "File $file already exists.\n"; - } - elsif ( $pargs->{on_exists} eq "replace" ) { - warn "Replacing $file.\n"; - } - elsif ( $pargs->{on_exists} eq "insert" ) { - warn "Inserting into $file.\n"; - $src = insert_code($file, $src); - } - else { - die "Unknown on_exists action: $pargs->{on_exists}\n"; - } + my ($file, $src) = @_; + my $pargs = $Translator->producer_args; + my $root = $pargs->{mk_files_base}; + + if (-e $file) { + if ($pargs->{on_exists} eq "skip") { + warn "Skipping existing $file\n"; + return 1; + } elsif ($pargs->{on_exists} eq "die") { + die "File $file already exists.\n"; + } elsif ($pargs->{on_exists} eq "replace") { + warn "Replacing $file.\n"; + } elsif ($pargs->{on_exists} eq "insert") { + warn "Inserting into $file.\n"; + $src = insert_code($file, $src); + } else { + die "Unknown on_exists action: $pargs->{on_exists}\n"; } - else { - if ( my $interactive = -t STDIN && -t STDOUT ) { - warn "Creating $file.\n"; - } + } else { + if (my $interactive = -t STDIN && -t STDOUT) { + warn "Creating $file.\n"; } + } - my ($dir) = $file =~ m!^(.*)/!; # Want greedy, everything before the last / - if ( $dir and not -d $dir and $pargs->{mk_file_dir} ) { mkpath($dir); } + my ($dir) = $file =~ m!^(.*)/!; # Want greedy, everything before the last / + if ($dir and not -d $dir and $pargs->{mk_file_dir}) { mkpath($dir); } - debug "Writing to $file\n"; - open( FILE, ">$file") or die "Error opening file $file : $!\n"; - print FILE $src; - close(FILE); + debug "Writing to $file\n"; + open(FILE, ">$file") or die "Error opening file $file : $!\n"; + print FILE $src; + close(FILE); } # Reads file and inserts code between the insert comments and returns the new # source. sub insert_code { - my ($file, $src) = @_; - my $pargs = $Translator->producer_args; - my $cstart = $pargs->{insert_comment_start} || "SQLF_INSERT_START"; - my $cend = $pargs->{insert_comment_end} || "SQLF_INSERT_END"; - - # Slurp in the original file - open ( FILE, "<", "$file") or die "Error opening file $file : $!\n"; - local $/ = undef; - my $orig = ; - close(FILE); - - # Insert the new code between the insert comments - unless ( - $orig =~ s/^\s*?$cstart\s*?\n.*?^\s*?$cend\s*?\n/\n$cstart\n$src\n$cend\n/ms - ) { - warn "No insert done\n"; - } - - return $orig; + my ($file, $src) = @_; + my $pargs = $Translator->producer_args; + my $cstart = $pargs->{insert_comment_start} || "SQLF_INSERT_START"; + my $cend = $pargs->{insert_comment_end} || "SQLF_INSERT_END"; + + # Slurp in the original file + open(FILE, "<", "$file") or die "Error opening file $file : $!\n"; + local $/ = undef; + my $orig = ; + close(FILE); + + # Insert the new code between the insert comments + unless ($orig =~ s/^\s*?$cstart\s*?\n.*?^\s*?$cend\s*?\n/\n$cstart\n$src\n$cend\n/ms) { + warn "No insert done\n"; + } + + return $orig; } 1; diff --git a/lib/SQL/Translator/Producer/TTSchema.pm b/lib/SQL/Translator/Producer/TTSchema.pm index 95c2d6fd9..16947b9fc 100644 --- a/lib/SQL/Translator/Producer/TTSchema.pm +++ b/lib/SQL/Translator/Producer/TTSchema.pm @@ -109,9 +109,9 @@ constructor. use strict; use warnings; -our ( $DEBUG, @EXPORT_OK ); +our ($DEBUG, @EXPORT_OK); our $VERSION = '1.64'; -$DEBUG = 0 unless defined $DEBUG; +$DEBUG = 0 unless defined $DEBUG; use Template; use Data::Dumper; @@ -122,50 +122,45 @@ use base qw(Exporter); use SQL::Translator::Utils 'debug'; sub produce { - my $translator = shift; - local $DEBUG = $translator->debug; - my $scma = $translator->schema; - my $args = $translator->producer_args; - my $file = delete $args->{'ttfile'} or die "No template file!"; - - my $tt_vars = delete $args->{'tt_vars'} || {}; - if ( exists $args->{ttargs} ) { - warn "Use of 'ttargs' producer arg is deprecated." - ." Please use 'tt_vars' instead.\n"; - %$tt_vars = { %{$args->{ttargs}}, %$tt_vars }; - } - - my %tt_conf = exists $args->{tt_conf} ? %{$args->{tt_conf}} : (); - # sqlt passes the producer args for _all_ producers in, so we use this - # grep hack to test for the old usage. - debug(Dumper(\%tt_conf)) if $DEBUG; - if ( grep /^[A-Z_]+$/, keys %$args ) { - warn "Template config directly in the producer args is deprecated." - ." Please use 'tt_conf' instead.\n"; - %tt_conf = ( %tt_conf, %$args ); - } - - debug "Processing template $file\n"; - my $out; - my $tt = Template->new( - DEBUG => $DEBUG, - ABSOLUTE => 1, # Set so we can use from the command line sensibly - RELATIVE => 1, # Maybe the cmd line code should set it! Security! - %tt_conf, - ); - debug("Template ERROR: " . Template->error. "\n") if(!$tt); - $tt || die "Failed to initialize Template object: ".Template->error; - - my $ttproc = $tt->process( - $file, - { schema => $scma , %$tt_vars }, - \$out - ); - debug("ERROR: ". $tt->error. "\n") if(!$ttproc); - $ttproc or die "Error processing template '$file': ".$tt->error; - - return $out; -}; + my $translator = shift; + local $DEBUG = $translator->debug; + my $scma = $translator->schema; + my $args = $translator->producer_args; + my $file = delete $args->{'ttfile'} or die "No template file!"; + + my $tt_vars = delete $args->{'tt_vars'} || {}; + if (exists $args->{ttargs}) { + warn "Use of 'ttargs' producer arg is deprecated." . " Please use 'tt_vars' instead.\n"; + %$tt_vars = { %{ $args->{ttargs} }, %$tt_vars }; + } + + my %tt_conf = exists $args->{tt_conf} ? %{ $args->{tt_conf} } : (); + + # sqlt passes the producer args for _all_ producers in, so we use this + # grep hack to test for the old usage. + debug(Dumper(\%tt_conf)) if $DEBUG; + if (grep /^[A-Z_]+$/, keys %$args) { + warn "Template config directly in the producer args is deprecated." . " Please use 'tt_conf' instead.\n"; + %tt_conf = (%tt_conf, %$args); + } + + debug "Processing template $file\n"; + my $out; + my $tt = Template->new( + DEBUG => $DEBUG, + ABSOLUTE => 1, # Set so we can use from the command line sensibly + RELATIVE => 1, # Maybe the cmd line code should set it! Security! + %tt_conf, + ); + debug("Template ERROR: " . Template->error . "\n") if (!$tt); + $tt || die "Failed to initialize Template object: " . Template->error; + + my $ttproc = $tt->process($file, { schema => $scma, %$tt_vars }, \$out); + debug("ERROR: " . $tt->error . "\n") if (!$ttproc); + $ttproc or die "Error processing template '$file': " . $tt->error; + + return $out; +} 1; diff --git a/lib/SQL/Translator/Producer/XML/SQLFairy.pm b/lib/SQL/Translator/Producer/XML/SQLFairy.pm index 969e6afff..8cc47471f 100644 --- a/lib/SQL/Translator/Producer/XML/SQLFairy.pm +++ b/lib/SQL/Translator/Producer/XML/SQLFairy.pm @@ -150,144 +150,162 @@ use base qw(Exporter); @EXPORT_OK = qw(produce); use SQL::Translator::Utils qw(header_comment debug); + BEGIN { - # Will someone fix XML::Writer already? - local $^W = 0; - require XML::Writer; - import XML::Writer; + # Will someone fix XML::Writer already? + local $^W = 0; + require XML::Writer; + import XML::Writer; } # Which schema object attributes (methods) to write as xml elements rather than # as attributes. e.g. blah, blah... my @MAP_AS_ELEMENTS = qw/sql comments action extra/; - - my $Namespace = 'http://sqlfairy.sourceforge.net/sqlfairy.xml'; my $Name = 'sqlf'; my $PArgs = {}; my $no_comments; sub produce { - my $translator = shift; - my $schema = $translator->schema; - $no_comments = $translator->no_comments; - $PArgs = $translator->producer_args; - my $newlines = defined $PArgs->{newlines} ? $PArgs->{newlines} : 1; - my $indent = defined $PArgs->{indent} ? $PArgs->{indent} : 2; - - # Setup the XML::Writer and set the namespace - my $io; - my $prefix = ""; - $prefix = $Name if $PArgs->{add_prefix}; - $prefix = $PArgs->{prefix} if $PArgs->{prefix}; - my $xml = XML::Writer->new( - OUTPUT => \$io, - NAMESPACES => 1, - PREFIX_MAP => { $Namespace => $prefix }, - DATA_MODE => $newlines, - DATA_INDENT => $indent, - ); + my $translator = shift; + my $schema = $translator->schema; + $no_comments = $translator->no_comments; + $PArgs = $translator->producer_args; + my $newlines = defined $PArgs->{newlines} ? $PArgs->{newlines} : 1; + my $indent = defined $PArgs->{indent} ? $PArgs->{indent} : 2; + + # Setup the XML::Writer and set the namespace + my $io; + my $prefix = ""; + $prefix = $Name if $PArgs->{add_prefix}; + $prefix = $PArgs->{prefix} if $PArgs->{prefix}; + my $xml = XML::Writer->new( + OUTPUT => \$io, + NAMESPACES => 1, + PREFIX_MAP => { $Namespace => $prefix }, + DATA_MODE => $newlines, + DATA_INDENT => $indent, + ); - # Start the document - $xml->xmlDecl('UTF-8'); + # Start the document + $xml->xmlDecl('UTF-8'); - $xml->comment(header_comment('', '')) + $xml->comment(header_comment('', '')) unless $no_comments; - xml_obj($xml, $schema, - tag => "schema", methods => [qw/name database extra/], end_tag => 0 ); + xml_obj( + $xml, $schema, + tag => "schema", + methods => [qw/name database extra/], + end_tag => 0 + ); + + # + # Table + # + $xml->startTag([ $Namespace => "tables" ]); + for my $table ($schema->get_tables) { + debug "Table:", $table->name; + xml_obj( + $xml, $table, + tag => "table", + methods => [qw/name order extra/], + end_tag => 0 + ); # - # Table + # Fields # - $xml->startTag( [ $Namespace => "tables" ] ); - for my $table ( $schema->get_tables ) { - debug "Table:",$table->name; - xml_obj($xml, $table, - tag => "table", - methods => [qw/name order extra/], - end_tag => 0 - ); - - # - # Fields - # - xml_obj_children( $xml, $table, - tag => 'field', - methods =>[qw/ - name data_type size is_nullable default_value is_auto_increment - is_primary_key is_foreign_key extra comments order - /], - ); - - # - # Indices - # - xml_obj_children( $xml, $table, - tag => 'index', - collection_tag => "indices", - methods => [qw/name type fields options extra/], - ); - - # - # Constraints - # - xml_obj_children( $xml, $table, - tag => 'constraint', - methods => [qw/ - name type fields reference_table reference_fields - on_delete on_update match_type expression options deferrable - extra - /], - ); - - # - # Comments - # - xml_obj_children( $xml, $table, - tag => 'comment', - collection_tag => "comments", - methods => [qw/ - comments - /], - ); - - $xml->endTag( [ $Namespace => 'table' ] ); - } - $xml->endTag( [ $Namespace => 'tables' ] ); + xml_obj_children( + $xml, $table, + tag => 'field', + methods => [ + qw/ + name data_type size is_nullable default_value is_auto_increment + is_primary_key is_foreign_key extra comments order + / + ], + ); # - # Views + # Indices # - xml_obj_children( $xml, $schema, - tag => 'view', - methods => [qw/name sql fields order extra/], + xml_obj_children( + $xml, $table, + tag => 'index', + collection_tag => "indices", + methods => [qw/name type fields options extra/], ); # - # Tiggers + # Constraints # - xml_obj_children( $xml, $schema, - tag => 'trigger', - methods => [qw/name database_events action on_table perform_action_when - fields order extra scope/], + xml_obj_children( + $xml, $table, + tag => 'constraint', + methods => [ + qw/ + name type fields reference_table reference_fields + on_delete on_update match_type expression options deferrable + extra + / + ], ); # - # Procedures + # Comments # - xml_obj_children( $xml, $schema, - tag => 'procedure', - methods => [qw/name sql parameters owner comments order extra/], + xml_obj_children( + $xml, $table, + tag => 'comment', + collection_tag => "comments", + methods => [ + qw/ + comments + / + ], ); - $xml->endTag([ $Namespace => 'schema' ]); - $xml->end; + $xml->endTag([ $Namespace => 'table' ]); + } + $xml->endTag([ $Namespace => 'tables' ]); + + # + # Views + # + xml_obj_children( + $xml, $schema, + tag => 'view', + methods => [qw/name sql fields order extra/], + ); - return $io; -} + # + # Tiggers + # + xml_obj_children( + $xml, $schema, + tag => 'trigger', + methods => [ + qw/name database_events action on_table perform_action_when + fields order extra scope/ + ], + ); + + # + # Procedures + # + xml_obj_children( + $xml, $schema, + tag => 'procedure', + methods => [qw/name sql parameters owner comments order extra/], + ); + + $xml->endTag([ $Namespace => 'schema' ]); + $xml->end; + return $io; +} # # Takes and XML::Write object, Schema::* parent object, the tag name, @@ -297,35 +315,36 @@ sub produce { # collection of foos and gets the members using ->get_foos. # sub xml_obj_children { - my ($xml,$parent) = (shift,shift); - my %args = @_; - my ($name,$collection_name,$methods) - = @args{qw/tag collection_tag methods/}; - $collection_name ||= "${name}s"; - - my $meth; - if ( $collection_name eq 'comments' ) { - $meth = 'comments'; + my ($xml, $parent) = (shift, shift); + my %args = @_; + my ($name, $collection_name, $methods) = @args{qw/tag collection_tag methods/}; + $collection_name ||= "${name}s"; + + my $meth; + if ($collection_name eq 'comments') { + $meth = 'comments'; + } else { + $meth = "get_$collection_name"; + } + + my @kids = $parent->$meth; + + #@kids || return; + $xml->startTag([ $Namespace => $collection_name ]); + + for my $obj (@kids) { + if ($collection_name eq 'comments') { + $xml->dataElement([ $Namespace => 'comment' ], $obj); } else { - $meth = "get_$collection_name"; - } - - my @kids = $parent->$meth; - #@kids || return; - $xml->startTag( [ $Namespace => $collection_name ] ); - - for my $obj ( @kids ) { - if ( $collection_name eq 'comments' ){ - $xml->dataElement( [ $Namespace => 'comment' ], $obj ); - } else { - xml_obj($xml, $obj, - tag => "$name", - end_tag => 1, - methods => $methods, - ); - } + xml_obj( + $xml, $obj, + tag => "$name", + end_tag => 1, + methods => $methods, + ); } - $xml->endTag( [ $Namespace => $collection_name ] ); + } + $xml->endTag([ $Namespace => $collection_name ]); } # @@ -343,39 +362,39 @@ sub xml_obj_children { # my $elements_re = join("|", @MAP_AS_ELEMENTS); $elements_re = qr/^($elements_re)$/; + sub xml_obj { - my ($xml, $obj, %args) = @_; - my $tag = $args{'tag'} || ''; - my $end_tag = $args{'end_tag'} || ''; - my @meths = @{ $args{'methods'} }; - my $empty_tag = 0; - - # Use array to ensure consistent (ie not hash) ordering of attribs - # The order comes from the meths list passed in. - my @tags; - my @attr; - foreach ( grep { defined $obj->$_ } @meths ) { - my $what = m/$elements_re/ ? \@tags : \@attr; - my $val = $_ eq 'extra' - ? { $obj->$_ } - : $obj->$_; - $val = ref $val eq 'ARRAY' ? join(',', @$val) : $val; - push @$what, $_ => $val; - }; - my $child_tags = @tags; - $end_tag && !$child_tags - ? $xml->emptyTag( [ $Namespace => $tag ], @attr ) - : $xml->startTag( [ $Namespace => $tag ], @attr ); - while ( my ($name,$val) = splice @tags,0,2 ) { - if ( ref $val eq 'HASH' ) { - $xml->emptyTag( [ $Namespace => $name ], - map { ($_, $val->{$_}) } sort keys %$val ); - } - else { - $xml->dataElement( [ $Namespace => $name ], $val ); - } + my ($xml, $obj, %args) = @_; + my $tag = $args{'tag'} || ''; + my $end_tag = $args{'end_tag'} || ''; + my @meths = @{ $args{'methods'} }; + my $empty_tag = 0; + + # Use array to ensure consistent (ie not hash) ordering of attribs + # The order comes from the meths list passed in. + my @tags; + my @attr; + foreach (grep { defined $obj->$_ } @meths) { + my $what = m/$elements_re/ ? \@tags : \@attr; + my $val + = $_ eq 'extra' + ? { $obj->$_ } + : $obj->$_; + $val = ref $val eq 'ARRAY' ? join(',', @$val) : $val; + push @$what, $_ => $val; + } + my $child_tags = @tags; + $end_tag && !$child_tags + ? $xml->emptyTag([ $Namespace => $tag ], @attr) + : $xml->startTag([ $Namespace => $tag ], @attr); + while (my ($name, $val) = splice @tags, 0, 2) { + if (ref $val eq 'HASH') { + $xml->emptyTag([ $Namespace => $name ], map { ($_, $val->{$_}) } sort keys %$val); + } else { + $xml->dataElement([ $Namespace => $name ], $val); } - $xml->endTag( [ $Namespace => $tag ] ) if $child_tags && $end_tag; + } + $xml->endTag([ $Namespace => $tag ]) if $child_tags && $end_tag; } 1; diff --git a/lib/SQL/Translator/Producer/YAML.pm b/lib/SQL/Translator/Producer/YAML.pm index 54cc7b53e..8c3b579e5 100644 --- a/lib/SQL/Translator/Producer/YAML.pm +++ b/lib/SQL/Translator/Producer/YAML.pm @@ -26,158 +26,154 @@ our $VERSION = '1.64'; use YAML qw(Dump); sub produce { - my $translator = shift; - my $schema = $translator->schema; - - return Dump({ - schema => { - tables => { - map { ($_->name => view_table($_)) } - $schema->get_tables, - }, - views => { - map { ($_->name => view_view($_)) } - $schema->get_views, - }, - triggers => { - map { ($_->name => view_trigger($_)) } - $schema->get_triggers, - }, - procedures => { - map { ($_->name => view_procedure($_)) } - $schema->get_procedures, - }, - }, - translator => { - add_drop_table => $translator->add_drop_table, - filename => $translator->filename, - no_comments => $translator->no_comments, - parser_args => $translator->parser_args, - producer_args => $translator->producer_args, - parser_type => $translator->parser_type, - producer_type => $translator->producer_type, - show_warnings => $translator->show_warnings, - trace => $translator->trace, - version => $translator->version, - }, - keys %{$schema->extra} ? ('extra' => { $schema->extra } ) : (), - }); + my $translator = shift; + my $schema = $translator->schema; + + return Dump({ + schema => { + tables => { map { ($_->name => view_table($_)) } $schema->get_tables, }, + views => { map { ($_->name => view_view($_)) } $schema->get_views, }, + triggers => { map { ($_->name => view_trigger($_)) } $schema->get_triggers, }, + procedures => { map { ($_->name => view_procedure($_)) } $schema->get_procedures, }, + }, + translator => { + add_drop_table => $translator->add_drop_table, + filename => $translator->filename, + no_comments => $translator->no_comments, + parser_args => $translator->parser_args, + producer_args => $translator->producer_args, + parser_type => $translator->parser_type, + producer_type => $translator->producer_type, + show_warnings => $translator->show_warnings, + trace => $translator->trace, + version => $translator->version, + }, + keys %{ $schema->extra } ? ('extra' => { $schema->extra }) : (), + }); } sub view_table { - my $table = shift; - - return { - 'name' => $table->name, - 'order' => $table->order, - 'options' => $table->options || [], - $table->comments ? ('comments' => [ $table->comments ] ) : (), - 'constraints' => [ - map { view_constraint($_) } $table->get_constraints - ], - 'indices' => [ - map { view_index($_) } $table->get_indices - ], - 'fields' => { - map { ($_->name => view_field($_)) } - $table->get_fields - }, - keys %{$table->extra} ? ('extra' => { $table->extra } ) : (), - }; + my $table = shift; + + return { + 'name' => $table->name, + 'order' => $table->order, + 'options' => $table->options || [], + $table->comments ? ('comments' => [ $table->comments ]) : (), + 'constraints' => [ + map { view_constraint($_) } $table->get_constraints + ], + 'indices' => [ + map { view_index($_) } $table->get_indices + ], + 'fields' => { + map { ($_->name => view_field($_)) } + $table->get_fields + }, + keys %{ $table->extra } ? ('extra' => { $table->extra }) : (), + }; } sub view_constraint { - my $constraint = shift; - - return { - 'deferrable' => scalar $constraint->deferrable, - 'expression' => scalar $constraint->expression, - 'fields' => [ map { ref $_ ? $_->name : $_ } $constraint->field_names ], - 'match_type' => scalar $constraint->match_type, - 'name' => scalar $constraint->name, - 'options' => scalar $constraint->options, - 'on_delete' => scalar $constraint->on_delete, - 'on_update' => scalar $constraint->on_update, - 'reference_fields' => [ map { ref $_ ? $_->name : $_ } $constraint->reference_fields ], - 'reference_table' => scalar $constraint->reference_table, - 'type' => scalar $constraint->type, - keys %{$constraint->extra} ? ('extra' => { $constraint->extra } ) : (), - }; + my $constraint = shift; + + return { + 'deferrable' => scalar $constraint->deferrable, + 'expression' => scalar $constraint->expression, + 'fields' => [ map { ref $_ ? $_->name : $_ } $constraint->field_names ], + 'match_type' => scalar $constraint->match_type, + 'name' => scalar $constraint->name, + 'options' => scalar $constraint->options, + 'on_delete' => scalar $constraint->on_delete, + 'on_update' => scalar $constraint->on_update, + 'reference_fields' => [ map { ref $_ ? $_->name : $_ } $constraint->reference_fields ], + 'reference_table' => scalar $constraint->reference_table, + 'type' => scalar $constraint->type, + keys %{ $constraint->extra } + ? ('extra' => { $constraint->extra }) + : (), + }; } sub view_field { - my $field = shift; - - return { - 'order' => scalar $field->order, - 'name' => scalar $field->name, - 'data_type' => scalar $field->data_type, - 'size' => [ $field->size ], - 'default_value' => scalar $field->default_value, - 'is_nullable' => scalar $field->is_nullable, - 'is_primary_key' => scalar $field->is_primary_key, - 'is_unique' => scalar $field->is_unique, - $field->is_auto_increment ? ('is_auto_increment' => 1) : (), - $field->comments ? ('comments' => [ $field->comments ]) : (), - keys %{$field->extra} ? ('extra' => { $field->extra } ) : (), - }; + my $field = shift; + + return { + 'order' => scalar $field->order, + 'name' => scalar $field->name, + 'data_type' => scalar $field->data_type, + 'size' => [ $field->size ], + 'default_value' => scalar $field->default_value, + 'is_nullable' => scalar $field->is_nullable, + 'is_primary_key' => scalar $field->is_primary_key, + 'is_unique' => scalar $field->is_unique, + $field->is_auto_increment ? ('is_auto_increment' => 1) : (), + $field->comments ? ('comments' => [ $field->comments ]) : (), + keys %{ $field->extra } ? ('extra' => { $field->extra }) : (), + }; } sub view_procedure { - my $procedure = shift; - - return { - 'order' => scalar $procedure->order, - 'name' => scalar $procedure->name, - 'sql' => scalar $procedure->sql, - 'parameters' => scalar $procedure->parameters, - 'owner' => scalar $procedure->owner, - $procedure->comments ? ('comments' => [ $procedure->comments ] ) : (), - keys %{$procedure->extra} ? ('extra' => { $procedure->extra } ) : (), - }; + my $procedure = shift; + + return { + 'order' => scalar $procedure->order, + 'name' => scalar $procedure->name, + 'sql' => scalar $procedure->sql, + 'parameters' => scalar $procedure->parameters, + 'owner' => scalar $procedure->owner, + $procedure->comments ? ('comments' => [ $procedure->comments ]) : (), + keys %{ $procedure->extra } ? ('extra' => { $procedure->extra }) : (), + }; } sub view_trigger { - my $trigger = shift; - - return { - 'order' => scalar $trigger->order, - 'name' => scalar $trigger->name, - 'perform_action_when' => scalar $trigger->perform_action_when, - 'database_events' => scalar $trigger->database_events, - 'fields' => scalar $trigger->fields, - 'on_table' => scalar $trigger->on_table, - 'action' => scalar $trigger->action, - (defined $trigger->scope ? ( - 'scope' => scalar $trigger->scope, - ) : ()), - keys %{$trigger->extra} ? ('extra' => { $trigger->extra } ) : (), - }; + my $trigger = shift; + + return { + 'order' => scalar $trigger->order, + 'name' => scalar $trigger->name, + 'perform_action_when' => scalar $trigger->perform_action_when, + 'database_events' => scalar $trigger->database_events, + 'fields' => scalar $trigger->fields, + 'on_table' => scalar $trigger->on_table, + 'action' => scalar $trigger->action, + ( + defined $trigger->scope + ? ('scope' => scalar $trigger->scope,) + : () + ), + keys %{ $trigger->extra } ? ('extra' => { $trigger->extra }) : (), + }; } sub view_view { - my $view = shift; - - return { - 'order' => scalar $view->order, - 'name' => scalar $view->name, - 'sql' => scalar $view->sql, - 'fields' => scalar $view->fields, - keys %{$view->extra} ? ('extra' => { $view->extra } ) : (), - }; + my $view = shift; + + return { + 'order' => scalar $view->order, + 'name' => scalar $view->name, + 'sql' => scalar $view->sql, + 'fields' => scalar $view->fields, + keys %{ $view->extra } ? ('extra' => { $view->extra }) : (), + }; } sub view_index { - my $index = shift; - - return { - 'name' => scalar $index->name, - 'type' => scalar $index->type, - # If the index has extra properties, make sure these are written too - 'fields' => [ map { ref($_) && $_->extra && keys %{$_->extra} ? { name => $_->name, %{$_->extra} } : "$_" } $index->fields ], - 'options' => scalar $index->options, - keys %{$index->extra} ? ('extra' => { $index->extra } ) : (), - }; + my $index = shift; + + return { + 'name' => scalar $index->name, + 'type' => scalar $index->type, + + # If the index has extra properties, make sure these are written too + 'fields' => [ + map { ref($_) && $_->extra && keys %{ $_->extra } ? { name => $_->name, %{ $_->extra } } : "$_" } + $index->fields + ], + 'options' => scalar $index->options, + keys %{ $index->extra } ? ('extra' => { $index->extra }) : (), + }; } 1; diff --git a/lib/SQL/Translator/Role/BuildArgs.pm b/lib/SQL/Translator/Role/BuildArgs.pm index 4212f2b51..783840510 100644 --- a/lib/SQL/Translator/Role/BuildArgs.pm +++ b/lib/SQL/Translator/Role/BuildArgs.pm @@ -21,14 +21,14 @@ L. use Moo::Role; around BUILDARGS => sub { - my $orig = shift; - my $self = shift; - my $args = $self->$orig(@_); - - foreach my $arg (keys %{$args}) { - delete $args->{$arg} unless defined($args->{$arg}); - } - return $args; + my $orig = shift; + my $self = shift; + my $args = $self->$orig(@_); + + foreach my $arg (keys %{$args}) { + delete $args->{$arg} unless defined($args->{$arg}); + } + return $args; }; 1; diff --git a/lib/SQL/Translator/Role/Debug.pm b/lib/SQL/Translator/Role/Debug.pm index 671e00a8e..f160a082b 100644 --- a/lib/SQL/Translator/Role/Debug.pm +++ b/lib/SQL/Translator/Role/Debug.pm @@ -3,39 +3,39 @@ use Moo::Role; use Sub::Quote qw(quote_sub); has _DEBUG => ( - is => 'rw', - accessor => 'debugging', - init_arg => 'debugging', - coerce => quote_sub(q{ $_[0] ? 1 : 0 }), - lazy => 1, - builder => 1, + is => 'rw', + accessor => 'debugging', + init_arg => 'debugging', + coerce => quote_sub(q{ $_[0] ? 1 : 0 }), + lazy => 1, + builder => 1, ); sub _build__DEBUG { - my ($self) = @_; - my $class = ref $self; - no strict 'refs'; - return ${"${class}::DEBUG"}; + my ($self) = @_; + my $class = ref $self; + no strict 'refs'; + return ${"${class}::DEBUG"}; } around debugging => sub { - my ($orig, $self) = (shift, shift); - - # Emulate horrible Class::Base API - unless (ref $self) { - my $dbgref = do { no strict 'refs'; \${"${self}::DEBUG"} }; - $$dbgref = $_[0] if @_; - return $$dbgref; - } - return $self->$orig(@_); + my ($orig, $self) = (shift, shift); + + # Emulate horrible Class::Base API + unless (ref $self) { + my $dbgref = do { no strict 'refs'; \${"${self}::DEBUG"} }; + $$dbgref = $_[0] if @_; + return $$dbgref; + } + return $self->$orig(@_); }; sub debug { - my $self = shift; + my $self = shift; - return unless $self->debugging; + return unless $self->debugging; - print STDERR '[', (ref $self || $self), '] ', @_, "\n"; + print STDERR '[', (ref $self || $self), '] ', @_, "\n"; } 1; diff --git a/lib/SQL/Translator/Role/Error.pm b/lib/SQL/Translator/Role/Error.pm index 00a75248b..613bd15cc 100644 --- a/lib/SQL/Translator/Role/Error.pm +++ b/lib/SQL/Translator/Role/Error.pm @@ -36,10 +36,10 @@ use Moo::Role; use Sub::Quote qw(quote_sub); has _ERROR => ( - is => 'rw', - accessor => 'error', - init_arg => undef, - default => quote_sub(q{ '' }), + is => 'rw', + accessor => 'error', + init_arg => undef, + default => quote_sub(q{ '' }), ); =head1 METHODS @@ -56,19 +56,19 @@ depending on whether the invocant is an object. =cut around error => sub { - my ($orig, $self) = (shift, shift); - - # Emulate horrible Class::Base API - unless (ref($self)) { - my $errref = do { no strict 'refs'; \${"${self}::ERROR"} }; - return $$errref unless @_; - $$errref = $_[0]; - return undef; - } + my ($orig, $self) = (shift, shift); - return $self->$orig unless @_; - $self->$orig(@_); + # Emulate horrible Class::Base API + unless (ref($self)) { + my $errref = do { no strict 'refs'; \${"${self}::ERROR"} }; + return $$errref unless @_; + $$errref = $_[0]; return undef; + } + + return $self->$orig unless @_; + $self->$orig(@_); + return undef; }; =head1 SEE ALSO diff --git a/lib/SQL/Translator/Role/ListAttr.pm b/lib/SQL/Translator/Role/ListAttr.pm index fd4070031..ef9052a06 100644 --- a/lib/SQL/Translator/Role/ListAttr.pm +++ b/lib/SQL/Translator/Role/ListAttr.pm @@ -23,13 +23,13 @@ attributes. =cut use SQL::Translator::Utils qw(parse_list_arg ex2err uniq); -use Sub::Quote qw(quote_sub); +use Sub::Quote qw(quote_sub); use Package::Variant ( - importing => { - 'Moo::Role' => [], - }, - subs => [qw(has around)], + importing => { + 'Moo::Role' => [], + }, + subs => [qw(has around)], ); =head1 FUNCTIONS @@ -78,40 +78,40 @@ the attribute. =cut sub make_variant { - my ($class, $target_package, $name, %arguments) = @_; - - my $may_throw = delete $arguments{may_throw}; - my $undef_if_empty = delete $arguments{undef_if_empty}; - my $append = delete $arguments{append}; - my $coerce = delete $arguments{uniq} - ? sub { [ uniq @{parse_list_arg($_[0])} ] } - : \&parse_list_arg; - - has($name => ( - is => 'rw', - (!$arguments{builder} ? ( - default => quote_sub(q{ [] }), - ) : ()), - coerce => $coerce, - %arguments, - )); - - around($name => sub { - my ($orig, $self) = (shift, shift); - my $list = parse_list_arg(@_); - $self->$orig([ @{$append ? $self->$orig : []}, @$list ]) - if @$list; - - my $return; - if ($may_throw) { - $return = ex2err($orig, $self) or return; - } - else { - $return = $self->$orig; - } - my $scalar_return = !@{$return} && $undef_if_empty ? undef : $return; - return wantarray ? @{$return} : $scalar_return; - }); + my ($class, $target_package, $name, %arguments) = @_; + + my $may_throw = delete $arguments{may_throw}; + my $undef_if_empty = delete $arguments{undef_if_empty}; + my $append = delete $arguments{append}; + my $coerce + = delete $arguments{uniq} + ? sub { [ uniq @{ parse_list_arg($_[0]) } ] } + : \&parse_list_arg; + + has($name => ( + is => 'rw', + (!$arguments{builder} ? (default => quote_sub(q{ [] }),) : ()), + coerce => $coerce, + %arguments, + )); + + around( + $name => sub { + my ($orig, $self) = (shift, shift); + my $list = parse_list_arg(@_); + $self->$orig([ @{ $append ? $self->$orig : [] }, @$list ]) + if @$list; + + my $return; + if ($may_throw) { + $return = ex2err($orig, $self) or return; + } else { + $return = $self->$orig; + } + my $scalar_return = !@{$return} && $undef_if_empty ? undef : $return; + return wantarray ? @{$return} : $scalar_return; + } + ); } =head1 SEE ALSO diff --git a/lib/SQL/Translator/Schema.pm b/lib/SQL/Translator/Schema.pm index 419e75ca0..f48448b31 100644 --- a/lib/SQL/Translator/Schema.pm +++ b/lib/SQL/Translator/Schema.pm @@ -41,13 +41,16 @@ extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.64'; - -has _order => (is => 'ro', default => quote_sub(q{ +{ map { $_ => 0 } qw/ +has _order => ( + is => 'ro', + default => quote_sub( + q{ +{ map { $_ => 0 } qw/ table view trigger proc - /} }), + /} } + ), ); sub as_graph_pm { @@ -60,28 +63,28 @@ Returns a Graph::Directed object with the table names for nodes. =cut - require Graph::Directed; + require Graph::Directed; - my $self = shift; - my $g = Graph::Directed->new; + my $self = shift; + my $g = Graph::Directed->new; - for my $table ( $self->get_tables ) { - my $tname = $table->name; - $g->add_vertex( $tname ); + for my $table ($self->get_tables) { + my $tname = $table->name; + $g->add_vertex($tname); - for my $field ( $table->get_fields ) { - if ( $field->is_foreign_key ) { - my $fktable = $field->foreign_key_reference->reference_table; + for my $field ($table->get_fields) { + if ($field->is_foreign_key) { + my $fktable = $field->foreign_key_reference->reference_table; - $g->add_edge( $fktable, $tname ); - } - } + $g->add_edge($fktable, $tname); + } } + } - return $g; + return $g; } -has _tables => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) ); +has _tables => (is => 'ro', init_arg => undef, default => quote_sub(q{ +{} })); sub add_table { @@ -100,34 +103,32 @@ not be created. =cut - my $self = shift; - my $table_class = 'SQL::Translator::Schema::Table'; - my $table; + my $self = shift; + my $table_class = 'SQL::Translator::Schema::Table'; + my $table; - if ( UNIVERSAL::isa( $_[0], $table_class ) ) { - $table = shift; - $table->schema($self); - } - else { - my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; - $args{'schema'} = $self; - $table = $table_class->new( \%args ) - or return $self->error( $table_class->error ); - } + if (UNIVERSAL::isa($_[0], $table_class)) { + $table = shift; + $table->schema($self); + } else { + my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; + $args{'schema'} = $self; + $table = $table_class->new(\%args) + or return $self->error($table_class->error); + } - $table->order( ++$self->_order->{table} ); + $table->order(++$self->_order->{table}); - # We know we have a name as the Table->new above errors if none given. - my $table_name = $table->name; + # We know we have a name as the Table->new above errors if none given. + my $table_name = $table->name; - if ( defined $self->_tables->{$table_name} ) { - return $self->error(qq[Can't use table name "$table_name": table exists]); - } - else { - $self->_tables->{$table_name} = $table; - } + if (defined $self->_tables->{$table_name}) { + return $self->error(qq[Can't use table name "$table_name": table exists]); + } else { + $self->_tables->{$table_name} = $table; + } - return $table; + return $table; } sub drop_table { @@ -146,35 +147,33 @@ can be set to 1 to also drop all triggers on the table, default is 0. =cut - my $self = shift; - my $table_class = 'SQL::Translator::Schema::Table'; - my $table_name; + my $self = shift; + my $table_class = 'SQL::Translator::Schema::Table'; + my $table_name; - if ( UNIVERSAL::isa( $_[0], $table_class ) ) { - $table_name = shift->name; - } - else { - $table_name = shift; - } - my %args = @_; - my $cascade = $args{'cascade'}; + if (UNIVERSAL::isa($_[0], $table_class)) { + $table_name = shift->name; + } else { + $table_name = shift; + } + my %args = @_; + my $cascade = $args{'cascade'}; - if ( !exists $self->_tables->{$table_name} ) { - return $self->error(qq[Can't drop table: "$table_name" doesn't exist]); - } + if (!exists $self->_tables->{$table_name}) { + return $self->error(qq[Can't drop table: "$table_name" doesn't exist]); + } - my $table = delete $self->_tables->{$table_name}; + my $table = delete $self->_tables->{$table_name}; - if ($cascade) { + if ($cascade) { - # Drop all triggers on this table - $self->drop_trigger() - for ( grep { $_->on_table eq $table_name } values %{ $self->_triggers } ); - } - return $table; + # Drop all triggers on this table + $self->drop_trigger() for (grep { $_->on_table eq $table_name } values %{ $self->_triggers }); + } + return $table; } -has _procedures => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) ); +has _procedures => (is => 'ro', init_arg => undef, default => quote_sub(q{ +{} })); sub add_procedure { @@ -193,35 +192,32 @@ procedure will not be created. =cut - my $self = shift; - my $procedure_class = 'SQL::Translator::Schema::Procedure'; - my $procedure; - - if ( UNIVERSAL::isa( $_[0], $procedure_class ) ) { - $procedure = shift; - $procedure->schema($self); - } - else { - my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; - $args{'schema'} = $self; - return $self->error('No procedure name') unless $args{'name'}; - $procedure = $procedure_class->new( \%args ) - or return $self->error( $procedure_class->error ); - } - - $procedure->order( ++$self->_order->{proc} ); - my $procedure_name = $procedure->name + my $self = shift; + my $procedure_class = 'SQL::Translator::Schema::Procedure'; + my $procedure; + + if (UNIVERSAL::isa($_[0], $procedure_class)) { + $procedure = shift; + $procedure->schema($self); + } else { + my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; + $args{'schema'} = $self; + return $self->error('No procedure name') unless $args{'name'}; + $procedure = $procedure_class->new(\%args) + or return $self->error($procedure_class->error); + } + + $procedure->order(++$self->_order->{proc}); + my $procedure_name = $procedure->name or return $self->error('No procedure name'); - if ( defined $self->_procedures->{$procedure_name} ) { - return $self->error( - qq[Can't create procedure: "$procedure_name" exists] ); - } - else { - $self->_procedures->{$procedure_name} = $procedure; - } + if (defined $self->_procedures->{$procedure_name}) { + return $self->error(qq[Can't create procedure: "$procedure_name" exists]); + } else { + $self->_procedures->{$procedure_name} = $procedure; + } - return $procedure; + return $procedure; } sub drop_procedure { @@ -239,28 +235,26 @@ object. =cut - my $self = shift; - my $proc_class = 'SQL::Translator::Schema::Procedure'; - my $proc_name; + my $self = shift; + my $proc_class = 'SQL::Translator::Schema::Procedure'; + my $proc_name; - if ( UNIVERSAL::isa( $_[0], $proc_class ) ) { - $proc_name = shift->name; - } - else { - $proc_name = shift; - } + if (UNIVERSAL::isa($_[0], $proc_class)) { + $proc_name = shift->name; + } else { + $proc_name = shift; + } - if ( !exists $self->_procedures->{$proc_name} ) { - return $self->error( - qq[Can't drop procedure: "$proc_name" doesn't exist]); - } + if (!exists $self->_procedures->{$proc_name}) { + return $self->error(qq[Can't drop procedure: "$proc_name" doesn't exist]); + } - my $proc = delete $self->_procedures->{$proc_name}; + my $proc = delete $self->_procedures->{$proc_name}; - return $proc; + return $proc; } -has _triggers => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) ); +has _triggers => (is => 'ro', init_arg => undef, default => quote_sub(q{ +{} })); sub add_trigger { @@ -279,33 +273,31 @@ not be created. =cut - my $self = shift; - my $trigger_class = 'SQL::Translator::Schema::Trigger'; - my $trigger; - - if ( UNIVERSAL::isa( $_[0], $trigger_class ) ) { - $trigger = shift; - $trigger->schema($self); - } - else { - my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; - $args{'schema'} = $self; - return $self->error('No trigger name') unless $args{'name'}; - $trigger = $trigger_class->new( \%args ) - or return $self->error( $trigger_class->error ); - } - - $trigger->order( ++$self->_order->{trigger} ); - - my $trigger_name = $trigger->name or return $self->error('No trigger name'); - if ( defined $self->_triggers->{$trigger_name} ) { - return $self->error(qq[Can't create trigger: "$trigger_name" exists]); - } - else { - $self->_triggers->{$trigger_name} = $trigger; - } - - return $trigger; + my $self = shift; + my $trigger_class = 'SQL::Translator::Schema::Trigger'; + my $trigger; + + if (UNIVERSAL::isa($_[0], $trigger_class)) { + $trigger = shift; + $trigger->schema($self); + } else { + my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; + $args{'schema'} = $self; + return $self->error('No trigger name') unless $args{'name'}; + $trigger = $trigger_class->new(\%args) + or return $self->error($trigger_class->error); + } + + $trigger->order(++$self->_order->{trigger}); + + my $trigger_name = $trigger->name or return $self->error('No trigger name'); + if (defined $self->_triggers->{$trigger_name}) { + return $self->error(qq[Can't create trigger: "$trigger_name" exists]); + } else { + $self->_triggers->{$trigger_name} = $trigger; + } + + return $trigger; } sub drop_trigger { @@ -322,28 +314,26 @@ trigger name or an L object. =cut - my $self = shift; - my $trigger_class = 'SQL::Translator::Schema::Trigger'; - my $trigger_name; + my $self = shift; + my $trigger_class = 'SQL::Translator::Schema::Trigger'; + my $trigger_name; - if ( UNIVERSAL::isa( $_[0], $trigger_class ) ) { - $trigger_name = shift->name; - } - else { - $trigger_name = shift; - } + if (UNIVERSAL::isa($_[0], $trigger_class)) { + $trigger_name = shift->name; + } else { + $trigger_name = shift; + } - if ( !exists $self->_triggers->{$trigger_name} ) { - return $self->error( - qq[Can't drop trigger: "$trigger_name" doesn't exist]); - } + if (!exists $self->_triggers->{$trigger_name}) { + return $self->error(qq[Can't drop trigger: "$trigger_name" doesn't exist]); + } - my $trigger = delete $self->_triggers->{$trigger_name}; + my $trigger = delete $self->_triggers->{$trigger_name}; - return $trigger; + return $trigger; } -has _views => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) ); +has _views => (is => 'ro', init_arg => undef, default => quote_sub(q{ +{} })); sub add_view { @@ -362,32 +352,30 @@ not be created. =cut - my $self = shift; - my $view_class = 'SQL::Translator::Schema::View'; - my $view; - - if ( UNIVERSAL::isa( $_[0], $view_class ) ) { - $view = shift; - $view->schema($self); - } - else { - my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; - $args{'schema'} = $self; - return $self->error('No view name') unless $args{'name'}; - $view = $view_class->new( \%args ) or return $view_class->error; - } - - $view->order( ++$self->_order->{view} ); - my $view_name = $view->name or return $self->error('No view name'); - - if ( defined $self->_views->{$view_name} ) { - return $self->error(qq[Can't create view: "$view_name" exists]); - } - else { - $self->_views->{$view_name} = $view; - } - - return $view; + my $self = shift; + my $view_class = 'SQL::Translator::Schema::View'; + my $view; + + if (UNIVERSAL::isa($_[0], $view_class)) { + $view = shift; + $view->schema($self); + } else { + my %args = ref $_[0] eq 'HASH' ? %{ $_[0] } : @_; + $args{'schema'} = $self; + return $self->error('No view name') unless $args{'name'}; + $view = $view_class->new(\%args) or return $view_class->error; + } + + $view->order(++$self->_order->{view}); + my $view_name = $view->name or return $self->error('No view name'); + + if (defined $self->_views->{$view_name}) { + return $self->error(qq[Can't create view: "$view_name" exists]); + } else { + $self->_views->{$view_name} = $view; + } + + return $view; } sub drop_view { @@ -404,24 +392,23 @@ name or an L object. =cut - my $self = shift; - my $view_class = 'SQL::Translator::Schema::View'; - my $view_name; + my $self = shift; + my $view_class = 'SQL::Translator::Schema::View'; + my $view_name; - if ( UNIVERSAL::isa( $_[0], $view_class ) ) { - $view_name = shift->name; - } - else { - $view_name = shift; - } + if (UNIVERSAL::isa($_[0], $view_class)) { + $view_name = shift->name; + } else { + $view_name = shift; + } - if ( !exists $self->_views->{$view_name} ) { - return $self->error(qq[Can't drop view: "$view_name" doesn't exist]); - } + if (!exists $self->_views->{$view_name}) { + return $self->error(qq[Can't drop view: "$view_name" doesn't exist]); + } - my $view = delete $self->_views->{$view_name}; + my $view = delete $self->_views->{$view_name}; - return $view; + return $view; } =head2 database @@ -432,7 +419,7 @@ Get or set the schema's database. (optional) =cut -has database => ( is => 'rw', default => quote_sub(q{ '' }) ); +has database => (is => 'rw', default => quote_sub(q{ '' })); sub is_valid { @@ -446,15 +433,15 @@ Returns true if all the tables and views are valid. =cut - my $self = shift; + my $self = shift; - return $self->error('No tables') unless $self->get_tables; + return $self->error('No tables') unless $self->get_tables; - for my $object ( $self->get_tables, $self->get_views ) { - return $object->error unless $object->is_valid; - } + for my $object ($self->get_tables, $self->get_views) { + return $object->error unless $object->is_valid; + } - return 1; + return 1; } sub get_procedure { @@ -469,11 +456,11 @@ Returns a procedure by the name provided. =cut - my $self = shift; - my $procedure_name = shift or return $self->error('No procedure name'); - return $self->error(qq[Table "$procedure_name" does not exist]) + my $self = shift; + my $procedure_name = shift or return $self->error('No procedure name'); + return $self->error(qq[Table "$procedure_name" does not exist]) unless exists $self->_procedures->{$procedure_name}; - return $self->_procedures->{$procedure_name}; + return $self->_procedures->{$procedure_name}; } sub get_procedures { @@ -488,19 +475,17 @@ Returns all the procedures as an array or array reference. =cut - my $self = shift; - my @procedures = - map { $_->[1] } + my $self = shift; + my @procedures = map { $_->[1] } sort { $a->[0] <=> $b->[0] } - map { [ $_->order, $_ ] } values %{ $self->_procedures }; - - if (@procedures) { - return wantarray ? @procedures : \@procedures; - } - else { - $self->error('No procedures'); - return; - } + map { [ $_->order, $_ ] } values %{ $self->_procedures }; + + if (@procedures) { + return wantarray ? @procedures : \@procedures; + } else { + $self->error('No procedures'); + return; + } } sub get_table { @@ -515,19 +500,19 @@ Returns a table by the name provided. =cut - my $self = shift; - my $table_name = shift or return $self->error('No table name'); - my $case_insensitive = shift; - if ( $case_insensitive ) { - $table_name = uc($table_name); - foreach my $table ( keys %{$self->_tables} ) { - return $self->_tables->{$table} if $table_name eq uc($table); - } - return $self->error(qq[Table "$table_name" does not exist]); - } - return $self->error(qq[Table "$table_name" does not exist]) + my $self = shift; + my $table_name = shift or return $self->error('No table name'); + my $case_insensitive = shift; + if ($case_insensitive) { + $table_name = uc($table_name); + foreach my $table (keys %{ $self->_tables }) { + return $self->_tables->{$table} if $table_name eq uc($table); + } + return $self->error(qq[Table "$table_name" does not exist]); + } + return $self->error(qq[Table "$table_name" does not exist]) unless exists $self->_tables->{$table_name}; - return $self->_tables->{$table_name}; + return $self->_tables->{$table_name}; } sub get_tables { @@ -542,19 +527,17 @@ Returns all the tables as an array or array reference. =cut - my $self = shift; - my @tables = - map { $_->[1] } + my $self = shift; + my @tables = map { $_->[1] } sort { $a->[0] <=> $b->[0] } - map { [ $_->order, $_ ] } values %{ $self->_tables }; - - if (@tables) { - return wantarray ? @tables : \@tables; - } - else { - $self->error('No tables'); - return; - } + map { [ $_->order, $_ ] } values %{ $self->_tables }; + + if (@tables) { + return wantarray ? @tables : \@tables; + } else { + $self->error('No tables'); + return; + } } sub get_trigger { @@ -569,11 +552,11 @@ Returns a trigger by the name provided. =cut - my $self = shift; - my $trigger_name = shift or return $self->error('No trigger name'); - return $self->error(qq[Trigger "$trigger_name" does not exist]) + my $self = shift; + my $trigger_name = shift or return $self->error('No trigger name'); + return $self->error(qq[Trigger "$trigger_name" does not exist]) unless exists $self->_triggers->{$trigger_name}; - return $self->_triggers->{$trigger_name}; + return $self->_triggers->{$trigger_name}; } sub get_triggers { @@ -588,19 +571,17 @@ Returns all the triggers as an array or array reference. =cut - my $self = shift; - my @triggers = - map { $_->[1] } + my $self = shift; + my @triggers = map { $_->[1] } sort { $a->[0] <=> $b->[0] } - map { [ $_->order, $_ ] } values %{ $self->_triggers }; - - if (@triggers) { - return wantarray ? @triggers : \@triggers; - } - else { - $self->error('No triggers'); - return; - } + map { [ $_->order, $_ ] } values %{ $self->_triggers }; + + if (@triggers) { + return wantarray ? @triggers : \@triggers; + } else { + $self->error('No triggers'); + return; + } } sub get_view { @@ -615,11 +596,11 @@ Returns a view by the name provided. =cut - my $self = shift; - my $view_name = shift or return $self->error('No view name'); - return $self->error('View "$view_name" does not exist') + my $self = shift; + my $view_name = shift or return $self->error('No view name'); + return $self->error('View "$view_name" does not exist') unless exists $self->_views->{$view_name}; - return $self->_views->{$view_name}; + return $self->_views->{$view_name}; } sub get_views { @@ -634,19 +615,17 @@ Returns all the views as an array or array reference. =cut - my $self = shift; - my @views = - map { $_->[1] } + my $self = shift; + my @views = map { $_->[1] } sort { $a->[0] <=> $b->[0] } - map { [ $_->order, $_ ] } values %{ $self->_views }; - - if (@views) { - return wantarray ? @views : \@views; - } - else { - $self->error('No views'); - return; - } + map { [ $_->order, $_ ] } values %{ $self->_views }; + + if (@views) { + return wantarray ? @views : \@views; + } else { + $self->error('No views'); + return; + } } sub make_natural_joins { @@ -678,46 +657,45 @@ A list of fields to skip in the joins =cut - my $self = shift; - my %args = @_; - my $join_pk_only = $args{'join_pk_only'} || 0; - my %skip_fields = - map { s/^\s+|\s+$//g; $_, 1 } @{ parse_list_arg( $args{'skip_fields'} ) }; - - my ( %common_keys, %pk ); - for my $table ( $self->get_tables ) { - for my $field ( $table->get_fields ) { - my $field_name = $field->name or next; - next if $skip_fields{$field_name}; - $pk{$field_name} = 1 if $field->is_primary_key; - push @{ $common_keys{$field_name} }, $table->name; - } + my $self = shift; + my %args = @_; + my $join_pk_only = $args{'join_pk_only'} || 0; + my %skip_fields = map { s/^\s+|\s+$//g; $_, 1 } @{ parse_list_arg($args{'skip_fields'}) }; + + my (%common_keys, %pk); + for my $table ($self->get_tables) { + for my $field ($table->get_fields) { + my $field_name = $field->name or next; + next if $skip_fields{$field_name}; + $pk{$field_name} = 1 if $field->is_primary_key; + push @{ $common_keys{$field_name} }, $table->name; } + } - for my $field ( keys %common_keys ) { - next if $join_pk_only and !defined $pk{$field}; + for my $field (keys %common_keys) { + next if $join_pk_only and !defined $pk{$field}; - my @table_names = @{ $common_keys{$field} }; - next unless scalar @table_names > 1; + my @table_names = @{ $common_keys{$field} }; + next unless scalar @table_names > 1; - for my $i ( 0 .. $#table_names ) { - my $table1 = $self->get_table( $table_names[$i] ) or next; + for my $i (0 .. $#table_names) { + my $table1 = $self->get_table($table_names[$i]) or next; - for my $j ( 1 .. $#table_names ) { - my $table2 = $self->get_table( $table_names[$j] ) or next; - next if $table1->name eq $table2->name; + for my $j (1 .. $#table_names) { + my $table2 = $self->get_table($table_names[$j]) or next; + next if $table1->name eq $table2->name; - $table1->add_constraint( - type => FOREIGN_KEY, - fields => $field, - reference_table => $table2->name, - reference_fields => $field, - ); - } - } + $table1->add_constraint( + type => FOREIGN_KEY, + fields => $field, + reference_table => $table2->name, + reference_fields => $field, + ); + } } + } - return 1; + return 1; } =head2 name @@ -728,7 +706,7 @@ Get or set the schema's name. (optional) =cut -has name => ( is => 'rw', default => quote_sub(q{ '' }) ); +has name => (is => 'rw', default => quote_sub(q{ '' })); =pod @@ -738,7 +716,7 @@ Get the SQL::Translator instance that instantiated the parser. =cut -has translator => ( is => 'rw', weak_ref => 1 ); +has translator => (is => 'rw', weak_ref => 1); 1; diff --git a/lib/SQL/Translator/Schema/Constants.pm b/lib/SQL/Translator/Schema/Constants.pm index efbf67c07..96a794a03 100644 --- a/lib/SQL/Translator/Schema/Constants.pm +++ b/lib/SQL/Translator/Schema/Constants.pm @@ -48,16 +48,16 @@ require Exporter; our $VERSION = '1.64'; our @EXPORT = qw[ - CHECK_C - FOREIGN_KEY - FULL_TEXT - SPATIAL - NOT_NULL - NORMAL - NULL - PRIMARY_KEY - UNIQUE - EXCLUDE + CHECK_C + FOREIGN_KEY + FULL_TEXT + SPATIAL + NOT_NULL + NORMAL + NULL + PRIMARY_KEY + UNIQUE + EXCLUDE ]; # diff --git a/lib/SQL/Translator/Schema/Constraint.pm b/lib/SQL/Translator/Schema/Constraint.pm index d8317b2f2..a1b63385f 100644 --- a/lib/SQL/Translator/Schema/Constraint.pm +++ b/lib/SQL/Translator/Schema/Constraint.pm @@ -28,20 +28,13 @@ use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw(ex2err throw); use SQL::Translator::Role::ListAttr; use SQL::Translator::Types qw(schema_obj enum); -use Sub::Quote qw(quote_sub); +use Sub::Quote qw(quote_sub); extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.64'; -my %VALID_CONSTRAINT_TYPE = ( - PRIMARY_KEY, 1, - UNIQUE, 1, - CHECK_C, 1, - FOREIGN_KEY, 1, - NOT_NULL, 1, - EXCLUDE, 1, -); +my %VALID_CONSTRAINT_TYPE = (PRIMARY_KEY, 1, UNIQUE, 1, CHECK_C, 1, FOREIGN_KEY, 1, NOT_NULL, 1, EXCLUDE, 1,); =head2 new @@ -64,17 +57,18 @@ Object constructor. # Override to remove empty arrays from args. # t/14postgres-parser breaks without this. around BUILDARGS => sub { - my $orig = shift; - my $self = shift; - my $args = $self->$orig(@_); - - foreach my $arg (keys %{$args}) { - delete $args->{$arg} if ref($args->{$arg}) eq "ARRAY" && !@{$args->{$arg}}; - } - if (exists $args->{fields}) { - $args->{field_names} = delete $args->{fields}; - } - return $args; + my $orig = shift; + my $self = shift; + my $args = $self->$orig(@_); + + foreach my $arg (keys %{$args}) { + delete $args->{$arg} + if ref($args->{$arg}) eq "ARRAY" && !@{ $args->{$arg} }; + } + if (exists $args->{fields}) { + $args->{field_names} = delete $args->{fields}; + } + return $args; }; =head2 deferrable @@ -90,9 +84,9 @@ False, so the following are equivalent: =cut has deferrable => ( - is => 'rw', - coerce => quote_sub(q{ $_[0] ? 1 : 0 }), - default => quote_sub(q{ 1 }), + is => 'rw', + coerce => quote_sub(q{ $_[0] ? 1 : 0 }), + default => quote_sub(q{ 1 }), ); =head2 expression @@ -103,11 +97,11 @@ Gets and set the expression used in a CHECK constraint. =cut -has expression => ( is => 'rw', default => quote_sub(q{ '' }) ); +has expression => (is => 'rw', default => quote_sub(q{ '' })); around expression => sub { - my ($orig, $self, $arg) = @_; - $self->$orig($arg || ()); + my ($orig, $self, $arg) = @_; + $self->$orig($arg || ()); }; sub is_valid { @@ -122,54 +116,47 @@ Determine whether the constraint is valid or not. =cut - my $self = shift; - my $type = $self->type or return $self->error('No type'); - my $table = $self->table or return $self->error('No table'); - my @fields = $self->fields or return $self->error('No fields'); - my $table_name = $table->name or return $self->error('No table name'); - - for my $f ( @fields ) { - next if $table->get_field( $f ); - return $self->error( - "Constraint references non-existent field '$f' ", - "in table '$table_name'" - ); - } + my $self = shift; + my $type = $self->type or return $self->error('No type'); + my $table = $self->table or return $self->error('No table'); + my @fields = $self->fields or return $self->error('No fields'); + my $table_name = $table->name or return $self->error('No table name'); - my $schema = $table->schema or return $self->error( - 'Table ', $table->name, ' has no schema object' - ); + for my $f (@fields) { + next if $table->get_field($f); + return $self->error("Constraint references non-existent field '$f' ", "in table '$table_name'"); + } - if ( $type eq FOREIGN_KEY ) { - return $self->error('Only one field allowed for foreign key') - if scalar @fields > 1; + my $schema = $table->schema + or return $self->error('Table ', $table->name, ' has no schema object'); - my $ref_table_name = $self->reference_table or - return $self->error('No reference table'); + if ($type eq FOREIGN_KEY) { + return $self->error('Only one field allowed for foreign key') + if scalar @fields > 1; - my $ref_table = $schema->get_table( $ref_table_name ) or - return $self->error("No table named '$ref_table_name' in schema"); + my $ref_table_name = $self->reference_table + or return $self->error('No reference table'); - my @ref_fields = $self->reference_fields or return; + my $ref_table = $schema->get_table($ref_table_name) + or return $self->error("No table named '$ref_table_name' in schema"); - return $self->error('Only one field allowed for foreign key reference') - if scalar @ref_fields > 1; + my @ref_fields = $self->reference_fields or return; - for my $ref_field ( @ref_fields ) { - next if $ref_table->get_field( $ref_field ); - return $self->error( - "Constraint from field(s) ". - join(', ', map {qq['$table_name.$_']} @fields). - " to non-existent field '$ref_table_name.$ref_field'" - ); - } - } - elsif ( $type eq CHECK_C ) { - return $self->error('No expression for CHECK') unless - $self->expression; + return $self->error('Only one field allowed for foreign key reference') + if scalar @ref_fields > 1; + + for my $ref_field (@ref_fields) { + next if $ref_table->get_field($ref_field); + return $self->error("Constraint from field(s) " + . join(', ', map {qq['$table_name.$_']} @fields) + . " to non-existent field '$ref_table_name.$ref_field'"); } + } elsif ($type eq CHECK_C) { + return $self->error('No expression for CHECK') + unless $self->expression; + } - return 1; + return 1; } =head2 fields @@ -195,12 +182,13 @@ Returns undef or an empty list if the constraint has no fields set. =cut sub fields { - my $self = shift; - my $table = $self->table; - my @fields = map { $table->get_field($_) || $_ } @{$self->field_names(@_) || []}; - return wantarray ? @fields - : @fields ? \@fields - : undef; + my $self = shift; + my $table = $self->table; + my @fields = map { $table->get_field($_) || $_ } @{ $self->field_names(@_) || [] }; + return + wantarray ? @fields + : @fields ? \@fields + : undef; } =head2 field_names @@ -213,7 +201,7 @@ avoid the overload magic of the Field objects returned by the fields method. =cut -with ListAttr field_names => ( uniq => 1, undef_if_empty => 1 ); +with ListAttr field_names => (uniq => 1, undef_if_empty => 1); =head2 match_type @@ -225,12 +213,16 @@ Get or set the constraint's match_type. Only valid values are "full" =cut has match_type => ( - is => 'rw', - default => quote_sub(q{ '' }), - coerce => quote_sub(q{ lc $_[0] }), - isa => enum([qw(full partial simple)], { - msg => "Invalid match type: %s", allow_false => 1, - }), + is => 'rw', + default => quote_sub(q{ '' }), + coerce => quote_sub(q{ lc $_[0] }), + isa => enum( + [qw(full partial simple)], + { + msg => "Invalid match type: %s", + allow_false => 1, + } + ), ); around match_type => \&ex2err; @@ -243,11 +235,11 @@ Get or set the constraint's name. =cut -has name => ( is => 'rw', default => quote_sub(q{ '' }) ); +has name => (is => 'rw', default => quote_sub(q{ '' })); around name => sub { - my ($orig, $self, $arg) = @_; - $self->$orig($arg || ()); + my ($orig, $self, $arg) = @_; + $self->$orig($arg || ()); }; =head2 options @@ -270,11 +262,11 @@ Get or set the constraint's "on delete" action. =cut -has on_delete => ( is => 'rw', default => quote_sub(q{ '' }) ); +has on_delete => (is => 'rw', default => quote_sub(q{ '' })); around on_delete => sub { - my ($orig, $self, $arg) = @_; - $self->$orig($arg || ()); + my ($orig, $self, $arg) = @_; + $self->$orig($arg || ()); }; =head2 on_update @@ -285,11 +277,11 @@ Get or set the constraint's "on update" action. =cut -has on_update => ( is => 'rw', default => quote_sub(q{ '' }) ); +has on_update => (is => 'rw', default => quote_sub(q{ '' })); around on_update => sub { - my ($orig, $self, $arg) = @_; - $self->$orig($arg || ()); + my ($orig, $self, $arg) = @_; + $self->$orig($arg || ()); }; =head2 reference_fields @@ -308,30 +300,26 @@ arrayref; returns an array or array reference. =cut with ListAttr reference_fields => ( - may_throw => 1, - builder => 1, - lazy => 1, + may_throw => 1, + builder => 1, + lazy => 1, ); sub _build_reference_fields { - my ($self) = @_; - - my $table = $self->table or throw('No table'); - my $schema = $table->schema or throw('No schema'); - if ( my $ref_table_name = $self->reference_table ) { - my $ref_table = $schema->get_table( $ref_table_name ) or - throw("Can't find table '$ref_table_name'"); - - if ( my $constraint = $ref_table->primary_key ) { - return [ $constraint->fields ]; - } - else { - throw( - 'No reference fields defined and cannot find primary key in ', - "reference table '$ref_table_name'" - ); - } + my ($self) = @_; + + my $table = $self->table or throw('No table'); + my $schema = $table->schema or throw('No schema'); + if (my $ref_table_name = $self->reference_table) { + my $ref_table = $schema->get_table($ref_table_name) + or throw("Can't find table '$ref_table_name'"); + + if (my $constraint = $ref_table->primary_key) { + return [ $constraint->fields ]; + } else { + throw('No reference fields defined and cannot find primary key in ', "reference table '$ref_table_name'"); } + } } =head2 reference_table @@ -342,7 +330,7 @@ Get or set the table referred to by the constraint. =cut -has reference_table => ( is => 'rw', default => quote_sub(q{ '' }) ); +has reference_table => (is => 'rw', default => quote_sub(q{ '' })); =head2 table @@ -352,7 +340,7 @@ Get or set the constraint's table object. =cut -has table => ( is => 'rw', isa => schema_obj('Table'), weak_ref => 1 ); +has table => (is => 'rw', isa => schema_obj('Table'), weak_ref => 1); around table => \&ex2err; @@ -365,12 +353,16 @@ Get or set the constraint's type. =cut has type => ( - is => 'rw', - default => quote_sub(q{ '' }), - coerce => quote_sub(q{ (my $t = $_[0]) =~ s/_/ /g; uc $t }), - isa => enum([keys %VALID_CONSTRAINT_TYPE], { - msg => "Invalid constraint type: %s", allow_false => 1, - }), + is => 'rw', + default => quote_sub(q{ '' }), + coerce => quote_sub(q{ (my $t = $_[0]) =~ s/_/ /g; uc $t }), + isa => enum( + [ keys %VALID_CONSTRAINT_TYPE ], + { + msg => "Invalid constraint type: %s", + allow_false => 1, + } + ), ); around type => \&ex2err; @@ -384,58 +376,71 @@ Determines if this constraint is the same as another =cut around equals => sub { - my $orig = shift; - my $self = shift; - my $other = shift; - my $case_insensitive = shift; - my $ignore_constraint_names = shift; - - return 0 unless $self->$orig($other); - return 0 unless $self->type eq $other->type; - unless ($ignore_constraint_names) { - return 0 unless $case_insensitive ? uc($self->name) eq uc($other->name) : $self->name eq $other->name; - } - return 0 unless $self->deferrable eq $other->deferrable; - #return 0 unless $self->is_valid eq $other->is_valid; - return 0 unless $case_insensitive ? uc($self->table->name) eq uc($other->table->name) + my $orig = shift; + my $self = shift; + my $other = shift; + my $case_insensitive = shift; + my $ignore_constraint_names = shift; + + return 0 unless $self->$orig($other); + return 0 unless $self->type eq $other->type; + unless ($ignore_constraint_names) { + return 0 + unless $case_insensitive + ? uc($self->name) eq uc($other->name) + : $self->name eq $other->name; + } + return 0 unless $self->deferrable eq $other->deferrable; + + #return 0 unless $self->is_valid eq $other->is_valid; + return 0 + unless $case_insensitive + ? uc($self->table->name) eq uc($other->table->name) : $self->table->name eq $other->table->name; - return 0 unless $self->expression eq $other->expression; - - # Check fields, regardless of order - my %otherFields = (); # create a hash of the other fields - foreach my $otherField ($other->fields) { - $otherField = uc($otherField) if $case_insensitive; - $otherFields{$otherField} = 1; - } - foreach my $selfField ($self->fields) { # check for self fields in hash - $selfField = uc($selfField) if $case_insensitive; - return 0 unless $otherFields{$selfField}; - delete $otherFields{$selfField}; - } - # Check all other fields were accounted for - return 0 unless keys %otherFields == 0; - - # Check reference fields, regardless of order - my %otherRefFields = (); # create a hash of the other reference fields - foreach my $otherRefField ($other->reference_fields) { - $otherRefField = uc($otherRefField) if $case_insensitive; - $otherRefFields{$otherRefField} = 1; - } - foreach my $selfRefField ($self->reference_fields) { # check for self reference fields in hash - $selfRefField = uc($selfRefField) if $case_insensitive; - return 0 unless $otherRefFields{$selfRefField}; - delete $otherRefFields{$selfRefField}; - } - # Check all other reference fields were accounted for - return 0 unless keys %otherRefFields == 0; - - return 0 unless $case_insensitive ? uc($self->reference_table) eq uc($other->reference_table) : $self->reference_table eq $other->reference_table; - return 0 unless $self->match_type eq $other->match_type; - return 0 unless $self->on_delete eq $other->on_delete; - return 0 unless $self->on_update eq $other->on_update; - return 0 unless $self->_compare_objects(scalar $self->options, scalar $other->options); - return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); - return 1; + return 0 unless $self->expression eq $other->expression; + + # Check fields, regardless of order + my %otherFields = (); # create a hash of the other fields + foreach my $otherField ($other->fields) { + $otherField = uc($otherField) if $case_insensitive; + $otherFields{$otherField} = 1; + } + foreach my $selfField ($self->fields) { # check for self fields in hash + $selfField = uc($selfField) if $case_insensitive; + return 0 unless $otherFields{$selfField}; + delete $otherFields{$selfField}; + } + + # Check all other fields were accounted for + return 0 unless keys %otherFields == 0; + + # Check reference fields, regardless of order + my %otherRefFields = (); # create a hash of the other reference fields + foreach my $otherRefField ($other->reference_fields) { + $otherRefField = uc($otherRefField) if $case_insensitive; + $otherRefFields{$otherRefField} = 1; + } + foreach my $selfRefField ($self->reference_fields) { # check for self reference fields in hash + $selfRefField = uc($selfRefField) if $case_insensitive; + return 0 unless $otherRefFields{$selfRefField}; + delete $otherRefFields{$selfRefField}; + } + + # Check all other reference fields were accounted for + return 0 unless keys %otherRefFields == 0; + + return 0 + unless $case_insensitive + ? uc($self->reference_table) eq uc($other->reference_table) + : $self->reference_table eq $other->reference_table; + return 0 unless $self->match_type eq $other->match_type; + return 0 unless $self->on_delete eq $other->on_delete; + return 0 unless $self->on_update eq $other->on_update; + return 0 + unless $self->_compare_objects(scalar $self->options, scalar $other->options); + return 0 + unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); + return 1; }; # Must come after all 'has' declarations diff --git a/lib/SQL/Translator/Schema/Field.pm b/lib/SQL/Translator/Schema/Field.pm index d4a95f82c..71a6e1b97 100644 --- a/lib/SQL/Translator/Schema/Field.pm +++ b/lib/SQL/Translator/Schema/Field.pm @@ -26,8 +26,8 @@ use Moo; use SQL::Translator::Schema::Constants; use SQL::Translator::Types qw(schema_obj); use SQL::Translator::Utils qw(parse_list_arg ex2err throw carp_ro); -use Sub::Quote qw(quote_sub); -use Scalar::Util (); +use Sub::Quote qw(quote_sub); +use Scalar::Util (); extends 'SQL::Translator::Schema::Object'; @@ -40,7 +40,7 @@ use overload '""' => sub { shift->name }, 'bool' => sub { $_[0]->name || $_[0] }, fallback => 1, -; + ; use DBI qw(:sql_types); @@ -49,45 +49,45 @@ our %type_mapping = ( integer => SQL_INTEGER, int => SQL_INTEGER, - tinyint => SQL_TINYINT, + tinyint => SQL_TINYINT, smallint => SQL_SMALLINT, - bigint => SQL_BIGINT, + bigint => SQL_BIGINT, - double => SQL_DOUBLE, + double => SQL_DOUBLE, 'double precision' => SQL_DOUBLE, decimal => SQL_DECIMAL, - dec => SQL_DECIMAL, + dec => SQL_DECIMAL, numeric => SQL_NUMERIC, - real => SQL_REAL, + real => SQL_REAL, float => SQL_FLOAT, bit => SQL_BIT, - date => SQL_DATE, - datetime => SQL_DATETIME, + date => SQL_DATE, + datetime => SQL_DATETIME, timestamp => SQL_TIMESTAMP, - time => SQL_TIME, + time => SQL_TIME, - char => SQL_CHAR, - varchar => SQL_VARCHAR, - binary => SQL_BINARY, + char => SQL_CHAR, + varchar => SQL_VARCHAR, + binary => SQL_BINARY, varbinary => SQL_VARBINARY, - tinyblob => SQL_BLOB, - blob => SQL_BLOB, - text => SQL_LONGVARCHAR + tinyblob => SQL_BLOB, + blob => SQL_BLOB, + text => SQL_LONGVARCHAR ); -has _numeric_sql_data_types => ( is => 'lazy' ); +has _numeric_sql_data_types => (is => 'lazy'); sub _build__numeric_sql_data_types { - return { - map { $_ => 1 } - (SQL_INTEGER, SQL_TINYINT, SQL_SMALLINT, SQL_BIGINT, SQL_DOUBLE, - SQL_NUMERIC, SQL_DECIMAL, SQL_FLOAT, SQL_REAL) - }; + return { + map { $_ => 1 } ( + SQL_INTEGER, SQL_TINYINT, SQL_SMALLINT, SQL_BIGINT, SQL_DOUBLE, SQL_NUMERIC, SQL_DECIMAL, SQL_FLOAT, SQL_REAL + ) + }; } =head2 new @@ -113,26 +113,25 @@ all the comments joined on newlines. =cut has comments => ( - is => 'rw', - coerce => quote_sub(q{ ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }), - default => quote_sub(q{ [] }), + is => 'rw', + coerce => quote_sub(q{ ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }), + default => quote_sub(q{ [] }), ); around comments => sub { - my $orig = shift; - my $self = shift; + my $orig = shift; + my $self = shift; - for my $arg ( @_ ) { - $arg = $arg->[0] if ref $arg; - push @{ $self->$orig }, $arg if $arg; - } + for my $arg (@_) { + $arg = $arg->[0] if ref $arg; + push @{ $self->$orig }, $arg if $arg; + } - return wantarray - ? @{ $self->$orig } - : join( "\n", @{ $self->$orig } ); + return wantarray + ? @{ $self->$orig } + : join("\n", @{ $self->$orig }); }; - =head2 data_type Get or set the field's data type. @@ -141,7 +140,7 @@ Get or set the field's data type. =cut -has data_type => ( is => 'rw', default => quote_sub(q{ '' }) ); +has data_type => (is => 'rw', default => quote_sub(q{ '' })); =head2 sql_data_type @@ -150,10 +149,10 @@ for more details. =cut -has sql_data_type => ( is => 'rw', lazy => 1, builder => 1 ); +has sql_data_type => (is => 'rw', lazy => 1, builder => 1); sub _build_sql_data_type { - $type_mapping{lc $_[0]->data_type} || SQL_UNKNOWN_TYPE; + $type_mapping{ lc $_[0]->data_type } || SQL_UNKNOWN_TYPE; } =head2 default_value @@ -166,7 +165,7 @@ assume an error like other methods. =cut -has default_value => ( is => 'rw' ); +has default_value => (is => 'rw'); =head2 foreign_key_reference @@ -177,24 +176,23 @@ Get or set the field's foreign key reference; =cut has foreign_key_reference => ( - is => 'rw', - predicate => '_has_foreign_key_reference', - isa => schema_obj('Constraint'), - weak_ref => 1, + is => 'rw', + predicate => '_has_foreign_key_reference', + isa => schema_obj('Constraint'), + weak_ref => 1, ); around foreign_key_reference => sub { - my $orig = shift; - my $self = shift; + my $orig = shift; + my $self = shift; - if ( my $arg = shift ) { - return $self->error( - 'Foreign key reference for ', $self->name, 'already defined' - ) if $self->_has_foreign_key_reference; + if (my $arg = shift) { + return $self->error('Foreign key reference for ', $self->name, 'already defined') + if $self->_has_foreign_key_reference; - return ex2err($orig, $self, $arg); - } - $self->$orig; + return ex2err($orig, $self, $arg); + } + $self->$orig; }; =head2 is_auto_increment @@ -206,26 +204,24 @@ Get or set the field's C attribute. =cut has is_auto_increment => ( - is => 'rw', - coerce => quote_sub(q{ $_[0] ? 1 : 0 }), - builder => 1, - lazy => 1, + is => 'rw', + coerce => quote_sub(q{ $_[0] ? 1 : 0 }), + builder => 1, + lazy => 1, ); sub _build_is_auto_increment { - my ( $self ) = @_; - - if ( my $table = $self->table ) { - if ( my $schema = $table->schema ) { - if ( - $schema->database eq 'PostgreSQL' && - $self->data_type eq 'serial' - ) { - return 1; - } - } + my ($self) = @_; + + if (my $table = $self->table) { + if (my $schema = $table->schema) { + if ( $schema->database eq 'PostgreSQL' + && $self->data_type eq 'serial') { + return 1; + } } - return 0; + } + return 0; } =head2 is_foreign_key @@ -237,27 +233,27 @@ Returns whether or not the field is a foreign key. =cut has is_foreign_key => ( - is => 'rw', - coerce => quote_sub(q{ $_[0] ? 1 : 0 }), - builder => 1, - lazy => 1, + is => 'rw', + coerce => quote_sub(q{ $_[0] ? 1 : 0 }), + builder => 1, + lazy => 1, ); sub _build_is_foreign_key { - my ( $self ) = @_; - - if ( my $table = $self->table ) { - for my $c ( $table->get_constraints ) { - if ( $c->type eq FOREIGN_KEY ) { - my %fields = map { $_, 1 } $c->fields; - if ( $fields{ $self->name } ) { - $self->foreign_key_reference( $c ); - return 1; - } - } + my ($self) = @_; + + if (my $table = $self->table) { + for my $c ($table->get_constraints) { + if ($c->type eq FOREIGN_KEY) { + my %fields = map { $_, 1 } $c->fields; + if ($fields{ $self->name }) { + $self->foreign_key_reference($c); + return 1; } + } } - return 0; + } + return 0; } =head2 is_nullable @@ -278,15 +274,15 @@ foreign keys; checks) are represented as table constraints. =cut has is_nullable => ( - is => 'rw', - coerce => quote_sub(q{ $_[0] ? 1 : 0 }), - default => quote_sub(q{ 1 }), - ); + is => 'rw', + coerce => quote_sub(q{ $_[0] ? 1 : 0 }), + default => quote_sub(q{ 1 }), +); around is_nullable => sub { - my ($orig, $self, $arg) = @_; + my ($orig, $self, $arg) = @_; - $self->$orig($self->is_primary_key ? 0 : defined $arg ? $arg : ()); + $self->$orig($self->is_primary_key ? 0 : defined $arg ? $arg : ()); }; =head2 is_primary_key @@ -299,22 +295,22 @@ a table constraint (should it?). =cut has is_primary_key => ( - is => 'rw', - coerce => quote_sub(q{ $_[0] ? 1 : 0 }), - lazy => 1, - builder => 1, + is => 'rw', + coerce => quote_sub(q{ $_[0] ? 1 : 0 }), + lazy => 1, + builder => 1, ); sub _build_is_primary_key { - my ( $self ) = @_; + my ($self) = @_; - if ( my $table = $self->table ) { - if ( my $pk = $table->primary_key ) { - my %fields = map { $_, 1 } $pk->fields; - return $fields{ $self->name } || 0; - } + if (my $table = $self->table) { + if (my $pk = $table->primary_key) { + my %fields = map { $_, 1 } $pk->fields; + return $fields{ $self->name } || 0; } - return 0; + } + return 0; } =head2 is_unique @@ -325,24 +321,24 @@ Determine whether the field has a UNIQUE constraint or not. =cut -has is_unique => ( is => 'lazy', init_arg => undef ); +has is_unique => (is => 'lazy', init_arg => undef); around is_unique => carp_ro('is_unique'); sub _build_is_unique { - my ( $self ) = @_; - - if ( my $table = $self->table ) { - for my $c ( $table->get_constraints ) { - if ( $c->type eq UNIQUE ) { - my %fields = map { $_, 1 } $c->fields; - if ( $fields{ $self->name } ) { - return 1; - } - } + my ($self) = @_; + + if (my $table = $self->table) { + for my $c ($table->get_constraints) { + if ($c->type eq UNIQUE) { + my %fields = map { $_, 1 } $c->fields; + if ($fields{ $self->name }) { + return 1; } + } } - return 0; + } + return 0; } sub is_valid { @@ -357,11 +353,11 @@ Determine whether the field is valid or not. =cut - my $self = shift; - return $self->error('No name') unless $self->name; - return $self->error('No data type') unless $self->data_type; - return $self->error('No table object') unless $self->table; - return 1; + my $self = shift; + return $self->error('No name') unless $self->name; + return $self->error('No data type') unless $self->data_type; + return $self->error('No table object') unless $self->table; + return 1; } =head2 name @@ -378,20 +374,20 @@ Errors ("No field name") if you try to set a blank name. =cut -has name => ( is => 'rw', isa => sub { throw( "No field name" ) unless $_[0] } ); +has name => (is => 'rw', isa => sub { throw("No field name") unless $_[0] }); around name => sub { - my $orig = shift; - my $self = shift; + my $orig = shift; + my $self = shift; - if ( my ($arg) = @_ ) { - if ( my $schema = $self->table ) { - return $self->error( qq[Can't use field name "$arg": field exists] ) - if $schema->get_field( $arg ); - } + if (my ($arg) = @_) { + if (my $schema = $self->table) { + return $self->error(qq[Can't use field name "$arg": field exists]) + if $schema->get_field($arg); } + } - return ex2err($orig, $self, @_); + return ex2err($orig, $self, @_); }; sub full_name { @@ -403,8 +399,8 @@ e.g. "person.foo". =cut - my $self = shift; - return $self->table.".".$self->name; + my $self = shift; + return $self->table . "." . $self->name; } =head2 order @@ -415,16 +411,16 @@ Get or set the field's order. =cut -has order => ( is => 'rw', default => quote_sub(q{ 0 }) ); +has order => (is => 'rw', default => quote_sub(q{ 0 })); around order => sub { - my ( $orig, $self, $arg ) = @_; + my ($orig, $self, $arg) = @_; - if ( defined $arg && $arg =~ /^\d+$/ ) { - return $self->$orig($arg); - } + if (defined $arg && $arg =~ /^\d+$/) { + return $self->$orig($arg); + } - return $self->$orig; + return $self->$orig; }; sub schema { @@ -438,9 +434,9 @@ doesn't have one. =cut - my $self = shift; - if ( my $table = $self->table ) { return $table->schema || undef; } - return undef; + my $self = shift; + if (my $table = $self->table) { return $table->schema || undef; } + return undef; } =head2 size @@ -459,33 +455,32 @@ numbers and returns a string. =cut has size => ( - is => 'rw', - default => quote_sub(q{ [0] }), - coerce => sub { - my @sizes = grep { defined && m/^\d+(?:\.\d+)?$/ } @{parse_list_arg($_[0])}; - @sizes ? \@sizes : [0]; - }, + is => 'rw', + default => quote_sub(q{ [0] }), + coerce => sub { + my @sizes = grep { defined && m/^\d+(?:\.\d+)?$/ } @{ parse_list_arg($_[0]) }; + @sizes ? \@sizes : [0]; + }, ); around size => sub { - my $orig = shift; - my $self = shift; - my $numbers = parse_list_arg( @_ ); - - if ( @$numbers ) { - my @new; - for my $num ( @$numbers ) { - if ( defined $num && $num =~ m/^\d+(?:\.\d+)?$/ ) { - push @new, $num; - } - } - $self->$orig(\@new) if @new; # only set if all OK + my $orig = shift; + my $self = shift; + my $numbers = parse_list_arg(@_); + + if (@$numbers) { + my @new; + for my $num (@$numbers) { + if (defined $num && $num =~ m/^\d+(?:\.\d+)?$/) { + push @new, $num; + } } + $self->$orig(\@new) if @new; # only set if all OK + } - return wantarray - ? @{ $self->$orig || [0] } - : join( ',', @{ $self->$orig || [0] } ) - ; + return wantarray + ? @{ $self->$orig || [0] } + : join(',', @{ $self->$orig || [0] }); }; =head2 table @@ -498,7 +493,7 @@ also be used to get the table name. =cut -has table => ( is => 'rw', isa => schema_obj('Table'), weak_ref => 1 ); +has table => (is => 'rw', isa => schema_obj('Table'), weak_ref => 1); around table => \&ex2err; @@ -508,13 +503,13 @@ Returns the field exactly as the parser found it =cut -has parsed_field => ( is => 'rw' ); +has parsed_field => (is => 'rw'); around parsed_field => sub { - my $orig = shift; - my $self = shift; + my $orig = shift; + my $self = shift; - return $self->$orig(@_) || $self; + return $self->$orig(@_) || $self; }; =head2 equals @@ -526,64 +521,70 @@ Determines if this field is the same as another =cut around equals => sub { - my $orig = shift; - my $self = shift; - my $other = shift; - my $case_insensitive = shift; - - return 0 unless $self->$orig($other); - return 0 unless $case_insensitive ? uc($self->name) eq uc($other->name) : $self->name eq $other->name; - - # Comparing types: use sql_data_type if both are not 0. Else use string data_type - if ($self->sql_data_type && $other->sql_data_type) { - return 0 unless $self->sql_data_type == $other->sql_data_type + my $orig = shift; + my $self = shift; + my $other = shift; + my $case_insensitive = shift; + + return 0 unless $self->$orig($other); + return 0 + unless $case_insensitive + ? uc($self->name) eq uc($other->name) + : $self->name eq $other->name; + +# Comparing types: use sql_data_type if both are not 0. Else use string data_type + if ($self->sql_data_type && $other->sql_data_type) { + return 0 unless $self->sql_data_type == $other->sql_data_type; + } else { + return 0 unless lc($self->data_type) eq lc($other->data_type); + } + + return 0 unless $self->size eq $other->size; + + { + my $lhs = $self->default_value; + $lhs = \'NULL' unless defined $lhs; + my $lhs_is_ref = !!ref $lhs; + + my $rhs = $other->default_value; + $rhs = \'NULL' unless defined $rhs; + my $rhs_is_ref = !!ref $rhs; + + # If only one is a ref, fail. -- rjbs, 2008-12-02 + return 0 if $lhs_is_ref xor $rhs_is_ref; + + my $effective_lhs = $lhs_is_ref ? $$lhs : $lhs; + my $effective_rhs = $rhs_is_ref ? $$rhs : $rhs; + + if ( $self->_is_numeric_data_type + && Scalar::Util::looks_like_number($effective_lhs) + && Scalar::Util::looks_like_number($effective_rhs)) { + return 0 if ($effective_lhs + 0) != ($effective_rhs + 0); } else { - return 0 unless lc($self->data_type) eq lc($other->data_type) + return 0 if $effective_lhs ne $effective_rhs; } + } - return 0 unless $self->size eq $other->size; - - { - my $lhs = $self->default_value; - $lhs = \'NULL' unless defined $lhs; - my $lhs_is_ref = ! ! ref $lhs; - - my $rhs = $other->default_value; - $rhs = \'NULL' unless defined $rhs; - my $rhs_is_ref = ! ! ref $rhs; + return 0 unless $self->is_nullable eq $other->is_nullable; - # If only one is a ref, fail. -- rjbs, 2008-12-02 - return 0 if $lhs_is_ref xor $rhs_is_ref; + # return 0 unless $self->is_unique eq $other->is_unique; + return 0 unless $self->is_primary_key eq $other->is_primary_key; - my $effective_lhs = $lhs_is_ref ? $$lhs : $lhs; - my $effective_rhs = $rhs_is_ref ? $$rhs : $rhs; - - if ( $self->_is_numeric_data_type - && Scalar::Util::looks_like_number($effective_lhs) - && Scalar::Util::looks_like_number($effective_rhs) ) { - return 0 if ($effective_lhs + 0) != ($effective_rhs + 0); - } - else { - return 0 if $effective_lhs ne $effective_rhs; - } - } + # return 0 unless $self->is_foreign_key eq $other->is_foreign_key; + return 0 unless $self->is_auto_increment eq $other->is_auto_increment; - return 0 unless $self->is_nullable eq $other->is_nullable; -# return 0 unless $self->is_unique eq $other->is_unique; - return 0 unless $self->is_primary_key eq $other->is_primary_key; -# return 0 unless $self->is_foreign_key eq $other->is_foreign_key; - return 0 unless $self->is_auto_increment eq $other->is_auto_increment; -# return 0 unless $self->comments eq $other->comments; - return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); - return 1; + # return 0 unless $self->comments eq $other->comments; + return 0 + unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); + return 1; }; # Must come after all 'has' declarations around new => \&ex2err; sub _is_numeric_data_type { - my $self = shift; - return $self->_numeric_sql_data_types->{ $self->sql_data_type }; + my $self = shift; + return $self->_numeric_sql_data_types->{ $self->sql_data_type }; } 1; diff --git a/lib/SQL/Translator/Schema/Index.pm b/lib/SQL/Translator/Schema/Index.pm index b9ea47431..217bd0d59 100644 --- a/lib/SQL/Translator/Schema/Index.pm +++ b/lib/SQL/Translator/Schema/Index.pm @@ -31,18 +31,18 @@ use SQL::Translator::Schema::IndexField; use SQL::Translator::Utils qw(ex2err throw parse_list_arg); use SQL::Translator::Role::ListAttr; use SQL::Translator::Types qw(schema_obj enum); -use Sub::Quote qw(quote_sub); +use Sub::Quote qw(quote_sub); extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.64'; my %VALID_INDEX_TYPE = ( - UNIQUE => 1, - NORMAL => 1, - FULLTEXT => 1, # MySQL only (?) - FULL_TEXT => 1, # MySQL only (?) - SPATIAL => 1, # MySQL only (?) + UNIQUE => 1, + NORMAL => 1, + FULLTEXT => 1, # MySQL only (?) + FULL_TEXT => 1, # MySQL only (?) + SPATIAL => 1, # MySQL only (?) ); =head2 new @@ -68,15 +68,14 @@ names and keep them in order by the first occurrence of a field name. =cut - with ListAttr fields => ( coerce => sub { my %seen; return [ - grep !$seen{$_->name}++, + grep !$seen{ $_->name }++, map SQL::Translator::Schema::IndexField->new($_), - @{parse_list_arg($_[0])} - ] + @{ parse_list_arg($_[0]) } + ]; } ); @@ -92,17 +91,16 @@ Determine whether the index is valid or not. =cut - my $self = shift; - my $table = $self->table or return $self->error('No table'); - my @fields = $self->fields or return $self->error('No fields'); + my $self = shift; + my $table = $self->table or return $self->error('No table'); + my @fields = $self->fields or return $self->error('No fields'); - for my $field ( @fields ) { - return $self->error( - "Field '$field' does not exist in table '", $table->name, "'" - ) unless $table->get_field( $field ); - } + for my $field (@fields) { + return $self->error("Field '$field' does not exist in table '", $table->name, "'") + unless $table->get_field($field); + } - return 1; + return 1; } =head2 name @@ -114,9 +112,9 @@ Get or set the index's name. =cut has name => ( - is => 'rw', - coerce => quote_sub(q{ defined $_[0] ? $_[0] : '' }), - default => quote_sub(q{ '' }), + is => 'rw', + coerce => quote_sub(q{ defined $_[0] ? $_[0] : '' }), + default => quote_sub(q{ '' }), ); =head2 options @@ -138,7 +136,7 @@ Get or set the index's table object. =cut -has table => ( is => 'rw', isa => schema_obj('Table'), weak_ref => 1 ); +has table => (is => 'rw', isa => schema_obj('Table'), weak_ref => 1); around table => \&ex2err; @@ -158,12 +156,16 @@ uppercase. =cut has type => ( - is => 'rw', - coerce => quote_sub(q{ uc $_[0] }), - default => quote_sub(q{ 'NORMAL' }), - isa => enum([keys %VALID_INDEX_TYPE], { - msg => "Invalid index type: %s", allow_false => 1, - }), + is => 'rw', + coerce => quote_sub(q{ uc $_[0] }), + default => quote_sub(q{ 'NORMAL' }), + isa => enum( + [ keys %VALID_INDEX_TYPE ], + { + msg => "Invalid index type: %s", + allow_false => 1, + } + ), ); around type => \&ex2err; @@ -177,36 +179,45 @@ Determines if this index is the same as another =cut around equals => sub { - my $orig = shift; - my $self = shift; - my $other = shift; - my $case_insensitive = shift; - my $ignore_index_names = shift; - - return 0 unless $self->$orig($other); - - unless ($ignore_index_names) { - unless ((!$self->name && ($other->name eq $other->fields->[0]->name)) || - (!$other->name && ($self->name eq $self->fields->[0]->name))) { - return 0 unless $case_insensitive ? uc($self->name) eq uc($other->name) : $self->name eq $other->name; - } - } - #return 0 unless $self->is_valid eq $other->is_valid; - return 0 unless $self->type eq $other->type; - - # Check fields, regardless of order - my $get_name = sub { return $case_insensitive ? uc(shift->name) : shift->name; }; - my @otherFields = sort { $a->{key} cmp $b->{key} } map +{ item => $_, key => $get_name->($_) }, $other->fields; - my @selfFields = sort { $a->{key} cmp $b->{key} } map +{ item => $_, key => $get_name->($_) }, $self->fields; - return 0 unless @otherFields == @selfFields; - for my $idx (0..$#selfFields) { - return 0 unless $selfFields[$idx]{key} eq $otherFields[$idx]{key}; - return 0 unless $self->_compare_objects(scalar $selfFields[$idx]{item}->extra, scalar $otherFields[$idx]{item}->extra); + my $orig = shift; + my $self = shift; + my $other = shift; + my $case_insensitive = shift; + my $ignore_index_names = shift; + + return 0 unless $self->$orig($other); + + unless ($ignore_index_names) { + unless ((!$self->name && ($other->name eq $other->fields->[0]->name)) + || (!$other->name && ($self->name eq $self->fields->[0]->name))) { + return 0 + unless $case_insensitive + ? uc($self->name) eq uc($other->name) + : $self->name eq $other->name; } + } + + #return 0 unless $self->is_valid eq $other->is_valid; + return 0 unless $self->type eq $other->type; + + # Check fields, regardless of order + my $get_name = sub { return $case_insensitive ? uc(shift->name) : shift->name; }; + my @otherFields = sort { $a->{key} cmp $b->{key} } + map +{ item => $_, key => $get_name->($_) }, $other->fields; + my @selfFields = sort { $a->{key} cmp $b->{key} } + map +{ item => $_, key => $get_name->($_) }, $self->fields; + return 0 unless @otherFields == @selfFields; + for my $idx (0 .. $#selfFields) { + return 0 unless $selfFields[$idx]{key} eq $otherFields[$idx]{key}; + return 0 + unless $self->_compare_objects(scalar $selfFields[$idx]{item}->extra, scalar $otherFields[$idx]{item}->extra); + } - return 0 unless $self->_compare_objects(scalar $self->options, scalar $other->options); - return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); - return 1; + return 0 + unless $self->_compare_objects(scalar $self->options, scalar $other->options); + return 0 + unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); + return 1; }; # Must come after all 'has' declarations diff --git a/lib/SQL/Translator/Schema/IndexField.pm b/lib/SQL/Translator/Schema/IndexField.pm index acad6c3f2..a083d4a36 100644 --- a/lib/SQL/Translator/Schema/IndexField.pm +++ b/lib/SQL/Translator/Schema/IndexField.pm @@ -15,6 +15,7 @@ Different databases allow for different options on index fields. Those are suppo =head1 METHODS =cut + use Moo; extends 'SQL::Translator::Schema::Object'; @@ -54,30 +55,28 @@ around BUILDARGS => sub { if (@args == 1 && !ref $args[0]) { @args = (name => $args[0]); } - # there are some weird pathological cases where we get an object passed in rather than a - # hashref. We'll just clone it + +# there are some weird pathological cases where we get an object passed in rather than a +# hashref. We'll just clone it if (ref $args[0] eq $self) { - return { %{$args[0]} } + return { %{ $args[0] } }; } - my $args = $self->$orig(@args); + my $args = $self->$orig(@args); my $extra = delete $args->{extra} || {}; - my $name = delete $args->{name}; + my $name = delete $args->{name}; return { - name => $name, - extra => { - %$extra, - %$args - } - } + name => $name, + extra => { %$extra, %$args } + }; }; has name => ( - is => 'rw', + is => 'rw', required => 1, ); has extra => ( - is => 'rw', + is => 'rw', default => sub { {} }, ); diff --git a/lib/SQL/Translator/Schema/Procedure.pm b/lib/SQL/Translator/Schema/Procedure.pm index 2f5b4802a..1ac353292 100644 --- a/lib/SQL/Translator/Schema/Procedure.pm +++ b/lib/SQL/Translator/Schema/Procedure.pm @@ -31,7 +31,7 @@ use Moo; use SQL::Translator::Utils qw(ex2err); use SQL::Translator::Role::ListAttr; use SQL::Translator::Types qw(schema_obj); -use Sub::Quote qw(quote_sub); +use Sub::Quote qw(quote_sub); extends 'SQL::Translator::Schema::Object'; @@ -59,7 +59,7 @@ Gets and set the parameters of the stored procedure. =cut -with ListAttr parameters => ( uniq => 1 ); +with ListAttr parameters => (uniq => 1); =head2 name @@ -70,7 +70,7 @@ Get or set the procedure's name. =cut -has name => ( is => 'rw', default => quote_sub(q{ '' }) ); +has name => (is => 'rw', default => quote_sub(q{ '' })); =head2 sql @@ -81,7 +81,7 @@ Get or set the procedure's SQL. =cut -has sql => ( is => 'rw', default => quote_sub(q{ '' }) ); +has sql => (is => 'rw', default => quote_sub(q{ '' })); =head2 order @@ -92,8 +92,7 @@ Get or set the order of the procedure. =cut -has order => ( is => 'rw' ); - +has order => (is => 'rw'); =head2 owner @@ -104,7 +103,7 @@ Get or set the owner of the procedure. =cut -has owner => ( is => 'rw', default => quote_sub(q{ '' }) ); +has owner => (is => 'rw', default => quote_sub(q{ '' })); =head2 comments @@ -117,22 +116,22 @@ Get or set the comments on a procedure. =cut has comments => ( - is => 'rw', - coerce => quote_sub(q{ ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }), - default => quote_sub(q{ [] }), + is => 'rw', + coerce => quote_sub(q{ ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }), + default => quote_sub(q{ [] }), ); around comments => sub { - my $orig = shift; - my $self = shift; - my @comments = ref $_[0] ? @{ $_[0] } : @_; + my $orig = shift; + my $self = shift; + my @comments = ref $_[0] ? @{ $_[0] } : @_; - for my $arg ( @comments ) { - $arg = $arg->[0] if ref $arg; - push @{ $self->$orig }, $arg if defined $arg && $arg; - } + for my $arg (@comments) { + $arg = $arg->[0] if ref $arg; + push @{ $self->$orig }, $arg if defined $arg && $arg; + } - return wantarray ? @{ $self->$orig } : join( "\n", @{ $self->$orig } ); + return wantarray ? @{ $self->$orig } : join("\n", @{ $self->$orig }); }; =head2 schema @@ -144,7 +143,7 @@ Get or set the procedures's schema object. =cut -has schema => ( is => 'rw', isa => schema_obj('Schema'), weak_ref => 1 ); +has schema => (is => 'rw', isa => schema_obj('Schema'), weak_ref => 1); around schema => \&ex2err; @@ -157,32 +156,40 @@ Determines if this procedure is the same as another =cut around equals => sub { - my $orig = shift; - my $self = shift; - my $other = shift; - my $case_insensitive = shift; - my $ignore_sql = shift; - - return 0 unless $self->$orig($other); - return 0 unless $case_insensitive ? uc($self->name) eq uc($other->name) : $self->name eq $other->name; - - unless ($ignore_sql) { - my $selfSql = $self->sql; - my $otherSql = $other->sql; - # Remove comments - $selfSql =~ s/--.*$//mg; - $otherSql =~ s/--.*$//mg; - # Collapse whitespace to space to avoid whitespace comparison issues - $selfSql =~ s/\s+/ /sg; - $otherSql =~ s/\s+/ /sg; - return 0 unless $selfSql eq $otherSql; - } - - return 0 unless $self->_compare_objects(scalar $self->parameters, scalar $other->parameters); + my $orig = shift; + my $self = shift; + my $other = shift; + my $case_insensitive = shift; + my $ignore_sql = shift; + + return 0 unless $self->$orig($other); + return 0 + unless $case_insensitive + ? uc($self->name) eq uc($other->name) + : $self->name eq $other->name; + + unless ($ignore_sql) { + my $selfSql = $self->sql; + my $otherSql = $other->sql; + + # Remove comments + $selfSql =~ s/--.*$//mg; + $otherSql =~ s/--.*$//mg; + + # Collapse whitespace to space to avoid whitespace comparison issues + $selfSql =~ s/\s+/ /sg; + $otherSql =~ s/\s+/ /sg; + return 0 unless $selfSql eq $otherSql; + } + + return 0 + unless $self->_compare_objects(scalar $self->parameters, scalar $other->parameters); + # return 0 unless $self->comments eq $other->comments; # return 0 unless $case_insensitive ? uc($self->owner) eq uc($other->owner) : $self->owner eq $other->owner; - return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); - return 1; + return 0 + unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); + return 1; }; # Must come after all 'has' declarations diff --git a/lib/SQL/Translator/Schema/Role/Compare.pm b/lib/SQL/Translator/Schema/Role/Compare.pm index 6e5a363c6..591d0df94 100644 --- a/lib/SQL/Translator/Schema/Role/Compare.pm +++ b/lib/SQL/Translator/Schema/Role/Compare.pm @@ -32,32 +32,32 @@ Determines if this object is the same as another. =cut sub equals { - my $self = shift; - my $other = shift; + my $self = shift; + my $other = shift; - return 0 unless $other; - return 1 if overload::StrVal($self) eq overload::StrVal($other); - return 0 unless $other->isa( ref($self) ); - return 1; + return 0 unless $other; + return 1 if overload::StrVal($self) eq overload::StrVal($other); + return 0 unless $other->isa(ref($self)); + return 1; } sub _compare_objects { -# my ($self, $obj1, $obj2) = @_; - - my $result = ( - Data::Dumper->new([$_[1]])->Terse(1)->Indent(0)->Deparse(1)->Sortkeys(1)->Maxdepth(0)->Dump - eq - Data::Dumper->new([$_[2]])->Terse(1)->Indent(0)->Deparse(1)->Sortkeys(1)->Maxdepth(0)->Dump - ); -# if ( !$result ) { -# use Carp qw(cluck); -# cluck("How did I get here?"); -# use Data::Dumper; -# $Data::Dumper::Maxdepth = 1; -# print "obj1: ", Dumper($obj1), "\n"; -# print "obj2: ", Dumper($obj2), "\n"; -# } - return $result; + + # my ($self, $obj1, $obj2) = @_; + + my $result = (Data::Dumper->new([ $_[1] ])->Terse(1)->Indent(0)->Deparse(1) + ->Sortkeys(1)->Maxdepth(0)->Dump eq Data::Dumper->new([ $_[2] ])->Terse(1)->Indent(0)->Deparse(1) + ->Sortkeys(1)->Maxdepth(0)->Dump); + + # if ( !$result ) { + # use Carp qw(cluck); + # cluck("How did I get here?"); + # use Data::Dumper; + # $Data::Dumper::Maxdepth = 1; + # print "obj1: ", Dumper($obj1), "\n"; + # print "obj2: ", Dumper($obj2), "\n"; + # } + return $result; } 1; diff --git a/lib/SQL/Translator/Schema/Role/Extra.pm b/lib/SQL/Translator/Schema/Role/Extra.pm index ff46785dd..b732f3c30 100644 --- a/lib/SQL/Translator/Schema/Role/Extra.pm +++ b/lib/SQL/Translator/Schema/Role/Extra.pm @@ -20,7 +20,6 @@ for schema objects. use Moo::Role; use Sub::Quote qw(quote_sub); - =head1 METHODS =head2 extra @@ -40,25 +39,24 @@ Returns a hash or a hashref. =cut -has extra => ( is => 'rwp', default => quote_sub(q{ +{} }) ); +has extra => (is => 'rwp', default => quote_sub(q{ +{} })); around extra => sub { - my ($orig, $self) = (shift, shift); + my ($orig, $self) = (shift, shift); - @_ = %{$_[0]} if ref $_[0] eq "HASH"; - my $extra = $self->$orig; + @_ = %{ $_[0] } if ref $_[0] eq "HASH"; + my $extra = $self->$orig; - if (@_==1) { - return $extra->{$_[0]}; - } - elsif (@_) { - my %args = @_; - while ( my ( $key, $value ) = each %args ) { - $extra->{$key} = $value; - } + if (@_ == 1) { + return $extra->{ $_[0] }; + } elsif (@_) { + my %args = @_; + while (my ($key, $value) = each %args) { + $extra->{$key} = $value; } + } - return wantarray ? %$extra : $extra; + return wantarray ? %$extra : $extra; }; =head2 remove_extra @@ -77,13 +75,12 @@ certain extra attributes only. =cut sub remove_extra { - my ( $self, @keys ) = @_; - unless (@keys) { - $self->_set_extra({}); - } - else { - delete @{$self->extra}{@keys}; - } + my ($self, @keys) = @_; + unless (@keys) { + $self->_set_extra({}); + } else { + delete @{ $self->extra }{@keys}; + } } 1; diff --git a/lib/SQL/Translator/Schema/Table.pm b/lib/SQL/Translator/Schema/Table.pm index 1d0e4b904..fb18255f0 100644 --- a/lib/SQL/Translator/Schema/Table.pm +++ b/lib/SQL/Translator/Schema/Table.pm @@ -43,7 +43,7 @@ use overload '""' => sub { shift->name }, 'bool' => sub { $_[0]->name || $_[0] }, fallback => 1, -; + ; =pod @@ -73,77 +73,75 @@ C object. =cut has _constraints => ( - is => 'ro', - init_arg => undef, - default => quote_sub(q{ +[] }), - predicate => 1, - lazy => 1, + is => 'ro', + init_arg => undef, + default => quote_sub(q{ +[] }), + predicate => 1, + lazy => 1, ); sub add_constraint { - my $self = shift; - my $constraint_class = 'SQL::Translator::Schema::Constraint'; - my $constraint; - - if ( UNIVERSAL::isa( $_[0], $constraint_class ) ) { - $constraint = shift; - $constraint->table( $self ); - } - else { - my %args = @_; - $args{'table'} = $self; - $constraint = $constraint_class->new( \%args ) or - return $self->error( $constraint_class->error ); - } - - # - # If we're trying to add a PK when one is already defined, - # then just add the fields to the existing definition. - # - my $ok = 1; - my $pk = $self->primary_key; - if ( $pk && $constraint->type eq PRIMARY_KEY ) { - $self->primary_key( $constraint->fields ); - $pk->name($constraint->name) if $constraint->name; - my %extra = $constraint->extra; - $pk->extra(%extra) if keys %extra; - $constraint = $pk; - $ok = 0; - } - elsif ( $constraint->type eq PRIMARY_KEY ) { - for my $fname ( $constraint->fields ) { - if ( my $f = $self->get_field( $fname ) ) { - $f->is_primary_key( 1 ); - } - } - } - # - # See if another constraint of the same type - # covers the same fields. -- This doesn't work! ky - # -# elsif ( $constraint->type ne CHECK_C ) { -# my @field_names = $constraint->fields; -# for my $c ( -# grep { $_->type eq $constraint->type } -# $self->get_constraints -# ) { -# my %fields = map { $_, 1 } $c->fields; -# for my $field_name ( @field_names ) { -# if ( $fields{ $field_name } ) { -# $constraint = $c; -# $ok = 0; -# last; -# } -# } -# last unless $ok; -# } -# } - - if ( $ok ) { - push @{ $self->_constraints }, $constraint; + my $self = shift; + my $constraint_class = 'SQL::Translator::Schema::Constraint'; + my $constraint; + + if (UNIVERSAL::isa($_[0], $constraint_class)) { + $constraint = shift; + $constraint->table($self); + } else { + my %args = @_; + $args{'table'} = $self; + $constraint = $constraint_class->new(\%args) + or return $self->error($constraint_class->error); + } + + # + # If we're trying to add a PK when one is already defined, + # then just add the fields to the existing definition. + # + my $ok = 1; + my $pk = $self->primary_key; + if ($pk && $constraint->type eq PRIMARY_KEY) { + $self->primary_key($constraint->fields); + $pk->name($constraint->name) if $constraint->name; + my %extra = $constraint->extra; + $pk->extra(%extra) if keys %extra; + $constraint = $pk; + $ok = 0; + } elsif ($constraint->type eq PRIMARY_KEY) { + for my $fname ($constraint->fields) { + if (my $f = $self->get_field($fname)) { + $f->is_primary_key(1); + } } - - return $constraint; + } + # + # See if another constraint of the same type + # covers the same fields. -- This doesn't work! ky + # + # elsif ( $constraint->type ne CHECK_C ) { + # my @field_names = $constraint->fields; + # for my $c ( + # grep { $_->type eq $constraint->type } + # $self->get_constraints + # ) { + # my %fields = map { $_, 1 } $c->fields; + # for my $field_name ( @field_names ) { + # if ( $fields{ $field_name } ) { + # $constraint = $c; + # $ok = 0; + # last; + # } + # } + # last unless $ok; + # } + # } + + if ($ok) { + push @{ $self->_constraints }, $constraint; + } + + return $constraint; } =head2 drop_constraint @@ -157,26 +155,26 @@ an index name or an C object. =cut sub drop_constraint { - my $self = shift; - my $constraint_class = 'SQL::Translator::Schema::Constraint'; - my $constraint_name; - - if ( UNIVERSAL::isa( $_[0], $constraint_class ) ) { - $constraint_name = shift->name; - } - else { - $constraint_name = shift; - } - - if ( ! ($self->_has_constraints && grep { $_->name eq $constraint_name } @ { $self->_constraints }) ) { - return $self->error(qq[Can't drop constraint: "$constraint_name" doesn't exist]); - } - - my @cs = @{ $self->_constraints }; - my ($constraint_id) = grep { $cs[$_]->name eq $constraint_name } (0..$#cs); - my $constraint = splice(@{$self->_constraints}, $constraint_id, 1); - - return $constraint; + my $self = shift; + my $constraint_class = 'SQL::Translator::Schema::Constraint'; + my $constraint_name; + + if (UNIVERSAL::isa($_[0], $constraint_class)) { + $constraint_name = shift->name; + } else { + $constraint_name = shift; + } + + if (!($self->_has_constraints && grep { $_->name eq $constraint_name } @{ $self->_constraints })) { + return $self->error(qq[Can't drop constraint: "$constraint_name" doesn't exist]); + } + + my @cs = @{ $self->_constraints }; + my ($constraint_id) + = grep { $cs[$_]->name eq $constraint_name } (0 .. $#cs); + my $constraint = splice(@{ $self->_constraints }, $constraint_id, 1); + + return $constraint; } =head2 add_index @@ -196,33 +194,32 @@ C object. =cut has _indices => ( - is => 'ro', - init_arg => undef, - default => quote_sub(q{ [] }), - predicate => 1, - lazy => 1, + is => 'ro', + init_arg => undef, + default => quote_sub(q{ [] }), + predicate => 1, + lazy => 1, ); sub add_index { - my $self = shift; - my $index_class = 'SQL::Translator::Schema::Index'; - my $index; - - if ( UNIVERSAL::isa( $_[0], $index_class ) ) { - $index = shift; - $index->table( $self ); - } - else { - my %args = @_; - $args{'table'} = $self; - $index = $index_class->new( \%args ) or return - $self->error( $index_class->error ); - } - foreach my $ex_index ($self->get_indices) { - return if ($ex_index->equals($index)); - } - push @{ $self->_indices }, $index; - return $index; + my $self = shift; + my $index_class = 'SQL::Translator::Schema::Index'; + my $index; + + if (UNIVERSAL::isa($_[0], $index_class)) { + $index = shift; + $index->table($self); + } else { + my %args = @_; + $args{'table'} = $self; + $index = $index_class->new(\%args) + or return $self->error($index_class->error); + } + foreach my $ex_index ($self->get_indices) { + return if ($ex_index->equals($index)); + } + push @{ $self->_indices }, $index; + return $index; } =head2 drop_index @@ -236,26 +233,25 @@ an index name of an C object. =cut sub drop_index { - my $self = shift; - my $index_class = 'SQL::Translator::Schema::Index'; - my $index_name; + my $self = shift; + my $index_class = 'SQL::Translator::Schema::Index'; + my $index_name; - if ( UNIVERSAL::isa( $_[0], $index_class ) ) { - $index_name = shift->name; - } - else { - $index_name = shift; - } + if (UNIVERSAL::isa($_[0], $index_class)) { + $index_name = shift->name; + } else { + $index_name = shift; + } - if ( ! ($self->_has_indices && grep { $_->name eq $index_name } @{ $self->_indices }) ) { - return $self->error(qq[Can't drop index: "$index_name" doesn't exist]); - } + if (!($self->_has_indices && grep { $_->name eq $index_name } @{ $self->_indices })) { + return $self->error(qq[Can't drop index: "$index_name" doesn't exist]); + } - my @is = @{ $self->_indices }; - my ($index_id) = grep { $is[$_]->name eq $index_name } (0..$#is); - my $index = splice(@{$self->_indices}, $index_id, 1); + my @is = @{ $self->_indices }; + my ($index_id) = grep { $is[$_]->name eq $index_name } (0 .. $#is); + my $index = splice(@{ $self->_indices }, $index_id, 1); - return $index; + return $index; } =head2 add_field @@ -280,65 +276,62 @@ existing field, you will get an error and the field will not be created. =cut has _fields => ( - is => 'ro', - init_arg => undef, - default => quote_sub(q{ +{} }), - predicate => 1, - lazy => 1 + is => 'ro', + init_arg => undef, + default => quote_sub(q{ +{} }), + predicate => 1, + lazy => 1 ); sub add_field { - my $self = shift; - my $field_class = 'SQL::Translator::Schema::Field'; - my $field; - - if ( UNIVERSAL::isa( $_[0], $field_class ) ) { - $field = shift; - $field->table( $self ); - } - else { - my %args = @_; - $args{'table'} = $self; - $field = $field_class->new( \%args ) or return - $self->error( $field_class->error ); - } - - my $existing_order = { map { $_->order => $_->name } $self->get_fields }; - - # supplied order, possible unordered assembly - if ( $field->order ) { - if($existing_order->{$field->order}) { - croak sprintf - "Requested order '%d' for column '%s' conflicts with already existing column '%s'", - $field->order, - $field->name, - $existing_order->{$field->order}, - ; - } - } - else { - my $last_field_no = max(keys %$existing_order) || 0; - if ( $last_field_no != scalar keys %$existing_order ) { - croak sprintf - "Table '%s' field order incomplete - unable to auto-determine order for newly added field", - $self->name, - ; - } - - $field->order( $last_field_no + 1 ); - } - - # We know we have a name as the Field->new above errors if none given. - my $field_name = $field->name; - - if ( $self->get_field($field_name) ) { - return $self->error(qq[Can't use field name "$field_name": field exists]); - } - else { - $self->_fields->{ $field_name } = $field; - } - - return $field; + my $self = shift; + my $field_class = 'SQL::Translator::Schema::Field'; + my $field; + + if (UNIVERSAL::isa($_[0], $field_class)) { + $field = shift; + $field->table($self); + } else { + my %args = @_; + $args{'table'} = $self; + $field = $field_class->new(\%args) + or return $self->error($field_class->error); + } + + my $existing_order = { map { $_->order => $_->name } $self->get_fields }; + + # supplied order, possible unordered assembly + if ($field->order) { + if ($existing_order->{ $field->order }) { + croak sprintf + "Requested order '%d' for column '%s' conflicts with already existing column '%s'", + $field->order, + $field->name, + $existing_order->{ $field->order }, + ; + } + } else { + my $last_field_no = max(keys %$existing_order) || 0; + if ($last_field_no != scalar keys %$existing_order) { + croak sprintf + "Table '%s' field order incomplete - unable to auto-determine order for newly added field", + $self->name, + ; + } + + $field->order($last_field_no + 1); + } + + # We know we have a name as the Field->new above errors if none given. + my $field_name = $field->name; + + if ($self->get_field($field_name)) { + return $self->error(qq[Can't use field name "$field_name": field exists]); + } else { + $self->_fields->{$field_name} = $field; + } + + return $field; } =head2 drop_field @@ -352,42 +345,42 @@ a field name or an C object. =cut sub drop_field { - my $self = shift; - my $field_class = 'SQL::Translator::Schema::Field'; - my $field_name; + my $self = shift; + my $field_class = 'SQL::Translator::Schema::Field'; + my $field_name; - if ( UNIVERSAL::isa( $_[0], $field_class ) ) { - $field_name = shift->name; - } - else { - $field_name = shift; - } - my %args = @_; - my $cascade = $args{'cascade'}; + if (UNIVERSAL::isa($_[0], $field_class)) { + $field_name = shift->name; + } else { + $field_name = shift; + } + my %args = @_; + my $cascade = $args{'cascade'}; - if ( ! ($self->_has_fields && exists $self->_fields->{ $field_name } ) ) { - return $self->error(qq[Can't drop field: "$field_name" doesn't exists]); + if (!($self->_has_fields && exists $self->_fields->{$field_name})) { + return $self->error(qq[Can't drop field: "$field_name" doesn't exists]); + } + + my $field = delete $self->_fields->{$field_name}; + + if ($cascade) { + + # Remove this field from all indices using it + foreach my $i ($self->get_indices()) { + my @fs = $i->fields(); + @fs = grep { $_ ne $field->name } @fs; + $i->fields(@fs); } - my $field = delete $self->_fields->{ $field_name }; - - if ( $cascade ) { - # Remove this field from all indices using it - foreach my $i ($self->get_indices()) { - my @fs = $i->fields(); - @fs = grep { $_ ne $field->name } @fs; - $i->fields(@fs); - } - - # Remove this field from all constraints using it - foreach my $c ($self->get_constraints()) { - my @cs = $c->fields(); - @cs = grep { $_ ne $field->name } @cs; - $c->fields(@cs); - } + # Remove this field from all constraints using it + foreach my $c ($self->get_constraints()) { + my @cs = $c->fields(); + @cs = grep { $_ ne $field->name } @cs; + $c->fields(@cs); } + } - return $field; + return $field; } =head2 comments @@ -404,25 +397,26 @@ all the comments joined on newlines. =cut has comments => ( - is => 'rw', - coerce => quote_sub(q{ ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }), - default => quote_sub(q{ [] }), + is => 'rw', + coerce => quote_sub(q{ ref($_[0]) eq 'ARRAY' ? $_[0] : [$_[0]] }), + default => quote_sub(q{ [] }), ); around comments => sub { - my $orig = shift; - my $self = shift; - my @comments = ref $_[0] ? @{ $_[0] } : @_; - - for my $arg ( @comments ) { - $arg = $arg->[0] if ref $arg; - push @{ $self->$orig }, $arg if defined $arg && $arg; - } - - @comments = @{$self->$orig}; - return wantarray ? @comments - : @comments ? join( "\n", @comments ) - : undef; + my $orig = shift; + my $self = shift; + my @comments = ref $_[0] ? @{ $_[0] } : @_; + + for my $arg (@comments) { + $arg = $arg->[0] if ref $arg; + push @{ $self->$orig }, $arg if defined $arg && $arg; + } + + @comments = @{ $self->$orig }; + return + wantarray ? @comments + : @comments ? join("\n", @comments) + : undef; }; =head2 get_constraints @@ -434,16 +428,14 @@ Returns all the constraint objects as an array or array reference. =cut sub get_constraints { - my $self = shift; + my $self = shift; - if ( $self->_has_constraints ) { - return wantarray - ? @{ $self->_constraints } : $self->_constraints; - } - else { - $self->error('No constraints'); - return; - } + if ($self->_has_constraints) { + return wantarray ? @{ $self->_constraints } : $self->_constraints; + } else { + $self->error('No constraints'); + return; + } } =head2 get_indices @@ -455,17 +447,16 @@ Returns all the index objects as an array or array reference. =cut sub get_indices { - my $self = shift; - - if ( $self->_has_indices ) { - return wantarray - ? @{ $self->_indices } - : $self->_indices; - } - else { - $self->error('No indices'); - return; - } + my $self = shift; + + if ($self->_has_indices) { + return wantarray + ? @{ $self->_indices } + : $self->_indices; + } else { + $self->error('No indices'); + return; + } } =head2 get_field @@ -477,21 +468,21 @@ Returns a field by the name provided. =cut sub get_field { - my $self = shift; - my $field_name = shift or return $self->error('No field name'); - my $case_insensitive = shift; - return $self->error(qq[Field "$field_name" does not exist]) - unless $self->_has_fields; - if ( $case_insensitive ) { - $field_name = uc($field_name); - foreach my $field ( keys %{$self->_fields} ) { - return $self->_fields->{$field} if $field_name eq uc($field); - } - return $self->error(qq[Field "$field_name" does not exist]); - } - return $self->error( qq[Field "$field_name" does not exist] ) unless - exists $self->_fields->{ $field_name }; - return $self->_fields->{ $field_name }; + my $self = shift; + my $field_name = shift or return $self->error('No field name'); + my $case_insensitive = shift; + return $self->error(qq[Field "$field_name" does not exist]) + unless $self->_has_fields; + if ($case_insensitive) { + $field_name = uc($field_name); + foreach my $field (keys %{ $self->_fields }) { + return $self->_fields->{$field} if $field_name eq uc($field); + } + return $self->error(qq[Field "$field_name" does not exist]); + } + return $self->error(qq[Field "$field_name" does not exist]) + unless exists $self->_fields->{$field_name}; + return $self->_fields->{$field_name}; } =head2 get_fields @@ -503,20 +494,17 @@ Returns all the field objects as an array or array reference. =cut sub get_fields { - my $self = shift; - my @fields = - map { $_->[1] } - sort { $a->[0] <=> $b->[0] } - map { [ $_->order, $_ ] } - values %{ $self->_has_fields ? $self->_fields : {} }; - - if ( @fields ) { - return wantarray ? @fields : \@fields; - } - else { - $self->error('No fields'); - return; - } + my $self = shift; + my @fields = map { $_->[1] } + sort { $a->[0] <=> $b->[0] } + map { [ $_->order, $_ ] } values %{ $self->_has_fields ? $self->_fields : {} }; + + if (@fields) { + return wantarray ? @fields : \@fields; + } else { + $self->error('No fields'); + return; + } } =head2 is_valid @@ -528,17 +516,15 @@ Determine whether the view is valid or not. =cut sub is_valid { - my $self = shift; - return $self->error('No name') unless $self->name; - return $self->error('No fields') unless $self->get_fields; - - for my $object ( - $self->get_fields, $self->get_indices, $self->get_constraints - ) { - return $object->error unless $object->is_valid; - } + my $self = shift; + return $self->error('No name') unless $self->name; + return $self->error('No fields') unless $self->get_fields; + + for my $object ($self->get_fields, $self->get_indices, $self->get_constraints) { + return $object->error unless $object->is_valid; + } - return 1; + return 1; } =head2 is_trivial_link @@ -547,28 +533,28 @@ True if table has no data (non-key) fields and only uses single key joins. =cut -has is_trivial_link => ( is => 'lazy', init_arg => undef ); +has is_trivial_link => (is => 'lazy', init_arg => undef); around is_trivial_link => carp_ro('is_trivial_link'); sub _build_is_trivial_link { - my $self = shift; - return 0 if $self->is_data; + my $self = shift; + return 0 if $self->is_data; - my %fk = (); + my %fk = (); - foreach my $field ( $self->get_fields ) { - next unless $field->is_foreign_key; - $fk{$field->foreign_key_reference->reference_table}++; - } + foreach my $field ($self->get_fields) { + next unless $field->is_foreign_key; + $fk{ $field->foreign_key_reference->reference_table }++; + } - foreach my $referenced (keys %fk){ - if($fk{$referenced} > 1){ - return 0; - } + foreach my $referenced (keys %fk) { + if ($fk{$referenced} > 1) { + return 0; } + } - return 1; + return 1; } =head2 is_data @@ -577,20 +563,20 @@ Returns true if the table has some non-key fields. =cut -has is_data => ( is => 'lazy', init_arg => undef ); +has is_data => (is => 'lazy', init_arg => undef); around is_data => carp_ro('is_data'); sub _build_is_data { - my $self = shift; + my $self = shift; - foreach my $field ( $self->get_fields ) { - if ( !$field->is_primary_key and !$field->is_foreign_key ) { - return 1; - } + foreach my $field ($self->get_fields) { + if (!$field->is_primary_key and !$field->is_foreign_key) { + return 1; } + } - return 0; + return 0; } =head2 can_link @@ -601,86 +587,68 @@ Determine whether the table can link two arg tables via many-to-many. =cut -has _can_link => ( is => 'ro', init_arg => undef, default => quote_sub(q{ +{} }) ); +has _can_link => (is => 'ro', init_arg => undef, default => quote_sub(q{ +{} })); sub can_link { - my ( $self, $table1, $table2 ) = @_; + my ($self, $table1, $table2) = @_; - return $self->_can_link->{ $table1->name }{ $table2->name } + return $self->_can_link->{ $table1->name }{ $table2->name } if defined $self->_can_link->{ $table1->name }{ $table2->name }; - if ( $self->is_data == 1 ) { - $self->_can_link->{ $table1->name }{ $table2->name } = [0]; - $self->_can_link->{ $table2->name }{ $table1->name } = [0]; - return $self->_can_link->{ $table1->name }{ $table2->name }; - } - - my %fk = (); - - foreach my $field ( $self->get_fields ) { - if ( $field->is_foreign_key ) { - push @{ $fk{ $field->foreign_key_reference->reference_table } }, - $field->foreign_key_reference; - } - } + if ($self->is_data == 1) { + $self->_can_link->{ $table1->name }{ $table2->name } = [0]; + $self->_can_link->{ $table2->name }{ $table1->name } = [0]; + return $self->_can_link->{ $table1->name }{ $table2->name }; + } - if ( !defined( $fk{ $table1->name } ) or !defined( $fk{ $table2->name } ) ) - { - $self->_can_link->{ $table1->name }{ $table2->name } = [0]; - $self->_can_link->{ $table2->name }{ $table1->name } = [0]; - return $self->_can_link->{ $table1->name }{ $table2->name }; - } + my %fk = (); - # trivial traversal, only one way to link the two tables - if ( scalar( @{ $fk{ $table1->name } } == 1 ) - and scalar( @{ $fk{ $table2->name } } == 1 ) ) - { - $self->_can_link->{ $table1->name }{ $table2->name } = - [ 'one2one', $fk{ $table1->name }, $fk{ $table2->name } ]; - $self->_can_link->{ $table1->name }{ $table2->name } = - [ 'one2one', $fk{ $table2->name }, $fk{ $table1->name } ]; - - # non-trivial traversal. one way to link table2, - # many ways to link table1 - } - elsif ( scalar( @{ $fk{ $table1->name } } > 1 ) - and scalar( @{ $fk{ $table2->name } } == 1 ) ) - { - $self->_can_link->{ $table1->name }{ $table2->name } = - [ 'many2one', $fk{ $table1->name }, $fk{ $table2->name } ]; - $self->_can_link->{ $table2->name }{ $table1->name } = - [ 'one2many', $fk{ $table2->name }, $fk{ $table1->name } ]; - - # non-trivial traversal. one way to link table1, - # many ways to link table2 - } - elsif ( scalar( @{ $fk{ $table1->name } } == 1 ) - and scalar( @{ $fk{ $table2->name } } > 1 ) ) - { - $self->_can_link->{ $table1->name }{ $table2->name } = - [ 'one2many', $fk{ $table1->name }, $fk{ $table2->name } ]; - $self->_can_link->{ $table2->name }{ $table1->name } = - [ 'many2one', $fk{ $table2->name }, $fk{ $table1->name } ]; - - # non-trivial traversal. many ways to link table1 and table2 - } - elsif ( scalar( @{ $fk{ $table1->name } } > 1 ) - and scalar( @{ $fk{ $table2->name } } > 1 ) ) - { - $self->_can_link->{ $table1->name }{ $table2->name } = - [ 'many2many', $fk{ $table1->name }, $fk{ $table2->name } ]; - $self->_can_link->{ $table2->name }{ $table1->name } = - [ 'many2many', $fk{ $table2->name }, $fk{ $table1->name } ]; - - # one of the tables didn't export a key - # to this table, no linking possible - } - else { - $self->_can_link->{ $table1->name }{ $table2->name } = [0]; - $self->_can_link->{ $table2->name }{ $table1->name } = [0]; + foreach my $field ($self->get_fields) { + if ($field->is_foreign_key) { + push @{ $fk{ $field->foreign_key_reference->reference_table } }, $field->foreign_key_reference; } + } + if (!defined($fk{ $table1->name }) or !defined($fk{ $table2->name })) { + $self->_can_link->{ $table1->name }{ $table2->name } = [0]; + $self->_can_link->{ $table2->name }{ $table1->name } = [0]; return $self->_can_link->{ $table1->name }{ $table2->name }; + } + + # trivial traversal, only one way to link the two tables + if ( scalar(@{ $fk{ $table1->name } } == 1) + and scalar(@{ $fk{ $table2->name } } == 1)) { + $self->_can_link->{ $table1->name }{ $table2->name } = [ 'one2one', $fk{ $table1->name }, $fk{ $table2->name } ]; + $self->_can_link->{ $table1->name }{ $table2->name } = [ 'one2one', $fk{ $table2->name }, $fk{ $table1->name } ]; + + # non-trivial traversal. one way to link table2, + # many ways to link table1 + } elsif (scalar(@{ $fk{ $table1->name } } > 1) + and scalar(@{ $fk{ $table2->name } } == 1)) { + $self->_can_link->{ $table1->name }{ $table2->name } = [ 'many2one', $fk{ $table1->name }, $fk{ $table2->name } ]; + $self->_can_link->{ $table2->name }{ $table1->name } = [ 'one2many', $fk{ $table2->name }, $fk{ $table1->name } ]; + + # non-trivial traversal. one way to link table1, + # many ways to link table2 + } elsif (scalar(@{ $fk{ $table1->name } } == 1) + and scalar(@{ $fk{ $table2->name } } > 1)) { + $self->_can_link->{ $table1->name }{ $table2->name } = [ 'one2many', $fk{ $table1->name }, $fk{ $table2->name } ]; + $self->_can_link->{ $table2->name }{ $table1->name } = [ 'many2one', $fk{ $table2->name }, $fk{ $table1->name } ]; + + # non-trivial traversal. many ways to link table1 and table2 + } elsif (scalar(@{ $fk{ $table1->name } } > 1) + and scalar(@{ $fk{ $table2->name } } > 1)) { + $self->_can_link->{ $table1->name }{ $table2->name } = [ 'many2many', $fk{ $table1->name }, $fk{ $table2->name } ]; + $self->_can_link->{ $table2->name }{ $table1->name } = [ 'many2many', $fk{ $table2->name }, $fk{ $table1->name } ]; + + # one of the tables didn't export a key + # to this table, no linking possible + } else { + $self->_can_link->{ $table1->name }{ $table2->name } = [0]; + $self->_can_link->{ $table2->name }{ $table1->name } = [0]; + } + + return $self->_can_link->{ $table1->name }{ $table2->name }; } =head2 name @@ -698,22 +666,22 @@ that name and disallows the change if one exists (setting the error to =cut has name => ( - is => 'rw', - isa => sub { throw("No table name") unless $_[0] }, + is => 'rw', + isa => sub { throw("No table name") unless $_[0] }, ); around name => sub { - my $orig = shift; - my $self = shift; - - if ( my ($arg) = @_ ) { - if ( my $schema = $self->schema ) { - return $self->error( qq[Can't use table name "$arg": table exists] ) - if $schema->get_table( $arg ); - } + my $orig = shift; + my $self = shift; + + if (my ($arg) = @_) { + if (my $schema = $self->schema) { + return $self->error(qq[Can't use table name "$arg": table exists]) + if $schema->get_table($arg); } + } - return ex2err($orig, $self, @_); + return ex2err($orig, $self, @_); }; =head2 schema @@ -724,7 +692,7 @@ Get or set the table's schema object. =cut -has schema => ( is => 'rw', isa => schema_obj('Schema'), weak_ref => 1 ); +has schema => (is => 'rw', isa => schema_obj('Schema'), weak_ref => 1); around schema => \&ex2err; @@ -754,43 +722,42 @@ These are equivalent: =cut - my $self = shift; - my $fields = parse_list_arg( @_ ); - - my $constraint; - if ( @$fields ) { - for my $f ( @$fields ) { - return $self->error(qq[Invalid field "$f"]) unless - $self->get_field($f); - } - - my $has_pk; - for my $c ( $self->get_constraints ) { - if ( $c->type eq PRIMARY_KEY ) { - $has_pk = 1; - $c->fields( @{ $c->fields }, @$fields ); - $constraint = $c; - } - } - - unless ( $has_pk ) { - $constraint = $self->add_constraint( - type => PRIMARY_KEY, - fields => $fields, - ) or return; - } + my $self = shift; + my $fields = parse_list_arg(@_); + + my $constraint; + if (@$fields) { + for my $f (@$fields) { + return $self->error(qq[Invalid field "$f"]) + unless $self->get_field($f); } - if ( $constraint ) { - return $constraint; + my $has_pk; + for my $c ($self->get_constraints) { + if ($c->type eq PRIMARY_KEY) { + $has_pk = 1; + $c->fields(@{ $c->fields }, @$fields); + $constraint = $c; + } } - else { - for my $c ( $self->get_constraints ) { - return $c if $c->type eq PRIMARY_KEY; - } + + unless ($has_pk) { + $constraint = $self->add_constraint( + type => PRIMARY_KEY, + fields => $fields, + ) or return; } + } - return; + if ($constraint) { + return $constraint; + } else { + for my $c ($self->get_constraints) { + return $c if $c->type eq PRIMARY_KEY; + } + } + + return; } =head2 options @@ -802,7 +769,7 @@ Returns an array or array reference. =cut -with ListAttr options => ( append => 1 ); +with ListAttr options => (append => 1); =head2 order @@ -812,16 +779,16 @@ Get or set the table's order. =cut -has order => ( is => 'rw', default => quote_sub(q{ 0 }) ); +has order => (is => 'rw', default => quote_sub(q{ 0 })); around order => sub { - my ( $orig, $self, $arg ) = @_; + my ($orig, $self, $arg) = @_; - if ( defined $arg && $arg =~ /^\d+$/ ) { - return $self->$orig($arg); - } + if (defined $arg && $arg =~ /^\d+$/) { + return $self->$orig($arg); + } - return $self->$orig; + return $self->$orig; }; =head2 field_names @@ -835,18 +802,15 @@ avoid the overload magic of the Field objects returned by the get_fields method. =cut sub field_names { - my $self = shift; - my @fields = - map { $_->name } - $self->get_fields; + my $self = shift; + my @fields = map { $_->name } $self->get_fields; - if ( @fields ) { - return wantarray ? @fields : \@fields; - } - else { - $self->error('No fields'); - return; - } + if (@fields) { + return wantarray ? @fields : \@fields; + } else { + $self->error('No fields'); + return; + } } sub equals { @@ -861,80 +825,88 @@ Determines if this table is the same as another =cut - my $self = shift; - my $other = shift; - my $case_insensitive = shift; - - return 0 unless $self->SUPER::equals($other); - return 0 unless $case_insensitive ? uc($self->name) eq uc($other->name) : $self->name eq $other->name; - return 0 unless $self->_compare_objects(scalar $self->options, scalar $other->options); - return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); - - # Fields - # Go through our fields - my %checkedFields; - foreach my $field ( $self->get_fields ) { - my $otherField = $other->get_field($field->name, $case_insensitive); - return 0 unless $field->equals($otherField, $case_insensitive); - $checkedFields{$field->name} = 1; - } - # Go through the other table's fields - foreach my $otherField ( $other->get_fields ) { - next if $checkedFields{$otherField->name}; - return 0; - } + my $self = shift; + my $other = shift; + my $case_insensitive = shift; + + return 0 unless $self->SUPER::equals($other); + return 0 + unless $case_insensitive + ? uc($self->name) eq uc($other->name) + : $self->name eq $other->name; + return 0 + unless $self->_compare_objects(scalar $self->options, scalar $other->options); + return 0 + unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); + + # Fields + # Go through our fields + my %checkedFields; + foreach my $field ($self->get_fields) { + my $otherField = $other->get_field($field->name, $case_insensitive); + return 0 unless $field->equals($otherField, $case_insensitive); + $checkedFields{ $field->name } = 1; + } + + # Go through the other table's fields + foreach my $otherField ($other->get_fields) { + next if $checkedFields{ $otherField->name }; + return 0; + } - # Constraints - # Go through our constraints - my %checkedConstraints; + # Constraints + # Go through our constraints + my %checkedConstraints; CONSTRAINT: - foreach my $constraint ( $self->get_constraints ) { - foreach my $otherConstraint ( $other->get_constraints ) { - if ( $constraint->equals($otherConstraint, $case_insensitive) ) { - $checkedConstraints{$otherConstraint} = 1; - next CONSTRAINT; - } + foreach my $constraint ($self->get_constraints) { + foreach my $otherConstraint ($other->get_constraints) { + if ($constraint->equals($otherConstraint, $case_insensitive)) { + $checkedConstraints{$otherConstraint} = 1; + next CONSTRAINT; } - return 0; } - # Go through the other table's constraints + return 0; + } + + # Go through the other table's constraints CONSTRAINT2: - foreach my $otherConstraint ( $other->get_constraints ) { - next if $checkedFields{$otherConstraint}; - foreach my $constraint ( $self->get_constraints ) { - if ( $otherConstraint->equals($constraint, $case_insensitive) ) { - next CONSTRAINT2; - } + foreach my $otherConstraint ($other->get_constraints) { + next if $checkedFields{$otherConstraint}; + foreach my $constraint ($self->get_constraints) { + if ($otherConstraint->equals($constraint, $case_insensitive)) { + next CONSTRAINT2; } - return 0; } + return 0; + } - # Indices - # Go through our indices - my %checkedIndices; + # Indices + # Go through our indices + my %checkedIndices; INDEX: - foreach my $index ( $self->get_indices ) { - foreach my $otherIndex ( $other->get_indices ) { - if ( $index->equals($otherIndex, $case_insensitive) ) { - $checkedIndices{$otherIndex} = 1; - next INDEX; - } + foreach my $index ($self->get_indices) { + foreach my $otherIndex ($other->get_indices) { + if ($index->equals($otherIndex, $case_insensitive)) { + $checkedIndices{$otherIndex} = 1; + next INDEX; } - return 0; } - # Go through the other table's indices + return 0; + } + + # Go through the other table's indices INDEX2: - foreach my $otherIndex ( $other->get_indices ) { - next if $checkedIndices{$otherIndex}; - foreach my $index ( $self->get_indices ) { - if ( $otherIndex->equals($index, $case_insensitive) ) { - next INDEX2; - } + foreach my $otherIndex ($other->get_indices) { + next if $checkedIndices{$otherIndex}; + foreach my $index ($self->get_indices) { + if ($otherIndex->equals($index, $case_insensitive)) { + next INDEX2; } - return 0; } + return 0; + } - return 1; + return 1; } =head1 LOOKUP METHODS @@ -979,48 +951,47 @@ primary key constraint) =cut sub pkey_fields { - my $me = shift; - my @fields = grep { $_->is_primary_key } $me->get_fields; - return wantarray ? @fields : \@fields; + my $me = shift; + my @fields = grep { $_->is_primary_key } $me->get_fields; + return wantarray ? @fields : \@fields; } sub fkey_fields { - my $me = shift; - my @fields; - push @fields, $_->fields foreach $me->fkey_constraints; - return wantarray ? @fields : \@fields; + my $me = shift; + my @fields; + push @fields, $_->fields foreach $me->fkey_constraints; + return wantarray ? @fields : \@fields; } sub nonpkey_fields { - my $me = shift; - my @fields = grep { !$_->is_primary_key } $me->get_fields; - return wantarray ? @fields : \@fields; + my $me = shift; + my @fields = grep { !$_->is_primary_key } $me->get_fields; + return wantarray ? @fields : \@fields; } sub data_fields { - my $me = shift; - my @fields = - grep { !$_->is_foreign_key and !$_->is_primary_key } $me->get_fields; - return wantarray ? @fields : \@fields; + my $me = shift; + my @fields = grep { !$_->is_foreign_key and !$_->is_primary_key } $me->get_fields; + return wantarray ? @fields : \@fields; } sub unique_fields { - my $me = shift; - my @fields; - push @fields, $_->fields foreach $me->unique_constraints; - return wantarray ? @fields : \@fields; + my $me = shift; + my @fields; + push @fields, $_->fields foreach $me->unique_constraints; + return wantarray ? @fields : \@fields; } sub unique_constraints { - my $me = shift; - my @cons = grep { $_->type eq UNIQUE } $me->get_constraints; - return wantarray ? @cons : \@cons; + my $me = shift; + my @cons = grep { $_->type eq UNIQUE } $me->get_constraints; + return wantarray ? @cons : \@cons; } sub fkey_constraints { - my $me = shift; - my @cons = grep { $_->type eq FOREIGN_KEY } $me->get_constraints; - return wantarray ? @cons : \@cons; + my $me = shift; + my @cons = grep { $_->type eq FOREIGN_KEY } $me->get_constraints; + return wantarray ? @cons : \@cons; } # Must come after all 'has' declarations diff --git a/lib/SQL/Translator/Schema/Trigger.pm b/lib/SQL/Translator/Schema/Trigger.pm index c4eaef7ea..4ef61e10f 100644 --- a/lib/SQL/Translator/Schema/Trigger.pm +++ b/lib/SQL/Translator/Schema/Trigger.pm @@ -31,7 +31,7 @@ C is the trigger object. use Moo; use SQL::Translator::Utils qw(parse_list_arg ex2err throw uniq); use SQL::Translator::Types qw(schema_obj enum); -use Sub::Quote qw(quote_sub); +use Sub::Quote qw(quote_sub); extends 'SQL::Translator::Schema::Object'; @@ -46,18 +46,18 @@ Object constructor. =cut around BUILDARGS => sub { - my ($orig, $self, @args) = @_; - my $args = $self->$orig(@args); - if (exists $args->{on_table}) { - my $arg = delete $args->{on_table}; - my $table = $args->{schema}->get_table($arg) - or die "Table named $arg doesn't exist"; - $args->{table} = $table; - } - if (exists $args->{database_event}) { - $args->{database_events} = delete $args->{database_event}; - } - return $args; + my ($orig, $self, @args) = @_; + my $args = $self->$orig(@args); + if (exists $args->{on_table}) { + my $arg = delete $args->{on_table}; + my $table = $args->{schema}->get_table($arg) + or die "Table named $arg doesn't exist"; + $args->{table} = $table; + } + if (exists $args->{database_event}) { + $args->{database_events} = delete $args->{database_event}; + } + return $args; }; =head2 perform_action_when @@ -70,12 +70,15 @@ C. =cut has perform_action_when => ( - is => 'rw', - coerce => quote_sub(q{ defined $_[0] ? lc $_[0] : $_[0] }), - isa => enum([qw(before after)], { - msg => "Invalid argument '%s' to perform_action_when", - allow_undef => 1, - }), + is => 'rw', + coerce => quote_sub(q{ defined $_[0] ? lc $_[0] : $_[0] }), + isa => enum( + [qw(before after)], + { + msg => "Invalid argument '%s' to perform_action_when", + allow_undef => 1, + } + ), ); around perform_action_when => \&ex2err; @@ -90,9 +93,9 @@ Obsolete please use database_events! =cut - my $self = shift; + my $self = shift; - return $self->database_events( @_ ); + return $self->database_events(@_); } =head2 database_events @@ -104,34 +107,30 @@ Gets or sets the events that triggers the trigger. =cut has database_events => ( - is => 'rw', - coerce => quote_sub(q{ [ map { lc } ref $_[0] eq 'ARRAY' ? @{$_[0]} : ($_[0]) ] }), - isa => sub { - my @args = @{$_[0]}; - my %valid = map { $_, 1 } qw[ insert update update_on delete ]; - my @invalid = grep { !defined $valid{ $_ } } @args; - - if ( @invalid ) { - throw( - sprintf("Invalid events '%s' in database_events", - join(', ', @invalid) - ) - ); - } - }, + is => 'rw', + coerce => quote_sub(q{ [ map { lc } ref $_[0] eq 'ARRAY' ? @{$_[0]} : ($_[0]) ] }), + isa => sub { + my @args = @{ $_[0] }; + my %valid = map { $_, 1 } qw[ insert update update_on delete ]; + my @invalid = grep { !defined $valid{$_} } @args; + + if (@invalid) { + throw(sprintf("Invalid events '%s' in database_events", join(', ', @invalid))); + } + }, ); around database_events => sub { - my ($orig,$self) = (shift, shift); + my ($orig, $self) = (shift, shift); - if (@_) { - ex2err($orig, $self, ref $_[0] eq 'ARRAY' ? $_[0] : \@_) - or return; - } + if (@_) { + ex2err($orig, $self, ref $_[0] eq 'ARRAY' ? $_[0] : \@_) + or return; + } - return wantarray - ? @{ $self->$orig || [] } - : $self->$orig; + return wantarray + ? @{ $self->$orig || [] } + : $self->$orig; }; =head2 fields @@ -149,20 +148,20 @@ Gets and set which fields to monitor for C. =cut has fields => ( - is => 'rw', - coerce => sub { - my @fields = uniq @{parse_list_arg($_[0])}; - @fields ? \@fields : undef; - }, + is => 'rw', + coerce => sub { + my @fields = uniq @{ parse_list_arg($_[0]) }; + @fields ? \@fields : undef; + }, ); around fields => sub { - my $orig = shift; - my $self = shift; - my $fields = parse_list_arg( @_ ); - $self->$orig($fields) if @$fields; + my $orig = shift; + my $self = shift; + my $fields = parse_list_arg(@_); + $self->$orig($fields) if @$fields; - return wantarray ? @{ $self->$orig || [] } : $self->$orig; + return wantarray ? @{ $self->$orig || [] } : $self->$orig; }; =head2 table @@ -172,7 +171,7 @@ Gets or set the table on which the trigger works, as a L ( is => 'rw', isa => schema_obj('Table'), weak_ref => 1 ); +has table => (is => 'rw', isa => schema_obj('Table'), weak_ref => 1); around table => \&ex2err; @@ -187,14 +186,14 @@ Gets or set the table name on which the trigger works, as a string. =cut - my ($self, $arg) = @_; - if ( @_ == 2 ) { - my $table = $self->schema->get_table($arg); - die "Table named $arg doesn't exist" - if !$table; - $self->table($table); - } - return $self->table->name; + my ($self, $arg) = @_; + if (@_ == 2) { + my $table = $self->schema->get_table($arg); + die "Table named $arg doesn't exist" + if !$table; + $self->table($table); + } + return $self->table->name; } =head2 action @@ -212,7 +211,7 @@ Gets or set the action of the trigger. =cut -has action => ( is => 'rw', default => quote_sub(q{ '' }) ); +has action => (is => 'rw', default => quote_sub(q{ '' })); sub is_valid { @@ -226,18 +225,16 @@ Determine whether the trigger is valid or not. =cut - my $self = shift; + my $self = shift; - for my $attr ( - qw[ name perform_action_when database_events on_table action ] - ) { - return $self->error("Invalid: missing '$attr'") unless $self->$attr(); - } + for my $attr (qw[ name perform_action_when database_events on_table action ]) { + return $self->error("Invalid: missing '$attr'") unless $self->$attr(); + } - return $self->error("Missing fields for UPDATE ON") if - $self->database_event eq 'update_on' && !$self->fields; + return $self->error("Missing fields for UPDATE ON") + if $self->database_event eq 'update_on' && !$self->fields; - return 1; + return 1; } =head2 name @@ -248,7 +245,7 @@ Get or set the trigger's name. =cut -has name => ( is => 'rw', default => quote_sub(q{ '' }) ); +has name => (is => 'rw', default => quote_sub(q{ '' })); =head2 order @@ -258,16 +255,16 @@ Get or set the trigger's order. =cut -has order => ( is => 'rw', default => quote_sub(q{ 0 }) ); +has order => (is => 'rw', default => quote_sub(q{ 0 })); around order => sub { - my ( $orig, $self, $arg ) = @_; + my ($orig, $self, $arg) = @_; - if ( defined $arg && $arg =~ /^\d+$/ ) { - return $self->$orig($arg); - } + if (defined $arg && $arg =~ /^\d+$/) { + return $self->$orig($arg); + } - return $self->$orig; + return $self->$orig; }; =head2 scope @@ -279,15 +276,19 @@ Get or set the trigger's scope (row or statement). =cut has scope => ( - is => 'rw', - isa => enum([qw(row statement)], { - msg => "Invalid scope '%s'", icase => 1, allow_undef => 1, - }), + is => 'rw', + isa => enum( + [qw(row statement)], + { + msg => "Invalid scope '%s'", + icase => 1, + allow_undef => 1, + } + ), ); around scope => \&ex2err; - =head2 schema Get or set the trigger's schema object. @@ -297,7 +298,7 @@ Get or set the trigger's schema object. =cut -has schema => (is => 'rw', isa => schema_obj('Schema'), weak_ref => 1 ); +has schema => (is => 'rw', isa => schema_obj('Schema'), weak_ref => 1); around schema => \&ex2err; @@ -311,22 +312,22 @@ Compare two arrays. =cut - my ($first, $second) = @_; - no warnings; # silence spurious -w undef complaints + my ($first, $second) = @_; + no warnings; # silence spurious -w undef complaints - return 0 unless (ref $first eq 'ARRAY' and ref $second eq 'ARRAY' ) ; + return 0 unless (ref $first eq 'ARRAY' and ref $second eq 'ARRAY'); - return 0 unless @$first == @$second; + return 0 unless @$first == @$second; - my @first = sort @$first; + my @first = sort @$first; - my @second = sort @$second; + my @second = sort @$second; - for (my $i = 0; $i < scalar @first; $i++) { - return 0 if @first[$i] ne @second[$i]; - } + for (my $i = 0; $i < scalar @first; $i++) { + return 0 if @first[$i] ne @second[$i]; + } - return 1; + return 1; } =head2 equals @@ -338,48 +339,44 @@ Determines if this trigger is the same as another =cut around equals => sub { - my $orig = shift; - my $self = shift; - my $other = shift; - my $case_insensitive = shift; + my $orig = shift; + my $self = shift; + my $other = shift; + my $case_insensitive = shift; - return 0 unless $self->$orig($other); + return 0 unless $self->$orig($other); - my %names; - for my $name ( $self->name, $other->name ) { - $name = lc $name if $case_insensitive; - $names{ $name }++; - } + my %names; + for my $name ($self->name, $other->name) { + $name = lc $name if $case_insensitive; + $names{$name}++; + } - if ( keys %names > 1 ) { - return $self->error('Names not equal'); - } + if (keys %names > 1) { + return $self->error('Names not equal'); + } - if ( !$self->perform_action_when eq $other->perform_action_when ) { - return $self->error('perform_action_when differs'); - } + if (!$self->perform_action_when eq $other->perform_action_when) { + return $self->error('perform_action_when differs'); + } - if ( - !compare_arrays( [$self->database_events], [$other->database_events] ) - ) { - return $self->error('database_events differ'); - } + if (!compare_arrays([ $self->database_events ], [ $other->database_events ])) { + return $self->error('database_events differ'); + } - if ( $self->on_table ne $other->on_table ) { - return $self->error('on_table differs'); - } + if ($self->on_table ne $other->on_table) { + return $self->error('on_table differs'); + } - if ( $self->action ne $other->action ) { - return $self->error('action differs'); - } + if ($self->action ne $other->action) { + return $self->error('action differs'); + } - if ( - !$self->_compare_objects( scalar $self->extra, scalar $other->extra ) - ) { - return $self->error('extras differ'); - } + if (!$self->_compare_objects(scalar $self->extra, scalar $other->extra)) { + return $self->error('extras differ'); + } - return 1; + return 1; }; # Must come after all 'has' declarations diff --git a/lib/SQL/Translator/Schema/View.pm b/lib/SQL/Translator/Schema/View.pm index 2eeab2bdb..a3424a495 100644 --- a/lib/SQL/Translator/Schema/View.pm +++ b/lib/SQL/Translator/Schema/View.pm @@ -55,7 +55,7 @@ names and keep them in order by the first occurrence of a field name. =cut -with ListAttr fields => ( uniq => 1 ); +with ListAttr fields => (uniq => 1); =head2 tables @@ -73,7 +73,7 @@ names and keep them in order by the first occurrence of a field name. =cut -with ListAttr tables => ( uniq => 1 ); +with ListAttr tables => (uniq => 1); =head2 options @@ -85,7 +85,7 @@ Gets or appends a list of options on the view. =cut -with ListAttr options => ( uniq => 1, append => 1 ); +with ListAttr options => (uniq => 1, append => 1); sub is_valid { @@ -99,12 +99,12 @@ Determine whether the view is valid or not. =cut - my $self = shift; + my $self = shift; - return $self->error('No name') unless $self->name; - return $self->error('No sql') unless $self->sql; + return $self->error('No name') unless $self->name; + return $self->error('No sql') unless $self->sql; - return 1; + return 1; } =head2 name @@ -115,7 +115,7 @@ Get or set the view's name. =cut -has name => ( is => 'rw', default => quote_sub(q{ '' }) ); +has name => (is => 'rw', default => quote_sub(q{ '' })); =head2 order @@ -125,16 +125,16 @@ Get or set the view's order. =cut -has order => ( is => 'rw', default => quote_sub(q{ 0 }) ); +has order => (is => 'rw', default => quote_sub(q{ 0 })); around order => sub { - my ( $orig, $self, $arg ) = @_; + my ($orig, $self, $arg) = @_; - if ( defined $arg && $arg =~ /^\d+$/ ) { - return $self->$orig($arg); - } + if (defined $arg && $arg =~ /^\d+$/) { + return $self->$orig($arg); + } - return $self->$orig; + return $self->$orig; }; =head2 sql @@ -145,7 +145,7 @@ Get or set the view's SQL. =cut -has sql => ( is => 'rw', default => quote_sub(q{ '' }) ); +has sql => (is => 'rw', default => quote_sub(q{ '' })); =head2 schema @@ -156,7 +156,7 @@ Get or set the view's schema object. =cut -has schema => ( is => 'rw', isa => schema_obj('Schema'), weak_ref => 1 ); +has schema => (is => 'rw', isa => schema_obj('Schema'), weak_ref => 1); around schema => \&ex2err; @@ -169,33 +169,43 @@ Determines if this view is the same as another =cut around equals => sub { - my $orig = shift; - my $self = shift; - my $other = shift; - my $case_insensitive = shift; - my $ignore_sql = shift; - - return 0 unless $self->$orig($other); - return 0 unless $case_insensitive ? uc($self->name) eq uc($other->name) : $self->name eq $other->name; - #return 0 unless $self->is_valid eq $other->is_valid; - - unless ($ignore_sql) { - my $selfSql = $self->sql; - my $otherSql = $other->sql; - # Remove comments - $selfSql =~ s/--.*$//mg; - $otherSql =~ s/--.*$//mg; - # Collapse whitespace to space to avoid whitespace comparison issues - $selfSql =~ s/\s+/ /sg; - $otherSql =~ s/\s+/ /sg; - return 0 unless $selfSql eq $otherSql; - } - - my $selfFields = join(":", $self->fields); - my $otherFields = join(":", $other->fields); - return 0 unless $case_insensitive ? uc($selfFields) eq uc($otherFields) : $selfFields eq $otherFields; - return 0 unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); - return 1; + my $orig = shift; + my $self = shift; + my $other = shift; + my $case_insensitive = shift; + my $ignore_sql = shift; + + return 0 unless $self->$orig($other); + return 0 + unless $case_insensitive + ? uc($self->name) eq uc($other->name) + : $self->name eq $other->name; + + #return 0 unless $self->is_valid eq $other->is_valid; + + unless ($ignore_sql) { + my $selfSql = $self->sql; + my $otherSql = $other->sql; + + # Remove comments + $selfSql =~ s/--.*$//mg; + $otherSql =~ s/--.*$//mg; + + # Collapse whitespace to space to avoid whitespace comparison issues + $selfSql =~ s/\s+/ /sg; + $otherSql =~ s/\s+/ /sg; + return 0 unless $selfSql eq $otherSql; + } + + my $selfFields = join(":", $self->fields); + my $otherFields = join(":", $other->fields); + return 0 + unless $case_insensitive + ? uc($selfFields) eq uc($otherFields) + : $selfFields eq $otherFields; + return 0 + unless $self->_compare_objects(scalar $self->extra, scalar $other->extra); + return 1; }; # Must come after all 'has' declarations diff --git a/lib/SQL/Translator/Types.pm b/lib/SQL/Translator/Types.pm index 754ca60c3..af63811d2 100644 --- a/lib/SQL/Translator/Types.pm +++ b/lib/SQL/Translator/Types.pm @@ -27,7 +27,7 @@ Errors are reported using L. =cut use SQL::Translator::Utils qw(throw); -use Scalar::Util qw(blessed); +use Scalar::Util qw(blessed); use Exporter qw(import); our @EXPORT_OK = qw(schema_obj enum); @@ -42,13 +42,14 @@ class C<< SQL::Translator::Schema::I<$type> >>. =cut sub schema_obj { - my ($class) = @_; - my $name = lc $class; - $class = 'SQL::Translator::Schema' . ($class eq 'Schema' ? '' : "::$class"); - return sub { - throw("Not a $name object") - unless blessed($_[0]) and $_[0]->isa($class); - }; + my ($class) = @_; + my $name = lc $class; + $class = 'SQL::Translator::Schema' . ($class eq 'Schema' ? '' : "::$class"); + return sub { + throw("Not a $name object") + unless blessed($_[0]) + and $_[0]->isa($class); + }; } =head2 enum(\@strings, [$msg | \%parameters]) @@ -85,22 +86,23 @@ If true, allow any false value in addition to the specified strings. =cut sub enum { - my ($values, $args) = @_; - $args ||= {}; - $args = { msg => $args } unless ref($args) eq 'HASH'; - my $icase = !!$args->{icase}; - my %values = map { ($icase ? lc : $_) => undef } @{$values}; - my $msg = $args->{msg} || "Invalid value: '%s'"; - my $extra_test = - $args->{allow_undef} ? sub { defined $_[0] } : - $args->{allow_false} ? sub { !!$_[0] } : undef; - - return sub { - my $val = $icase ? lc $_[0] : $_[0]; - throw(sprintf($msg, $val)) - if (!defined($extra_test) || $extra_test->($val)) - && !exists $values{$val}; - }; + my ($values, $args) = @_; + $args ||= {}; + $args = { msg => $args } unless ref($args) eq 'HASH'; + my $icase = !!$args->{icase}; + my %values = map { ($icase ? lc : $_) => undef } @{$values}; + my $msg = $args->{msg} || "Invalid value: '%s'"; + my $extra_test + = $args->{allow_undef} ? sub { defined $_[0] } + : $args->{allow_false} ? sub { !!$_[0] } + : undef; + + return sub { + my $val = $icase ? lc $_[0] : $_[0]; + throw(sprintf($msg, $val)) + if (!defined($extra_test) || $extra_test->($val)) + && !exists $values{$val}; + }; } 1; diff --git a/lib/SQL/Translator/Utils.pm b/lib/SQL/Translator/Utils.pm index f6f278d35..1e7e21e6f 100644 --- a/lib/SQL/Translator/Utils.pm +++ b/lib/SQL/Translator/Utils.pm @@ -6,263 +6,253 @@ use Digest::SHA qw( sha1_hex ); use File::Spec; use Scalar::Util qw(blessed); use Try::Tiny; -use Carp qw(carp croak); +use Carp qw(carp croak); use List::Util qw(any); our $VERSION = '1.64'; use base qw(Exporter); our @EXPORT_OK = qw( - debug normalize_name header_comment parse_list_arg truncate_id_uniquely - $DEFAULT_COMMENT parse_mysql_version parse_dbms_version - ddl_parser_instance batch_alter_table_statements - uniq throw ex2err carp_ro - normalize_quote_options + debug normalize_name header_comment parse_list_arg truncate_id_uniquely + $DEFAULT_COMMENT parse_mysql_version parse_dbms_version + ddl_parser_instance batch_alter_table_statements + uniq throw ex2err carp_ro + normalize_quote_options ); use constant COLLISION_TAG_LENGTH => 8; our $DEFAULT_COMMENT = '--'; sub debug { - my ($pkg, $file, $line, $sub) = caller(0); - { - no strict qw(refs); - return unless ${"$pkg\::DEBUG"}; - } - - $sub =~ s/^$pkg\:://; - - while (@_) { - my $x = shift; - chomp $x; - $x =~ s/\bPKG\b/$pkg/g; - $x =~ s/\bLINE\b/$line/g; - $x =~ s/\bSUB\b/$sub/g; - #warn '[' . $x . "]\n"; - print STDERR '[' . $x . "]\n"; - } + my ($pkg, $file, $line, $sub) = caller(0); + { + no strict qw(refs); + return unless ${"$pkg\::DEBUG"}; + } + + $sub =~ s/^$pkg\:://; + + while (@_) { + my $x = shift; + chomp $x; + $x =~ s/\bPKG\b/$pkg/g; + $x =~ s/\bLINE\b/$line/g; + $x =~ s/\bSUB\b/$sub/g; + + #warn '[' . $x . "]\n"; + print STDERR '[' . $x . "]\n"; + } } sub normalize_name { - my $name = shift or return ''; + my $name = shift or return ''; - # The name can only begin with a-zA-Z_; if there's anything - # else, prefix with _ - $name =~ s/^([^a-zA-Z_])/_$1/; + # The name can only begin with a-zA-Z_; if there's anything + # else, prefix with _ + $name =~ s/^([^a-zA-Z_])/_$1/; - # anything other than a-zA-Z0-9_ in the non-first position - # needs to be turned into _ - $name =~ tr/[a-zA-Z0-9_]/_/c; + # anything other than a-zA-Z0-9_ in the non-first position + # needs to be turned into _ + $name =~ tr/[a-zA-Z0-9_]/_/c; - # All duplicated _ need to be squashed into one. - $name =~ tr/_/_/s; + # All duplicated _ need to be squashed into one. + $name =~ tr/_/_/s; - # Trim a trailing _ - $name =~ s/_$//; + # Trim a trailing _ + $name =~ s/_$//; - return $name; + return $name; } sub normalize_quote_options { - my $config = shift; + my $config = shift; - my $quote; - if (defined $config->{quote_identifiers}) { - $quote = $config->{quote_identifiers}; + my $quote; + if (defined $config->{quote_identifiers}) { + $quote = $config->{quote_identifiers}; - for (qw/quote_table_names quote_field_names/) { - carp "Ignoring deprecated parameter '$_', since 'quote_identifiers' is supplied" - if defined $config->{$_} - } + for (qw/quote_table_names quote_field_names/) { + carp "Ignoring deprecated parameter '$_', since 'quote_identifiers' is supplied" + if defined $config->{$_}; } - # Legacy one set the other is not - elsif ( - defined $config->{'quote_table_names'} - xor - defined $config->{'quote_field_names'} - ) { - if (defined $config->{'quote_table_names'}) { - carp "Explicitly disabling the deprecated 'quote_table_names' implies disabling 'quote_identifiers' which in turn implies disabling 'quote_field_names'" + } + + # Legacy one set the other is not + elsif (defined $config->{'quote_table_names'} xor defined $config->{'quote_field_names'}) { + if (defined $config->{'quote_table_names'}) { + carp + "Explicitly disabling the deprecated 'quote_table_names' implies disabling 'quote_identifiers' which in turn implies disabling 'quote_field_names'" unless $config->{'quote_table_names'}; - $quote = $config->{'quote_table_names'} ? 1 : 0; - } - else { - carp "Explicitly disabling the deprecated 'quote_field_names' implies disabling 'quote_identifiers' which in turn implies disabling 'quote_table_names'" + $quote = $config->{'quote_table_names'} ? 1 : 0; + } else { + carp + "Explicitly disabling the deprecated 'quote_field_names' implies disabling 'quote_identifiers' which in turn implies disabling 'quote_table_names'" unless $config->{'quote_field_names'}; - $quote = $config->{'quote_field_names'} ? 1 : 0; - } + $quote = $config->{'quote_field_names'} ? 1 : 0; } - # Legacy both are set - elsif(defined $config->{'quote_table_names'}) { - croak 'Setting quote_table_names and quote_field_names to conflicting values is no longer supported' + } + + # Legacy both are set + elsif (defined $config->{'quote_table_names'}) { + croak 'Setting quote_table_names and quote_field_names to conflicting values is no longer supported' if ($config->{'quote_table_names'} xor $config->{'quote_field_names'}); - $quote = $config->{'quote_table_names'} ? 1 : 0; - } + $quote = $config->{'quote_table_names'} ? 1 : 0; + } - return $quote; + return $quote; } sub header_comment { - my $producer = shift || caller; - my $comment_char = shift; - my $now = scalar localtime; + my $producer = shift || caller; + my $comment_char = shift; + my $now = scalar localtime; - $comment_char = $DEFAULT_COMMENT - unless defined $comment_char; + $comment_char = $DEFAULT_COMMENT + unless defined $comment_char; - my $header_comment =<<"HEADER_COMMENT"; + my $header_comment = <<"HEADER_COMMENT"; ${comment_char} ${comment_char} Created by $producer ${comment_char} Created on $now ${comment_char} HEADER_COMMENT - # Any additional stuff passed in - for my $additional_comment (@_) { - $header_comment .= "${comment_char} ${additional_comment}\n"; - } + # Any additional stuff passed in + for my $additional_comment (@_) { + $header_comment .= "${comment_char} ${additional_comment}\n"; + } - return $header_comment; + return $header_comment; } sub parse_list_arg { - my $list = UNIVERSAL::isa( $_[0], 'ARRAY' ) ? shift : [ @_ ]; - - # - # This protects stringification of references. - # - if (any { ref $_ } @$list ) { - return $list; - } - # - # This processes string-like arguments. - # - else { - return [ - map { s/^\s+|\s+$//g; $_ } - map { split /,/ } - grep { defined && length } @$list - ]; - } + my $list = UNIVERSAL::isa($_[0], 'ARRAY') ? shift : [@_]; + + # + # This protects stringification of references. + # + if (any { ref $_ } @$list) { + return $list; + } + # + # This processes string-like arguments. + # + else { + return [ + map { s/^\s+|\s+$//g; $_ } + map { split /,/ } + grep { defined && length } @$list + ]; + } } sub truncate_id_uniquely { - my ( $desired_name, $max_symbol_length ) = @_; + my ($desired_name, $max_symbol_length) = @_; - return $desired_name + return $desired_name unless defined $desired_name && length $desired_name > $max_symbol_length; - my $truncated_name = substr $desired_name, 0, - $max_symbol_length - COLLISION_TAG_LENGTH - 1; + my $truncated_name = substr $desired_name, 0, $max_symbol_length - COLLISION_TAG_LENGTH - 1; - # Hex isn't the most space-efficient, but it skirts around allowed - # charset issues - my $digest = sha1_hex($desired_name); - my $collision_tag = substr $digest, 0, COLLISION_TAG_LENGTH; + # Hex isn't the most space-efficient, but it skirts around allowed + # charset issues + my $digest = sha1_hex($desired_name); + my $collision_tag = substr $digest, 0, COLLISION_TAG_LENGTH; - return $truncated_name - . '_' - . $collision_tag; + return $truncated_name . '_' . $collision_tag; } - sub parse_mysql_version { - my ($v, $target) = @_; - - return undef unless $v; - - $target ||= 'perl'; - - my @vers; - - # X.Y.Z style - if ( $v =~ / ^ (\d+) \. (\d{1,3}) (?: \. (\d{1,3}) )? $ /x ) { - push @vers, $1, $2, $3; - } - - # XYYZZ (mysql) style - elsif ( $v =~ / ^ (\d) (\d{2}) (\d{2}) $ /x ) { - push @vers, $1, $2, $3; - } - - # XX.YYYZZZ (perl) style or simply X - elsif ( $v =~ / ^ (\d+) (?: \. (\d{3}) (\d{3}) )? $ /x ) { - push @vers, $1, $2, $3; - } - else { - #how do I croak sanely here? - die "Unparseable MySQL version '$v'"; - } - - if ($target eq 'perl') { - return sprintf ('%d.%03d%03d', map { $_ || 0 } (@vers) ); - } - elsif ($target eq 'mysql') { - return sprintf ('%d%02d%02d', map { $_ || 0 } (@vers) ); - } - else { - #how do I croak sanely here? - die "Unknown version target '$target'"; - } + my ($v, $target) = @_; + + return undef unless $v; + + $target ||= 'perl'; + + my @vers; + + # X.Y.Z style + if ($v =~ / ^ (\d+) \. (\d{1,3}) (?: \. (\d{1,3}) )? $ /x) { + push @vers, $1, $2, $3; + } + + # XYYZZ (mysql) style + elsif ($v =~ / ^ (\d) (\d{2}) (\d{2}) $ /x) { + push @vers, $1, $2, $3; + } + + # XX.YYYZZZ (perl) style or simply X + elsif ($v =~ / ^ (\d+) (?: \. (\d{3}) (\d{3}) )? $ /x) { + push @vers, $1, $2, $3; + } else { + #how do I croak sanely here? + die "Unparseable MySQL version '$v'"; + } + + if ($target eq 'perl') { + return sprintf('%d.%03d%03d', map { $_ || 0 } (@vers)); + } elsif ($target eq 'mysql') { + return sprintf('%d%02d%02d', map { $_ || 0 } (@vers)); + } else { + #how do I croak sanely here? + die "Unknown version target '$target'"; + } } sub parse_dbms_version { - my ($v, $target) = @_; - - return undef unless $v; - - my @vers; - - # X.Y.Z style - if ( $v =~ / ^ (\d+) \. (\d{1,3}) (?: \. (\d{1,3}) )? $ /x ) { - push @vers, $1, $2, $3; - } - - # XX.YYYZZZ (perl) style or simply X - elsif ( $v =~ / ^ (\d+) (?: \. (\d{3}) (\d{3}) )? $ /x ) { - push @vers, $1, $2, $3; - } - else { - #how do I croak sanely here? - die "Unparseable database server version '$v'"; - } - - if ($target eq 'perl') { - return sprintf ('%d.%03d%03d', map { $_ || 0 } (@vers) ); - } - elsif ($target eq 'native') { - return join '.' => grep defined, @vers; - } - else { - #how do I croak sanely here? - die "Unknown version target '$target'"; - } + my ($v, $target) = @_; + + return undef unless $v; + + my @vers; + + # X.Y.Z style + if ($v =~ / ^ (\d+) \. (\d{1,3}) (?: \. (\d{1,3}) )? $ /x) { + push @vers, $1, $2, $3; + } + + # XX.YYYZZZ (perl) style or simply X + elsif ($v =~ / ^ (\d+) (?: \. (\d{3}) (\d{3}) )? $ /x) { + push @vers, $1, $2, $3; + } else { + #how do I croak sanely here? + die "Unparseable database server version '$v'"; + } + + if ($target eq 'perl') { + return sprintf('%d.%03d%03d', map { $_ || 0 } (@vers)); + } elsif ($target eq 'native') { + return join '.' => grep defined, @vers; + } else { + #how do I croak sanely here? + die "Unknown version target '$target'"; + } } #my ($parsers_libdir, $checkout_dir); sub ddl_parser_instance { - my $type = shift; + my $type = shift; - # it may differ from our caller, even though currently this is not the case - eval "require SQL::Translator::Parser::$type" - or die "Unable to load grammar-spec container SQL::Translator::Parser::$type:\n$@"; + # it may differ from our caller, even though currently this is not the case + eval "require SQL::Translator::Parser::$type" + or die "Unable to load grammar-spec container SQL::Translator::Parser::$type:\n$@"; - # handle DB2 in a special way, since the grammar source was lost :( - if ($type eq 'DB2') { - require SQL::Translator::Parser::DB2::Grammar; - return SQL::Translator::Parser::DB2::Grammar->new; - } + # handle DB2 in a special way, since the grammar source was lost :( + if ($type eq 'DB2') { + require SQL::Translator::Parser::DB2::Grammar; + return SQL::Translator::Parser::DB2::Grammar->new; + } - require Parse::RecDescent; - return Parse::RecDescent->new(do { - no strict 'refs'; - ${"SQL::Translator::Parser::${type}::GRAMMAR"} - || die "No \$SQL::Translator::Parser::${type}::GRAMMAR defined, unable to instantiate PRD parser\n" - }); + require Parse::RecDescent; + return Parse::RecDescent->new(do { + no strict 'refs'; + ${"SQL::Translator::Parser::${type}::GRAMMAR"} + || die "No \$SQL::Translator::Parser::${type}::GRAMMAR defined, unable to instantiate PRD parser\n"; + }); -# this is disabled until RT#74593 is resolved + # this is disabled until RT#74593 is resolved =begin sadness @@ -335,94 +325,89 @@ sub ddl_parser_instance { # or return undef sub _find_co_root { - my @mod_parts = split /::/, (__PACKAGE__ . '.pm'); - my $rel_path = join ('/', @mod_parts); # %INC stores paths with / regardless of OS + my @mod_parts = split /::/, (__PACKAGE__ . '.pm'); + my $rel_path = join('/', @mod_parts); # %INC stores paths with / regardless of OS - return undef unless ($INC{$rel_path}); + return undef unless ($INC{$rel_path}); - # a bit convoluted, but what we do here essentially is: - # - get the file name of this particular module - # - do 'cd ..' as many times as necessary to get to lib/SQL/Translator/../../.. +# a bit convoluted, but what we do here essentially is: +# - get the file name of this particular module +# - do 'cd ..' as many times as necessary to get to lib/SQL/Translator/../../.. - my $root = (File::Spec::Unix->splitpath($INC{$rel_path}))[1]; - for (1 .. @mod_parts) { - $root = File::Spec->catdir($root, File::Spec->updir); - } + my $root = (File::Spec::Unix->splitpath($INC{$rel_path}))[1]; + for (1 .. @mod_parts) { + $root = File::Spec->catdir($root, File::Spec->updir); + } - return ( -f File::Spec->catfile($root, 'Makefile.PL') ) - ? $root - : undef - ; + return (-f File::Spec->catfile($root, 'Makefile.PL')) + ? $root + : undef; } { - package SQL::Translator::Utils::Error; - use overload - '""' => sub { ${$_[0]} }, - fallback => 1; + package SQL::Translator::Utils::Error; - sub new { - my ($class, $msg) = @_; - bless \$msg, $class; - } + use overload + '""' => sub { ${ $_[0] } }, + fallback => 1; + + sub new { + my ($class, $msg) = @_; + bless \$msg, $class; + } } sub uniq { - my( %seen, $seen_undef, $numeric_preserving_copy ); - grep { not ( - defined $_ - ? $seen{ $numeric_preserving_copy = $_ }++ - : $seen_undef++ - ) } @_; + my (%seen, $seen_undef, $numeric_preserving_copy); + grep { not(defined $_ ? $seen{ $numeric_preserving_copy = $_ }++ : $seen_undef++) } @_; } sub throw { - die SQL::Translator::Utils::Error->new($_[0]); + die SQL::Translator::Utils::Error->new($_[0]); } sub ex2err { - my ($orig, $self, @args) = @_; - return try { - $self->$orig(@args); - } catch { - die $_ unless blessed($_) && $_->isa("SQL::Translator::Utils::Error"); - $self->error("$_"); - }; + my ($orig, $self, @args) = @_; + return try { + $self->$orig(@args); + } catch { + die $_ unless blessed($_) && $_->isa("SQL::Translator::Utils::Error"); + $self->error("$_"); + }; } sub carp_ro { - my ($name) = @_; - return sub { - my ($orig, $self) = (shift, shift); - carp "'$name' is a read-only accessor" if @_; - return $self->$orig; - }; + my ($name) = @_; + return sub { + my ($orig, $self) = (shift, shift); + carp "'$name' is a read-only accessor" if @_; + return $self->$orig; + }; } sub batch_alter_table_statements { - my ($diff_hash, $options, @meths) = @_; - - @meths = qw( - rename_table - alter_drop_constraint - alter_drop_index - drop_field - add_field - alter_field - rename_field - alter_create_index - alter_create_constraint - alter_table - ) unless @meths; - - my $package = caller; - - return map { - my $meth = $package->can($_) or die "$package cant $_"; - map { $meth->(ref $_ eq 'ARRAY' ? @$_ : $_, $options) } @{ $diff_hash->{$_} } - } grep { @{$diff_hash->{$_} || []} } - @meths; + my ($diff_hash, $options, @meths) = @_; + + @meths = qw( + rename_table + alter_drop_constraint + alter_drop_index + drop_field + add_field + alter_field + rename_field + alter_create_index + alter_create_constraint + alter_table + ) unless @meths; + + my $package = caller; + + return map { + my $meth = $package->can($_) or die "$package cant $_"; + map { $meth->(ref $_ eq 'ARRAY' ? @$_ : $_, $options) } @{ $diff_hash->{$_} } + } grep { @{ $diff_hash->{$_} || [] } } @meths; } 1; diff --git a/lib/Test/SQL/Translator.pm b/lib/Test/SQL/Translator.pm index acacf9583..f76e9c166 100644 --- a/lib/Test/SQL/Translator.pm +++ b/lib/Test/SQL/Translator.pm @@ -16,429 +16,427 @@ use SQL::Translator::Schema::Constants; use base qw(Exporter); our @EXPORT_OK; our $VERSION = '1.64'; -our @EXPORT = qw( - schema_ok - table_ok - field_ok - constraint_ok - index_ok - view_ok - trigger_ok - procedure_ok - maybe_plan +our @EXPORT = qw( + schema_ok + table_ok + field_ok + constraint_ok + index_ok + view_ok + trigger_ok + procedure_ok + maybe_plan ); # $ATTRIBUTES{ } = { => , ... } my %ATTRIBUTES = ( - field => { - name => undef, - data_type => '', - default_value => undef, - size => '0', - is_primary_key => 0, - is_unique => 0, - is_nullable => 1, - is_foreign_key => 0, - is_auto_increment => 0, - comments => '', - extra => {}, - # foreign_key_reference, - is_valid => 1, - # order - }, - constraint => { - name => '', - type => '', - deferrable => 1, - expression => '', - is_valid => 1, - fields => [], - match_type => '', - options => [], - on_delete => '', - on_update => '', - reference_fields => [], - reference_table => '', - extra => {}, - }, - index => { - fields => [], - is_valid => 1, - name => "", - options => [], - type => NORMAL, - extra => {}, - }, - view => { - name => "", - sql => "", - fields => [], - is_valid => 1, - extra => {}, - }, - trigger => { - name => '', - perform_action_when => undef, - database_events => undef, - on_table => undef, - action => undef, - is_valid => 1, - extra => {}, - }, - procedure => { - name => '', - sql => '', - parameters => [], - owner => '', - comments => '', - extra => {}, - }, - table => { - comments => undef, - name => '', - #primary_key => undef, # pkey constraint - options => [], - #order => 0, - fields => undef, - constraints => undef, - indices => undef, - is_valid => 1, - extra => {}, - }, - schema => { - name => '', - database => '', - procedures => undef, # [] when set - tables => undef, # [] when set - triggers => undef, # [] when set - views => undef, # [] when set - is_valid => 1, - extra => {}, - } + field => { + name => undef, + data_type => '', + default_value => undef, + size => '0', + is_primary_key => 0, + is_unique => 0, + is_nullable => 1, + is_foreign_key => 0, + is_auto_increment => 0, + comments => '', + extra => {}, + + # foreign_key_reference, + is_valid => 1, + + # order + }, + constraint => { + name => '', + type => '', + deferrable => 1, + expression => '', + is_valid => 1, + fields => [], + match_type => '', + options => [], + on_delete => '', + on_update => '', + reference_fields => [], + reference_table => '', + extra => {}, + }, + index => { + fields => [], + is_valid => 1, + name => "", + options => [], + type => NORMAL, + extra => {}, + }, + view => { + name => "", + sql => "", + fields => [], + is_valid => 1, + extra => {}, + }, + trigger => { + name => '', + perform_action_when => undef, + database_events => undef, + on_table => undef, + action => undef, + is_valid => 1, + extra => {}, + }, + procedure => { + name => '', + sql => '', + parameters => [], + owner => '', + comments => '', + extra => {}, + }, + table => { + comments => undef, + name => '', + + #primary_key => undef, # pkey constraint + options => [], + + #order => 0, + fields => undef, + constraints => undef, + indices => undef, + is_valid => 1, + extra => {}, + }, + schema => { + name => '', + database => '', + procedures => undef, # [] when set + tables => undef, # [] when set + triggers => undef, # [] when set + views => undef, # [] when set + is_valid => 1, + extra => {}, + } ); # Given a test hash and schema object name set any attribute keys not present in # the test hash to their default value for that schema object type. # e.g. default_attribs( $test, "field" ); sub default_attribs { - my ($hashref, $object_type) = @_; + my ($hashref, $object_type) = @_; - if ( !exists $ATTRIBUTES{ $object_type } ) { - die "Can't add default attribs for unknown Schema " - . "object type '$object_type'."; - } + if (!exists $ATTRIBUTES{$object_type}) { + die "Can't add default attribs for unknown Schema " . "object type '$object_type'."; + } - for my $attr ( - grep { !exists $hashref->{ $_ } } - keys %{ $ATTRIBUTES{ $object_type } } - ) { - $hashref->{ $attr } = $ATTRIBUTES{ $object_type }{ $attr } - } + for my $attr ( + grep { !exists $hashref->{$_} } + keys %{ $ATTRIBUTES{$object_type} } + ) { + $hashref->{$attr} = $ATTRIBUTES{$object_type}{$attr}; + } - return $hashref; + return $hashref; } # Format test name so it will prepend the test names used below. sub t_name { - my $name = shift; - $name ||= ""; - $name = "$name - " if $name; - return $name; + my $name = shift; + $name ||= ""; + $name = "$name - " if $name; + return $name; } sub field_ok { - my ($f1,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"field"); - - unless ($f1) { - fail " Field '$test->{name}' doesn't exist!"; - # TODO Do a skip on the following tests. Currently the test counts wont - # match at the end. So at least it fails. - return; - } + my ($f1, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "field"); + + unless ($f1) { + fail " Field '$test->{name}' doesn't exist!"; + + # TODO Do a skip on the following tests. Currently the test counts wont + # match at the end. So at least it fails. + return; + } - my $full_name = $f1->table->name.".".$test->{name}; + my $full_name = $f1->table->name . "." . $test->{name}; - is( $f1->name, $test->{name}, "${t_name}Field '$full_name'" ); + is($f1->name, $test->{name}, "${t_name}Field '$full_name'"); - is( $f1->is_valid, $test->{is_valid}, - "$t_name is ".($test->{is_valid} ? '' : 'not ').'valid' ); + is($f1->is_valid, $test->{is_valid}, "$t_name is " . ($test->{is_valid} ? '' : 'not ') . 'valid'); - is( $f1->data_type, $test->{data_type}, - "$t_name type is '$test->{data_type}'" ); + is($f1->data_type, $test->{data_type}, "$t_name type is '$test->{data_type}'"); - is( $f1->size, $test->{size}, "$t_name size is '$test->{size}'" ); + is($f1->size, $test->{size}, "$t_name size is '$test->{size}'"); - is( $f1->default_value, $test->{default_value}, + is( + $f1->default_value, + $test->{default_value}, "$t_name default value is " - .(defined($test->{default_value}) ? "'$test->{default_value}'" : "UNDEF" ) - ); + . ( + defined($test->{default_value}) + ? "'$test->{default_value}'" + : "UNDEF" + ) + ); - is( $f1->is_nullable, $test->{is_nullable}, - "$t_name ".($test->{is_nullable} ? 'can' : 'cannot').' be null' ); + is($f1->is_nullable, $test->{is_nullable}, "$t_name " . ($test->{is_nullable} ? 'can' : 'cannot') . ' be null'); - is( $f1->is_unique, $test->{is_unique}, - "$t_name ".($test->{is_unique} ? 'can' : 'cannot').' be unique' ); + is($f1->is_unique, $test->{is_unique}, "$t_name " . ($test->{is_unique} ? 'can' : 'cannot') . ' be unique'); - is( $f1->is_primary_key, $test->{is_primary_key}, - "$t_name is ".($test->{is_primary_key} ? '' : 'not ').'a primary_key' ); + is( + $f1->is_primary_key, + $test->{is_primary_key}, + "$t_name is " . ($test->{is_primary_key} ? '' : 'not ') . 'a primary_key' + ); - is( $f1->is_foreign_key, $test->{is_foreign_key}, - "$t_name is ".($test->{is_foreign_key} ? '' : 'not').' a foreign_key' ); + is( + $f1->is_foreign_key, + $test->{is_foreign_key}, + "$t_name is " . ($test->{is_foreign_key} ? '' : 'not') . ' a foreign_key' + ); - is( $f1->is_auto_increment, $test->{is_auto_increment}, - "$t_name is " - .($test->{is_auto_increment} ? '' : 'not ').'an auto_increment' ); + is( + $f1->is_auto_increment, + $test->{is_auto_increment}, + "$t_name is " . ($test->{is_auto_increment} ? '' : 'not ') . 'an auto_increment' + ); - is( $f1->comments, $test->{comments}, "$t_name comments" ); + is($f1->comments, $test->{comments}, "$t_name comments"); - is_deeply( { $f1->extra }, $test->{extra}, "$t_name extra" ); + is_deeply({ $f1->extra }, $test->{extra}, "$t_name extra"); } sub constraint_ok { - my ($obj,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"constraint"); + my ($obj, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "constraint"); - is( $obj->name, $test->{name}, "${t_name}Constraint '$test->{name}'" ); + is($obj->name, $test->{name}, "${t_name}Constraint '$test->{name}'"); - is( $obj->type, $test->{type}, "$t_name type is '$test->{type}'" ); + is($obj->type, $test->{type}, "$t_name type is '$test->{type}'"); - is( $obj->deferrable, $test->{deferrable}, - "$t_name ".($test->{deferrable} ? 'can' : 'cannot').' be deferred' ); + is($obj->deferrable, $test->{deferrable}, "$t_name " . ($test->{deferrable} ? 'can' : 'cannot') . ' be deferred'); - is( $obj->is_valid, $test->{is_valid}, - "$t_name is ".($test->{is_valid} ? '' : 'not ').'valid' ); + is($obj->is_valid, $test->{is_valid}, "$t_name is " . ($test->{is_valid} ? '' : 'not ') . 'valid'); - is($obj->table->name,$test->{table},"$t_name table is '$test->{table}'" ); + is($obj->table->name, $test->{table}, "$t_name table is '$test->{table}'"); - is( $obj->expression, $test->{expression}, - "$t_name expression is '$test->{expression}'" ); + is($obj->expression, $test->{expression}, "$t_name expression is '$test->{expression}'"); - is_deeply( [$obj->fields], $test->{fields}, - "$t_name fields are '".join(",",@{$test->{fields}})."'" ); + is_deeply([ $obj->fields ], $test->{fields}, "$t_name fields are '" . join(",", @{ $test->{fields} }) . "'"); - is( $obj->reference_table, $test->{reference_table}, - "$t_name reference_table is '$test->{reference_table}'" ); + is($obj->reference_table, $test->{reference_table}, "$t_name reference_table is '$test->{reference_table}'"); - is_deeply( [$obj->reference_fields], $test->{reference_fields}, - "$t_name reference_fields are '".join(",",@{$test->{reference_fields}})."'" ); + is_deeply( + [ $obj->reference_fields ], + $test->{reference_fields}, + "$t_name reference_fields are '" . join(",", @{ $test->{reference_fields} }) . "'" + ); - is( $obj->match_type, $test->{match_type}, - "$t_name match_type is '$test->{match_type}'" ); + is($obj->match_type, $test->{match_type}, "$t_name match_type is '$test->{match_type}'"); - is( $obj->on_delete, $test->{on_delete}, - "$t_name on_delete is '$test->{on_delete}'" ); + is($obj->on_delete, $test->{on_delete}, "$t_name on_delete is '$test->{on_delete}'"); - is( $obj->on_update, $test->{on_update}, - "$t_name on_update is '$test->{on_update}'" ); + is($obj->on_update, $test->{on_update}, "$t_name on_update is '$test->{on_update}'"); - is_deeply( [$obj->options], $test->{options}, - "$t_name options are '".join(",",@{$test->{options}})."'" ); + is_deeply([ $obj->options ], $test->{options}, "$t_name options are '" . join(",", @{ $test->{options} }) . "'"); - is_deeply( { $obj->extra }, $test->{extra}, "$t_name extra" ); + is_deeply({ $obj->extra }, $test->{extra}, "$t_name extra"); } sub index_ok { - my ($obj,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"index"); + my ($obj, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "index"); - is( $obj->name, $test->{name}, "${t_name}Index '$test->{name}'" ); + is($obj->name, $test->{name}, "${t_name}Index '$test->{name}'"); - is( $obj->is_valid, $test->{is_valid}, - "$t_name is ".($test->{is_valid} ? '' : 'not ').'valid' ); + is($obj->is_valid, $test->{is_valid}, "$t_name is " . ($test->{is_valid} ? '' : 'not ') . 'valid'); - is( $obj->type, $test->{type}, "$t_name type is '$test->{type}'" ); + is($obj->type, $test->{type}, "$t_name type is '$test->{type}'"); - is_deeply( [$obj->fields], $test->{fields}, - "$t_name fields are '".join(",",@{$test->{fields}})."'" ); + is_deeply([ $obj->fields ], $test->{fields}, "$t_name fields are '" . join(",", @{ $test->{fields} }) . "'"); - is_deeply( [$obj->options], $test->{options}, - "$t_name options are '".join(",",@{$test->{options}})."'" ); + is_deeply([ $obj->options ], $test->{options}, "$t_name options are '" . join(",", @{ $test->{options} }) . "'"); - is_deeply( { $obj->extra }, $test->{extra}, "$t_name extra" ); + is_deeply({ $obj->extra }, $test->{extra}, "$t_name extra"); } sub trigger_ok { - my ($obj,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"index"); + my ($obj, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "index"); - is( $obj->name, $test->{name}, "${t_name}Trigger '$test->{name}'" ); + is($obj->name, $test->{name}, "${t_name}Trigger '$test->{name}'"); - is( $obj->is_valid, $test->{is_valid}, - "$t_name is ".($test->{is_valid} ? '' : 'not ').'valid' ); + is($obj->is_valid, $test->{is_valid}, "$t_name is " . ($test->{is_valid} ? '' : 'not ') . 'valid'); - is( $obj->perform_action_when, $test->{perform_action_when}, - "$t_name perform_action_when is '$test->{perform_action_when}'" ); + is( + $obj->perform_action_when, + $test->{perform_action_when}, + "$t_name perform_action_when is '$test->{perform_action_when}'" + ); - is( join(',', $obj->database_events), $test->{database_events}, - sprintf("%s database_events is '%s'", - $t_name, - $test->{'database_events'}, - ) - ); + is( + join(',', $obj->database_events), + $test->{database_events}, + sprintf("%s database_events is '%s'", $t_name, $test->{'database_events'},) + ); - is( $obj->on_table, $test->{on_table}, - "$t_name on_table is '$test->{on_table}'" ); + is($obj->on_table, $test->{on_table}, "$t_name on_table is '$test->{on_table}'"); - is( $obj->scope, $test->{scope}, "$t_name scope is '$test->{scope}'" ) - if exists $test->{scope}; + is($obj->scope, $test->{scope}, "$t_name scope is '$test->{scope}'") + if exists $test->{scope}; - is( $obj->action, $test->{action}, "$t_name action is '$test->{action}'" ); + is($obj->action, $test->{action}, "$t_name action is '$test->{action}'"); - is_deeply( { $obj->extra }, $test->{extra}, "$t_name extra" ); + is_deeply({ $obj->extra }, $test->{extra}, "$t_name extra"); } sub view_ok { - my ($obj,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"index"); + my ($obj, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "index"); - #isa_ok( $v, 'SQL::Translator::Schema::View', 'View' ); + #isa_ok( $v, 'SQL::Translator::Schema::View', 'View' ); - is( $obj->name, $test->{name}, "${t_name}View '$test->{name}'" ); + is($obj->name, $test->{name}, "${t_name}View '$test->{name}'"); - is( $obj->is_valid, $test->{is_valid}, - "$t_name is ".($test->{is_valid} ? '' : 'not ').'valid' ); + is($obj->is_valid, $test->{is_valid}, "$t_name is " . ($test->{is_valid} ? '' : 'not ') . 'valid'); - is( $obj->sql, $test->{sql}, "$t_name sql is '$test->{sql}'" ); + is($obj->sql, $test->{sql}, "$t_name sql is '$test->{sql}'"); - is_deeply( [$obj->fields], $test->{fields}, - "$t_name fields are '".join(",",@{$test->{fields}})."'" ); + is_deeply([ $obj->fields ], $test->{fields}, "$t_name fields are '" . join(",", @{ $test->{fields} }) . "'"); - is_deeply( { $obj->extra }, $test->{extra}, "$t_name extra" ); + is_deeply({ $obj->extra }, $test->{extra}, "$t_name extra"); } sub procedure_ok { - my ($obj,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"index"); + my ($obj, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "index"); - #isa_ok( $v, 'SQL::Translator::Schema::View', 'View' ); + #isa_ok( $v, 'SQL::Translator::Schema::View', 'View' ); - is( $obj->name, $test->{name}, "${t_name}Procedure '$test->{name}'" ); + is($obj->name, $test->{name}, "${t_name}Procedure '$test->{name}'"); - is( $obj->sql, $test->{sql}, "$t_name sql is '$test->{sql}'" ); + is($obj->sql, $test->{sql}, "$t_name sql is '$test->{sql}'"); - is_deeply( [$obj->parameters], $test->{parameters}, - "$t_name parameters are '".join(",",@{$test->{parameters}})."'" ); + is_deeply([ $obj->parameters ], + $test->{parameters}, "$t_name parameters are '" . join(",", @{ $test->{parameters} }) . "'"); - is( $obj->comments, $test->{comments}, - "$t_name comments is '$test->{comments}'" ); + is($obj->comments, $test->{comments}, "$t_name comments is '$test->{comments}'"); - is( $obj->owner, $test->{owner}, "$t_name owner is '$test->{owner}'" ); + is($obj->owner, $test->{owner}, "$t_name owner is '$test->{owner}'"); - is_deeply( { $obj->extra }, $test->{extra}, "$t_name extra" ); + is_deeply({ $obj->extra }, $test->{extra}, "$t_name extra"); } sub table_ok { - my ($obj,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"table"); - my %arg = %$test; - - my $tbl_name = $arg{name} || die "Need a table name to test."; - is( $obj->{name}, $arg{name}, "${t_name}Table '$arg{name}'" ); - - is_deeply( [$obj->options], $test->{options}, - "$t_name options are '".join(",",@{$test->{options}})."'" ); - - is_deeply( { $obj->extra }, $test->{extra}, "$t_name extra" ); - - # Fields - if ( $arg{fields} ) { - my @fldnames = map {$_->{name}} @{$arg{fields}}; - is_deeply( - [ map {$_->name} $obj->get_fields ], - [ @fldnames ], - "${t_name} field names are ".join(", ",@fldnames) - ); - foreach ( @{$arg{fields}} ) { - my $f_name = $_->{name} || die "Need a field name to test."; - next unless my $fld = $obj->get_field($f_name); - field_ok( $fld, $_, $name ); - } + my ($obj, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "table"); + my %arg = %$test; + + my $tbl_name = $arg{name} || die "Need a table name to test."; + is($obj->{name}, $arg{name}, "${t_name}Table '$arg{name}'"); + + is_deeply([ $obj->options ], $test->{options}, "$t_name options are '" . join(",", @{ $test->{options} }) . "'"); + + is_deeply({ $obj->extra }, $test->{extra}, "$t_name extra"); + + # Fields + if ($arg{fields}) { + my @fldnames = map { $_->{name} } @{ $arg{fields} }; + is_deeply([ map { $_->name } $obj->get_fields ], + [@fldnames], "${t_name} field names are " . join(", ", @fldnames)); + foreach (@{ $arg{fields} }) { + my $f_name = $_->{name} || die "Need a field name to test."; + next unless my $fld = $obj->get_field($f_name); + field_ok($fld, $_, $name); } - else { - is(scalar($obj->get_fields), undef, - "${t_name} has no fields."); + } else { + is(scalar($obj->get_fields), undef, "${t_name} has no fields."); + } + + # Constraints and Indices + _test_kids( + $obj, $test, $name, + { + constraint => 'constraints', + index => 'indices', } - - # Constraints and Indices - _test_kids($obj, $test, $name, { - constraint => 'constraints', - index => 'indices', - }); + ); } sub _test_kids { - my ( $obj, $test, $name, $kids ) = @_; - my $t_name = t_name($name); - my $obj_name = ref $obj; - ($obj_name) = $obj_name =~ m/^.*::(.*)$/; - - while ( my ( $object_type, $plural ) = each %$kids ) { - next unless defined $test->{ $plural }; - - if ( my @tests = @{ $test->{ $plural } } ) { - my $meth = "get_$plural"; - my @objects = $obj->$meth; - is( scalar(@objects), scalar(@tests), - "${t_name}$obj_name has " . scalar(@tests) . " $plural" - ); - - for my $object (@objects) { - my $ans = { lc($obj_name) => $obj->name, %{ shift @tests } }; - - my $meth = "${object_type}_ok"; - { - no strict 'refs'; - $meth->( $object, $ans, $name ); - } - } + my ($obj, $test, $name, $kids) = @_; + my $t_name = t_name($name); + my $obj_name = ref $obj; + ($obj_name) = $obj_name =~ m/^.*::(.*)$/; + + while (my ($object_type, $plural) = each %$kids) { + next unless defined $test->{$plural}; + + if (my @tests = @{ $test->{$plural} }) { + my $meth = "get_$plural"; + my @objects = $obj->$meth; + is(scalar(@objects), scalar(@tests), "${t_name}$obj_name has " . scalar(@tests) . " $plural"); + + for my $object (@objects) { + my $ans = { lc($obj_name) => $obj->name, %{ shift @tests } }; + + my $meth = "${object_type}_ok"; + { + no strict 'refs'; + $meth->($object, $ans, $name); } + } } + } } sub schema_ok { - my ($obj,$test,$name) = @_; - my $t_name = t_name($name); - default_attribs($test,"schema"); + my ($obj, $test, $name) = @_; + my $t_name = t_name($name); + default_attribs($test, "schema"); - is( $obj->name, $test->{name}, "${t_name}Schema name is '$test->{name}'" ); + is($obj->name, $test->{name}, "${t_name}Schema name is '$test->{name}'"); - is( $obj->database, $test->{database}, - "$t_name database is '$test->{database}'" ); + is($obj->database, $test->{database}, "$t_name database is '$test->{database}'"); - is_deeply( { $obj->extra }, $test->{extra}, "$t_name extra" ); + is_deeply({ $obj->extra }, $test->{extra}, "$t_name extra"); - is( $obj->is_valid, $test->{is_valid}, - "$t_name is ".($test->{is_valid} ? '' : 'not ').'valid' ); + is($obj->is_valid, $test->{is_valid}, "$t_name is " . ($test->{is_valid} ? '' : 'not ') . 'valid'); - # Tables - if ( $test->{tables} ) { - is_deeply( [ map {$_->name} $obj->get_tables ], - [ map {$_->{name}} @{$test->{tables}} ], - "${t_name} table names match" ); - foreach ( @{$test->{tables}} ) { - my $t_name = $_->{name} || die "Need a table name to test."; - table_ok( $obj->get_table($t_name), $_, $name ); - } + # Tables + if ($test->{tables}) { + is_deeply( + [ map { $_->name } $obj->get_tables ], + [ map { $_->{name} } @{ $test->{tables} } ], + "${t_name} table names match" + ); + foreach (@{ $test->{tables} }) { + my $t_name = $_->{name} || die "Need a table name to test."; + table_ok($obj->get_table($t_name), $_, $name); } - else { - is(scalar($obj->get_tables), undef, - "${t_name} has no tables."); + } else { + is(scalar($obj->get_tables), undef, "${t_name} has no tables."); + } + + # Procedures, Triggers, Views + _test_kids( + $obj, $test, $name, + { + procedure => 'procedures', + trigger => 'triggers', + view => 'views', } - - # Procedures, Triggers, Views - _test_kids($obj, $test, $name, { - procedure => 'procedures', - trigger => 'triggers', - view => 'views', - }); + ); } # maybe_plan($ntests, @modules) @@ -446,48 +444,42 @@ sub schema_ok { # Calls plan $ntests if @modules can all be loaded; otherwise, # calls skip_all with an explanation of why the tests were skipped. sub maybe_plan { - my ($ntests, @modules) = @_; - my @errors; - - for my $module (@modules) { - eval "use $module;"; - next if !$@; - - if ($@ =~ /Can't locate (\S+)/) { - my $mod = $1; - $mod =~ s/\.pm$//; - $mod =~ s#/#::#g; - push @errors, $mod; - } - elsif ($@ =~ /([\w\:]+ version [\d\.]+) required.+?this is only version/) { - push @errors, $1; - } - elsif ($@ =~ /Can't load .+? for module .+?DynaLoader\.pm/i ) { - push @errors, $module; - } - else { - (my $err = $@) =~ s/\n+/\\n/g; # Can't have newlines in the skip message - push @errors, "$module: $err"; - } - } - - if (@errors) { - my $msg = sprintf "Missing dependenc%s: %s", - @errors == 1 ? 'y' : 'ies', - join ", ", @errors; - plan skip_all => $msg; - } - return unless defined $ntests; - - if ($ntests ne 'no_plan') { - plan tests => $ntests; - } - else { - plan 'no_plan'; + my ($ntests, @modules) = @_; + my @errors; + + for my $module (@modules) { + eval "use $module;"; + next if !$@; + + if ($@ =~ /Can't locate (\S+)/) { + my $mod = $1; + $mod =~ s/\.pm$//; + $mod =~ s#/#::#g; + push @errors, $mod; + } elsif ($@ =~ /([\w\:]+ version [\d\.]+) required.+?this is only version/) { + push @errors, $1; + } elsif ($@ =~ /Can't load .+? for module .+?DynaLoader\.pm/i) { + push @errors, $module; + } else { + (my $err = $@) =~ s/\n+/\\n/g; # Can't have newlines in the skip message + push @errors, "$module: $err"; } + } + + if (@errors) { + my $msg = sprintf "Missing dependenc%s: %s", @errors == 1 ? 'y' : 'ies', join ", ", @errors; + plan skip_all => $msg; + } + return unless defined $ntests; + + if ($ntests ne 'no_plan') { + plan tests => $ntests; + } else { + plan 'no_plan'; + } } -1; # compile please =========================================================== +1; # compile please =========================================================== __END__ =pod diff --git a/script/sqlt b/script/sqlt index 63bdccf99..1c4af2f9b 100755 --- a/script/sqlt +++ b/script/sqlt @@ -155,205 +155,201 @@ use SQL::Translator; use vars qw( $VERSION ); $VERSION = '1.64'; -my $from; # the original database -my $to; # the destination database -my $help; # show POD and bail -my $stdin; # whether to read STDIN for create script -my $no_comments; # whether to put comments in out file -my $show_warnings; # whether to show warnings from SQL::Translator -my $add_drop_table; # whether to add "DROP table" statements -my $quote_table_names; # whether to quote table names -my $quote_field_names; # whether to quote field names -my $debug; # whether to print debug info -my $trace; # whether to print parser trace -my $list; # list all parsers and producers -my $no_trim; # don't trim whitespace on xSV fields -my $no_scan; # don't scan xSV fields for data types and sizes -my $field_separator; # for xSV files -my $record_separator; # for xSV files -my $validate; # whether to validate the parsed document -my $imap_file; # filename where to place image map coords -my $imap_url; # URL to use in making image map -my $pretty; # use CGI::Pretty instead of CGI (HTML producer) -my $template; # template to pass to TTSchema producer -my %tt_vars; # additional template vars to pass the TTSchema producer -my %tt_conf; # additional template conf to pass the TTSchema producer -my $title; # title for HTML/POD producer -my $add_prefix; # Use explicit namespace prefix (XML producer) -my $prefix; # Set explicit namespace prefix (XML producer) -my $newlines; # Add newlines around tags (XML producer) -my $indent; # Number of indent chars for XML -my $package_name; # Base class name for ClassDBI -my $use_same_auth =0; # producer uses same DSN, user, password as parser -my $dsn; # DBI parser -my $db_user; # DBI parser -my $db_password; # DBI parser -my $show_version; # Show version and exit script +my $from; # the original database +my $to; # the destination database +my $help; # show POD and bail +my $stdin; # whether to read STDIN for create script +my $no_comments; # whether to put comments in out file +my $show_warnings; # whether to show warnings from SQL::Translator +my $add_drop_table; # whether to add "DROP table" statements +my $quote_table_names; # whether to quote table names +my $quote_field_names; # whether to quote field names +my $debug; # whether to print debug info +my $trace; # whether to print parser trace +my $list; # list all parsers and producers +my $no_trim; # don't trim whitespace on xSV fields +my $no_scan; # don't scan xSV fields for data types and sizes +my $field_separator; # for xSV files +my $record_separator; # for xSV files +my $validate; # whether to validate the parsed document +my $imap_file; # filename where to place image map coords +my $imap_url; # URL to use in making image map +my $pretty; # use CGI::Pretty instead of CGI (HTML producer) +my $template; # template to pass to TTSchema producer +my %tt_vars; # additional template vars to pass the TTSchema producer +my %tt_conf; # additional template conf to pass the TTSchema producer +my $title; # title for HTML/POD producer +my $add_prefix; # Use explicit namespace prefix (XML producer) +my $prefix; # Set explicit namespace prefix (XML producer) +my $newlines; # Add newlines around tags (XML producer) +my $indent; # Number of indent chars for XML +my $package_name; # Base class name for ClassDBI +my $use_same_auth = 0; # producer uses same DSN, user, password as parser +my $dsn; # DBI parser +my $db_user; # DBI parser +my $db_password; # DBI parser +my $show_version; # Show version and exit script my $skip; my $skiplike; my $ignore_opts; -my $producer_db_user; # DSN for producer (e.g. Dumper, ClassDBI) -my $producer_db_password; # db_pass " -my $producer_dsn; # db_user " +my $producer_db_user; # DSN for producer (e.g. Dumper, ClassDBI) +my $producer_db_password; # db_pass " +my $producer_dsn; # db_user " my $add_truncate; -my $mysql_parser_version; # MySQL parser arg for /*! comments -my $postgres_version; # PostgreSQL version -my $mysql_version; # MySQL version +my $mysql_parser_version; # MySQL parser arg for /*! comments +my $postgres_version; # PostgreSQL version +my $mysql_version; # MySQL version GetOptions( - 'add-drop-table' => \$add_drop_table, - 'quote-table-names|quote_table_names' => \$quote_table_names, - 'quote-field-names|quote_field_names' => \$quote_field_names, - 'd|debug' => \$debug, - 'f|from|parser:s' => \$from, - 'fs:s' => \$field_separator, - 'h|help' => \$help, - 'imap-file:s' => \$imap_file, - 'imap-url:s' => \$imap_url, - 't|to|producer:s' => \$to, - 'l|list' => \$list, - 'pretty!' => \$pretty, - 'no-comments' => \$no_comments, - 'no-scan' => \$no_scan, - 'no-trim' => \$no_trim, - 'rs:s' => \$record_separator, - 'show-warnings' => \$show_warnings, - 'template:s' => \$template, - 'tt-var=s' => \%tt_vars, - 'tt-conf=s' => \%tt_conf, - 'title:s' => \$title, - 'trace' => \$trace, - 'v|validate' => \$validate, - 'dsn:s' => \$dsn, - 'db-user:s' => \$db_user, - 'db-password:s' => \$db_password, - 'producer-dsn:s' => \$producer_dsn, - 'producer-db-user:s'=> \$producer_db_user, - 'producer-db-pass:s'=> \$producer_db_password, - 'skip:s' => \$skip, - 'skiplike:s' => \$skiplike, - 'ignore_opts:s' => \$ignore_opts, - 'add_truncate' => \$add_truncate, - 'add-prefix' => \$add_prefix, - 'prefix:s' => \$prefix, - 'indent:s' => \$indent, - 'newlines!' => \$newlines, - 'package=s' => \$package_name, - 'use-same-auth' => \$use_same_auth, - 'version' => \$show_version, - 'mysql-parser-version=i' => \$mysql_parser_version, - 'postgres-version=f' => \$postgres_version, - 'mysql-version=f' => \$mysql_version, + 'add-drop-table' => \$add_drop_table, + 'quote-table-names|quote_table_names' => \$quote_table_names, + 'quote-field-names|quote_field_names' => \$quote_field_names, + 'd|debug' => \$debug, + 'f|from|parser:s' => \$from, + 'fs:s' => \$field_separator, + 'h|help' => \$help, + 'imap-file:s' => \$imap_file, + 'imap-url:s' => \$imap_url, + 't|to|producer:s' => \$to, + 'l|list' => \$list, + 'pretty!' => \$pretty, + 'no-comments' => \$no_comments, + 'no-scan' => \$no_scan, + 'no-trim' => \$no_trim, + 'rs:s' => \$record_separator, + 'show-warnings' => \$show_warnings, + 'template:s' => \$template, + 'tt-var=s' => \%tt_vars, + 'tt-conf=s' => \%tt_conf, + 'title:s' => \$title, + 'trace' => \$trace, + 'v|validate' => \$validate, + 'dsn:s' => \$dsn, + 'db-user:s' => \$db_user, + 'db-password:s' => \$db_password, + 'producer-dsn:s' => \$producer_dsn, + 'producer-db-user:s' => \$producer_db_user, + 'producer-db-pass:s' => \$producer_db_password, + 'skip:s' => \$skip, + 'skiplike:s' => \$skiplike, + 'ignore_opts:s' => \$ignore_opts, + 'add_truncate' => \$add_truncate, + 'add-prefix' => \$add_prefix, + 'prefix:s' => \$prefix, + 'indent:s' => \$indent, + 'newlines!' => \$newlines, + 'package=s' => \$package_name, + 'use-same-auth' => \$use_same_auth, + 'version' => \$show_version, + 'mysql-parser-version=i' => \$mysql_parser_version, + 'postgres-version=f' => \$postgres_version, + 'mysql-version=f' => \$mysql_version, ) or pod2usage(2); if ($use_same_auth) { - $producer_dsn = $dsn; - $producer_db_user = $db_user; - $producer_db_password = $db_password; + $producer_dsn = $dsn; + $producer_db_user = $db_user; + $producer_db_password = $db_password; } -if ( - ( !defined $from && defined $dsn ) - || - $from =~ /^DBI.*/ -) { - $from = 'DBI'; +if ((!defined $from && defined $dsn) + || $from =~ /^DBI.*/) { + $from = 'DBI'; } -my @files = @ARGV; # source files -unless ( @files ) { - if ( defined($from) && $from eq 'DBI' ) { - @files = ('!'); - } - else { - @files = ('-'); - } +my @files = @ARGV; # source files +unless (@files) { + if (defined($from) && $from eq 'DBI') { + @files = ('!'); + } else { + @files = ('-'); + } } pod2usage(1) if $help; -if ( $show_version ) { - print "SQL::Translator v", $SQL::Translator::VERSION, "\n"; - exit(0); +if ($show_version) { + print "SQL::Translator v", $SQL::Translator::VERSION, "\n"; + exit(0); } -my $translator = SQL::Translator->new( - debug => $debug || 0, - trace => $trace || 0, - no_comments => $no_comments || 0, - show_warnings => $show_warnings || 0, - add_drop_table => $add_drop_table || 0, - quote_table_names => defined $quote_table_names ? $quote_table_names : 1, - quote_field_names => defined $quote_field_names ? $quote_field_names : 1, - validate => $validate || 0, - parser_args => { - trim_fields => $no_trim ? 0 : 1, - scan_fields => $no_scan ? 0 : 1, - field_separator => $field_separator, - record_separator => $record_separator, - dsn => $dsn, - db_user => $db_user, - db_password => $db_password, - mysql_parser_version => $mysql_parser_version, - skip => $skip, - ignore_opts => $ignore_opts, - }, - producer_args => { - imap_file => $imap_file, - imap_url => $imap_url, - pretty => $pretty, - ttfile => $template, - tt_vars => \%tt_vars, - tt_conf => \%tt_conf, - title => $title, - dsn => $producer_dsn, - db_user => $producer_db_user, - db_password => $producer_db_password, - skip => $skip, - skiplike => $skiplike, - add_truncate => $add_truncate, - add_prefix => $add_prefix, - prefix => $prefix, - indent => $indent, - newlines => $newlines, - postgres_version => $postgres_version, - mysql_version => $mysql_version, - package_name => $package_name, - }, +my $translator = SQL::Translator->new( + debug => $debug || 0, + trace => $trace || 0, + no_comments => $no_comments || 0, + show_warnings => $show_warnings || 0, + add_drop_table => $add_drop_table || 0, + quote_table_names => defined $quote_table_names ? $quote_table_names : 1, + quote_field_names => defined $quote_field_names ? $quote_field_names : 1, + validate => $validate || 0, + parser_args => { + trim_fields => $no_trim ? 0 : 1, + scan_fields => $no_scan ? 0 : 1, + field_separator => $field_separator, + record_separator => $record_separator, + dsn => $dsn, + db_user => $db_user, + db_password => $db_password, + mysql_parser_version => $mysql_parser_version, + skip => $skip, + ignore_opts => $ignore_opts, + }, + producer_args => { + imap_file => $imap_file, + imap_url => $imap_url, + pretty => $pretty, + ttfile => $template, + tt_vars => \%tt_vars, + tt_conf => \%tt_conf, + title => $title, + dsn => $producer_dsn, + db_user => $producer_db_user, + db_password => $producer_db_password, + skip => $skip, + skiplike => $skiplike, + add_truncate => $add_truncate, + add_prefix => $add_prefix, + prefix => $prefix, + indent => $indent, + newlines => $newlines, + postgres_version => $postgres_version, + mysql_version => $mysql_version, + package_name => $package_name, + }, ); -if ( $list ) { - my @parsers = $translator->list_parsers; - my @producers = $translator->list_producers; +if ($list) { + my @parsers = $translator->list_parsers; + my @producers = $translator->list_producers; - for ( @parsers, @producers ) { - if ( $_ =~ m/.+::(\w+)\.pm/ ) { - $_ = $1; - } + for (@parsers, @producers) { + if ($_ =~ m/.+::(\w+)\.pm/) { + $_ = $1; } + } - print "\nParsers:\n", map { "\t$_\n" } sort @parsers; - print "\nProducers:\n", map { "\t$_\n" } sort @producers; - print "\n"; - exit(0); + print "\nParsers:\n", map {"\t$_\n"} sort @parsers; + print "\nProducers:\n", map {"\t$_\n"} sort @producers; + print "\n"; + exit(0); } -pod2usage( msg => 'Please supply "from" and "to" arguments' ) +pod2usage(msg => 'Please supply "from" and "to" arguments') unless $from && $to; $translator->parser($from); $translator->producer($to); for my $file (@files) { - my @args = - ($file eq '-') ? (data => \*STDIN) : - ($file eq '!') ? (data => '') : - (file => $file); + my @args + = ($file eq '-') ? (data => \*STDIN) + : ($file eq '!') ? (data => '') + : (file => $file); - my $output = $translator->translate(@args) or die - "Error: " . $translator->error; + my $output = $translator->translate(@args) + or die "Error: " . $translator->error; - print $output; + print $output; } # ---------------------------------------------------- diff --git a/script/sqlt-diagram b/script/sqlt-diagram index f8ec5f47c..85b65740d 100755 --- a/script/sqlt-diagram +++ b/script/sqlt-diagram @@ -83,70 +83,68 @@ $VERSION = '1.64'; # Get arguments. # my ( - $out_file, $output_type, $db_driver, $title, $num_columns, - $no_lines, $font_size, $add_color, $debug, $show_fk_only, - $gutter, $natural_join, $join_pk_only, $skip_fields, - $skip_tables, $skip_tables_like, $help + $out_file, $output_type, $db_driver, $title, $num_columns, $no_lines, + $font_size, $add_color, $debug, $show_fk_only, $gutter, $natural_join, + $join_pk_only, $skip_fields, $skip_tables, $skip_tables_like, $help ); GetOptions( - 'd|db|f|from=s' => \$db_driver, - 'o|output:s' => \$out_file, - 'i|image:s' => \$output_type, - 't|title:s' => \$title, - 'c|columns:i' => \$num_columns, - 'n|no-lines' => \$no_lines, - 'font-size:s' => \$font_size, - 'gutter:i' => \$gutter, - 'color' => \$add_color, - 'show-fk-only' => \$show_fk_only, - 'natural-join' => \$natural_join, - 'natural-join-pk' => \$join_pk_only, - 's|skip:s' => \$skip_fields, - 'skip-tables:s' => \$skip_tables, - 'skip-tables-like:s' => \$skip_tables_like, - 'debug' => \$debug, - 'h|help' => \$help, + 'd|db|f|from=s' => \$db_driver, + 'o|output:s' => \$out_file, + 'i|image:s' => \$output_type, + 't|title:s' => \$title, + 'c|columns:i' => \$num_columns, + 'n|no-lines' => \$no_lines, + 'font-size:s' => \$font_size, + 'gutter:i' => \$gutter, + 'color' => \$add_color, + 'show-fk-only' => \$show_fk_only, + 'natural-join' => \$natural_join, + 'natural-join-pk' => \$join_pk_only, + 's|skip:s' => \$skip_fields, + 'skip-tables:s' => \$skip_tables, + 'skip-tables-like:s' => \$skip_tables_like, + 'debug' => \$debug, + 'h|help' => \$help, ) or die pod2usage; -my @files = @ARGV; # the create script(s) for the original db +my @files = @ARGV; # the create script(s) for the original db pod2usage(1) if $help; -pod2usage( -message => "No db driver specified" ) unless $db_driver; -pod2usage( -message => 'No input file' ) unless @files; - -my $translator = SQL::Translator->new( - from => $db_driver, - to => 'Diagram', - debug => $debug || 0, - producer_args => { - out_file => $out_file, - output_type => $output_type, - gutter => $gutter || 0, - title => $title, - num_columns => $num_columns, - no_lines => $no_lines, - font_size => $font_size, - add_color => $add_color, - show_fk_only => $show_fk_only, - natural_join => $natural_join, - join_pk_only => $join_pk_only, - skip_fields => $skip_fields, - skip_tables => $skip_tables, - skip_tables_like => $skip_tables_like, - }, +pod2usage(-message => "No db driver specified") unless $db_driver; +pod2usage(-message => 'No input file') unless @files; + +my $translator = SQL::Translator->new( + from => $db_driver, + to => 'Diagram', + debug => $debug || 0, + producer_args => { + out_file => $out_file, + output_type => $output_type, + gutter => $gutter || 0, + title => $title, + num_columns => $num_columns, + no_lines => $no_lines, + font_size => $font_size, + add_color => $add_color, + show_fk_only => $show_fk_only, + natural_join => $natural_join, + join_pk_only => $join_pk_only, + skip_fields => $skip_fields, + skip_tables => $skip_tables, + skip_tables_like => $skip_tables_like, + }, ) or die SQL::Translator->error; binmode STDOUT unless $out_file; for my $file (@files) { - my $output = $translator->translate( $file ) or die - "Error: " . $translator->error; - if ( $out_file ) { - print "Image written to '$out_file'. Done.\n"; - } - else { - print $output; - } + my $output = $translator->translate($file) + or die "Error: " . $translator->error; + if ($out_file) { + print "Image written to '$out_file'. Done.\n"; + } else { + print $output; + } } # ------------------------------------------------------------------- diff --git a/script/sqlt-diff b/script/sqlt-diff index 25950f0f2..7bf8e1a6a 100755 --- a/script/sqlt-diff +++ b/script/sqlt-diff @@ -116,96 +116,93 @@ use SQL::Translator::Schema::Constants; use vars qw( $VERSION ); $VERSION = '1.64'; -my ( @input, $list, $help, $debug, $trace, $caseopt, $ignore_index_names, - $ignore_constraint_names, $output_db, $mysql_parser_version, - $ignore_view_sql, $ignore_proc_sql, $no_batch_alters, $quote -); +my (@input, $list, $help, $debug, $trace, $caseopt, $ignore_index_names, $ignore_constraint_names, $output_db, + $mysql_parser_version, $ignore_view_sql, $ignore_proc_sql, $no_batch_alters, $quote); GetOptions( - 'l|list' => \$list, - 'h|help' => \$help, - 'd|debug' => \$debug, - 't|trace' => \$trace, - 'c|case-insensitive' => \$caseopt, - 'ignore-index-names' => \$ignore_index_names, - 'ignore-constraint-names' => \$ignore_constraint_names, - 'mysql_parser_version:s' => \$mysql_parser_version, - 'output-db:s' => \$output_db, - 'ignore-view-sql' => \$ignore_view_sql, - 'ignore-proc-sql' => \$ignore_proc_sql, - 'quote:s' => \$quote, - 'no-batch-alters' => \$no_batch_alters, + 'l|list' => \$list, + 'h|help' => \$help, + 'd|debug' => \$debug, + 't|trace' => \$trace, + 'c|case-insensitive' => \$caseopt, + 'ignore-index-names' => \$ignore_index_names, + 'ignore-constraint-names' => \$ignore_constraint_names, + 'mysql_parser_version:s' => \$mysql_parser_version, + 'output-db:s' => \$output_db, + 'ignore-view-sql' => \$ignore_view_sql, + 'ignore-proc-sql' => \$ignore_proc_sql, + 'quote:s' => \$quote, + 'no-batch-alters' => \$no_batch_alters, ) or pod2usage(2); -for my $arg ( @ARGV ) { - if ( $arg =~ m/^([^=]+)=(.+)$/ ) { - push @input, { file => $1, parser => $2 }; - } +for my $arg (@ARGV) { + if ($arg =~ m/^([^=]+)=(.+)$/) { + push @input, { file => $1, parser => $2 }; + } } my $tr = SQL::Translator->new; my @parsers = $tr->list_parsers; my %valid_parsers = map { $_, 1 } @parsers; - -if ( $list ) { - print "\nParsers:\n", map { "\t$_\n" } sort @parsers; - print "\n"; - exit(0); +if ($list) { + print "\nParsers:\n", map {"\t$_\n"} sort @parsers; + print "\n"; + exit(0); } -pod2usage(1) if $help || !@input; +pod2usage(1) if $help || !@input; pod2usage(msg => 'Please specify two schemas to diff') if scalar @input != 2; -my ( $source_schema, $source_db, $target_schema, $target_db ) = map { - my $file = $_->{'file'}; - my $parser = $_->{'parser'}; - - die "Unable to read file '$file'\n" unless -r $file; - die "'$parser' is an invalid parser\n" unless $valid_parsers{ $parser }; - - my $t = SQL::Translator->new(parser_args => { - mysql_parser_version => $mysql_parser_version - }); - $t->debug( $debug ); - $t->trace( $trace ); - $t->parser( $parser ) or die $tr->error; - my $out = $t->translate( $file ) or die $tr->error; - my $schema = $t->schema; - unless ( $schema->name ) { - $schema->name( $file ); - } - - ($schema, $parser); +my ($source_schema, $source_db, $target_schema, $target_db) = map { + my $file = $_->{'file'}; + my $parser = $_->{'parser'}; + + die "Unable to read file '$file'\n" unless -r $file; + die "'$parser' is an invalid parser\n" unless $valid_parsers{$parser}; + + my $t = SQL::Translator->new(parser_args => { + mysql_parser_version => $mysql_parser_version + }); + $t->debug($debug); + $t->trace($trace); + $t->parser($parser) or die $tr->error; + my $out = $t->translate($file) or die $tr->error; + my $schema = $t->schema; + + unless ($schema->name) { + $schema->name($file); + } + + ($schema, $parser); } @input; my $result = SQL::Translator::Diff::schema_diff( - $source_schema, $source_db, - $target_schema, $target_db, - { - caseopt => $caseopt || 0, - ignore_index_names => $ignore_index_names || 0, - ignore_constraint_names => $ignore_constraint_names || 0, - ignore_view_sql => $ignore_view_sql || 0, - ignore_proc_sql => $ignore_proc_sql || 0, - output_db => $output_db, - no_batch_alters => $no_batch_alters || 0, - debug => $debug || 0, - trace => $trace || 0, - sqlt_args => { - quote_table_names => $quote || '', - quote_field_names => $quote || '', - }, - } + $source_schema, + $source_db, + $target_schema, + $target_db, + { + caseopt => $caseopt || 0, + ignore_index_names => $ignore_index_names || 0, + ignore_constraint_names => $ignore_constraint_names || 0, + ignore_view_sql => $ignore_view_sql || 0, + ignore_proc_sql => $ignore_proc_sql || 0, + output_db => $output_db, + no_batch_alters => $no_batch_alters || 0, + debug => $debug || 0, + trace => $trace || 0, + sqlt_args => { + quote_table_names => $quote || '', + quote_field_names => $quote || '', + }, + } ); -if($result) -{ - print $result; -} -else -{ - print "No differences found."; +if ($result) { + print $result; +} else { + print "No differences found."; } # ------------------------------------------------------------------- diff --git a/script/sqlt-diff-old b/script/sqlt-diff-old index 6db584919..33a4c922e 100755 --- a/script/sqlt-diff-old +++ b/script/sqlt-diff-old @@ -98,189 +98,192 @@ use SQL::Translator::Schema::Constants; use vars qw( $VERSION ); $VERSION = '1.64'; -my ( @input, $list, $help, $debug ); -for my $arg ( @ARGV ) { - if ( $arg =~ m/^-?-l(ist)?$/ ) { - $list = 1; - } - elsif ( $arg =~ m/^-?-h(elp)?$/ ) { - $help = 1; - } - elsif ( $arg =~ m/^-?-d(ebug)?$/ ) { - $debug = 1; - } - elsif ( $arg =~ m/^([^=]+)=(.+)$/ ) { - push @input, { file => $1, parser => $2 }; - } - else { - pod2usage( msg => "Unknown argument '$arg'" ); - } +my (@input, $list, $help, $debug); +for my $arg (@ARGV) { + if ($arg =~ m/^-?-l(ist)?$/) { + $list = 1; + } elsif ($arg =~ m/^-?-h(elp)?$/) { + $help = 1; + } elsif ($arg =~ m/^-?-d(ebug)?$/) { + $debug = 1; + } elsif ($arg =~ m/^([^=]+)=(.+)$/) { + push @input, { file => $1, parser => $2 }; + } else { + pod2usage(msg => "Unknown argument '$arg'"); + } } -pod2usage(1) if $help; +pod2usage(1) if $help; pod2usage('Please specify only two schemas to diff') if scalar @input > 2; -pod2usage('No input') if !@input; - -if ( my $interactive = -t STDIN && -t STDOUT ) { - print STDERR join("\n", - "sqlt-diff-old is deprecated. Please sqlt-diff, and tell us ", - "about any problems or patch SQL::Translator::Diff", - '', - ); +pod2usage('No input') if !@input; + +if (my $interactive = -t STDIN && -t STDOUT) { + print STDERR join("\n", + "sqlt-diff-old is deprecated. Please sqlt-diff, and tell us ", + "about any problems or patch SQL::Translator::Diff", + '', + ); } my $tr = SQL::Translator->new; my @parsers = $tr->list_parsers; my %valid_parsers = map { $_, 1 } @parsers; -if ( $list ) { - print "\nParsers:\n", map { "\t$_\n" } sort @parsers; - print "\n"; - exit(0); +if ($list) { + print "\nParsers:\n", map {"\t$_\n"} sort @parsers; + print "\n"; + exit(0); } -pod2usage( msg => 'Too many file args' ) if @input > 2; +pod2usage(msg => 'Too many file args') if @input > 2; -my ( $source_schema, $source_db, $target_schema, $target_db ); +my ($source_schema, $source_db, $target_schema, $target_db); my $i = 2; -for my $in ( @input ) { - my $file = $in->{'file'}; - my $parser = $in->{'parser'}; - - die "Unable to read file '$file'\n" unless -r $file; - die "'$parser' is an invalid parser\n" unless $valid_parsers{ $parser }; - - my $t = SQL::Translator->new; - $t->debug( $debug ); - $t->parser( $parser ) or die $tr->error; - my $out = $t->translate( $file ) or die $tr->error; - my $schema = $t->schema; - unless ( $schema->name ) { - $schema->name( $file ); - } - - if ( $i == 1 ) { - $source_schema = $schema; - $source_db = $parser; - } - else { - $target_schema = $schema; - $target_db = $parser; - } - $i--; +for my $in (@input) { + my $file = $in->{'file'}; + my $parser = $in->{'parser'}; + + die "Unable to read file '$file'\n" unless -r $file; + die "'$parser' is an invalid parser\n" unless $valid_parsers{$parser}; + + my $t = SQL::Translator->new; + $t->debug($debug); + $t->parser($parser) or die $tr->error; + my $out = $t->translate($file) or die $tr->error; + my $schema = $t->schema; + unless ($schema->name) { + $schema->name($file); + } + + if ($i == 1) { + $source_schema = $schema; + $source_db = $parser; + } else { + $target_schema = $schema; + $target_db = $parser; + } + $i--; } my $case_insensitive = $target_db =~ /SQLServer/; -my $s1_name = $source_schema->name; -my $s2_name = $target_schema->name; -my ( @new_tables, @diffs , @diffs_at_end); -for my $t1 ( $source_schema->get_tables ) { - my $t1_name = $t1->name; - my $t2 = $target_schema->get_table( $t1_name, $case_insensitive ); - - warn "TABLE '$s1_name.$t1_name'\n" if $debug; - unless ( $t2 ) { - warn "Couldn't find table '$s1_name.$t1_name' in '$s2_name'\n" - if $debug; - if ( $target_db =~ /(SQLServer|Oracle)/ ) { - for my $constraint ( $t1->get_constraints ) { - next if $constraint->type ne FOREIGN_KEY; - push @diffs_at_end, "ALTER TABLE $t1_name ADD ". - constraint_to_string($constraint, $source_schema).";"; - $t1->drop_constraint($constraint); - } - } - push @new_tables, $t1; - next; +my $s1_name = $source_schema->name; +my $s2_name = $target_schema->name; +my (@new_tables, @diffs, @diffs_at_end); +for my $t1 ($source_schema->get_tables) { + my $t1_name = $t1->name; + my $t2 = $target_schema->get_table($t1_name, $case_insensitive); + + warn "TABLE '$s1_name.$t1_name'\n" if $debug; + unless ($t2) { + warn "Couldn't find table '$s1_name.$t1_name' in '$s2_name'\n" + if $debug; + if ($target_db =~ /(SQLServer|Oracle)/) { + for my $constraint ($t1->get_constraints) { + next if $constraint->type ne FOREIGN_KEY; + push @diffs_at_end, "ALTER TABLE $t1_name ADD " . constraint_to_string($constraint, $source_schema) . ";"; + $t1->drop_constraint($constraint); + } } + push @new_tables, $t1; + next; + } - # Go through our options - my $options_different = 0; - my %checkedOptions; + # Go through our options + my $options_different = 0; + my %checkedOptions; OPTION: - for my $t1_option_ref ( $t1->options ) { - my($key1, $value1) = %{$t1_option_ref}; - for my $t2_option_ref ( $t2->options ) { - my($key2, $value2) = %{$t2_option_ref}; - if ( $key1 eq $key2 ) { - if ( defined $value1 != defined $value2 ) { - $options_different = 1; - last OPTION; - } - if ( defined $value1 && $value1 ne $value2 ) { - $options_different = 1; - last OPTION; - } - $checkedOptions{$key1} = 1; - next OPTION; - } + for my $t1_option_ref ($t1->options) { + my ($key1, $value1) = %{$t1_option_ref}; + for my $t2_option_ref ($t2->options) { + my ($key2, $value2) = %{$t2_option_ref}; + if ($key1 eq $key2) { + if (defined $value1 != defined $value2) { + $options_different = 1; + last OPTION; } - $options_different = 1; - last OPTION; - } - # Go through the other table's options - unless ( $options_different ) { - for my $t2_option_ref ( $t2->options ) { - my($key, $value) = %{$t2_option_ref}; - next if $checkedOptions{$key}; - $options_different = 1; - last; + if (defined $value1 && $value1 ne $value2) { + $options_different = 1; + last OPTION; } + $checkedOptions{$key1} = 1; + next OPTION; + } } - # If there's a difference, just re-set all the options - my @diffs_table_options; - if ( $options_different ) { - my @options = (); - foreach my $option_ref ( $t1->options ) { - my($key, $value) = %{$option_ref}; - push(@options, defined $value ? "$key=$value" : $key); - } - my $options = join(' ', @options); - @diffs_table_options = ("ALTER TABLE $t1_name $options;"); + $options_different = 1; + last OPTION; + } + + # Go through the other table's options + unless ($options_different) { + for my $t2_option_ref ($t2->options) { + my ($key, $value) = %{$t2_option_ref}; + next if $checkedOptions{$key}; + $options_different = 1; + last; } - - my $t2_name = $t2->name; - my(@diffs_table_adds, @diffs_table_changes); - for my $t1_field ( $t1->get_fields ) { - my $f1_type = $t1_field->data_type; - my $f1_size = $t1_field->size; - my $f1_name = $t1_field->name; - my $f1_nullable = $t1_field->is_nullable; - my $f1_default = $t1_field->default_value; - my $f1_auto_inc = $t1_field->is_auto_increment; - my $t2_field = $t2->get_field( $f1_name, $case_insensitive ); - my $f1_full_name = "$s1_name.$t1_name.$t1_name"; - warn "FIELD '$f1_full_name'\n" if $debug; - - my $f2_full_name = "$s2_name.$t2_name.$f1_name"; - - unless ( $t2_field ) { - warn "Couldn't find field '$f2_full_name' in '$t2_name'\n" - if $debug; - my $temp_default_value = 0; - if ( $target_db =~ /SQLServer/ && !$f1_nullable && !defined $f1_default ) { - # SQL Server doesn't allow adding non-nullable, non-default columns - # so we add it with a default value, then remove the default value - $temp_default_value = 1; - my(@numeric_types) = qw(decimal numeric float real int bigint smallint tinyint); - $f1_default = grep($_ eq $f1_type, @numeric_types) ? 0 : ''; - } - push @diffs_table_adds, sprintf( "ALTER TABLE %s ADD %s%s %s%s%s%s%s%s;", - $t1_name, $target_db =~ /Oracle/ ? '(' : '', - $f1_name, $f1_type, - ($f1_size && $f1_type !~ /(blob|text)$/) ? "($f1_size)" : '', - !defined $f1_default ? '' - : uc $f1_default eq 'NULL' ? ' DEFAULT NULL' - : uc $f1_default eq 'CURRENT_TIMESTAMP' ? ' DEFAULT CURRENT_TIMESTAMP' - : " DEFAULT '$f1_default'", - $f1_nullable ? '' : ' NOT NULL', - $f1_auto_inc ? ' AUTO_INCREMENT' : '', - $target_db =~ /Oracle/ ? ')' : '', - ); - if ( $temp_default_value ) { - undef $f1_default; - push @diffs_table_adds, sprintf( <options) { + my ($key, $value) = %{$option_ref}; + push(@options, defined $value ? "$key=$value" : $key); + } + my $options = join(' ', @options); + @diffs_table_options = ("ALTER TABLE $t1_name $options;"); + } + + my $t2_name = $t2->name; + my (@diffs_table_adds, @diffs_table_changes); + for my $t1_field ($t1->get_fields) { + my $f1_type = $t1_field->data_type; + my $f1_size = $t1_field->size; + my $f1_name = $t1_field->name; + my $f1_nullable = $t1_field->is_nullable; + my $f1_default = $t1_field->default_value; + my $f1_auto_inc = $t1_field->is_auto_increment; + my $t2_field = $t2->get_field($f1_name, $case_insensitive); + my $f1_full_name = "$s1_name.$t1_name.$t1_name"; + warn "FIELD '$f1_full_name'\n" if $debug; + + my $f2_full_name = "$s2_name.$t2_name.$f1_name"; + + unless ($t2_field) { + warn "Couldn't find field '$f2_full_name' in '$t2_name'\n" + if $debug; + my $temp_default_value = 0; + if ( $target_db =~ /SQLServer/ + && !$f1_nullable + && !defined $f1_default) { + # SQL Server doesn't allow adding non-nullable, non-default columns + # so we add it with a default value, then remove the default value + $temp_default_value = 1; + my (@numeric_types) = qw(decimal numeric float real int bigint smallint tinyint); + $f1_default = grep($_ eq $f1_type, @numeric_types) ? 0 : ''; + } + push @diffs_table_adds, + sprintf( + "ALTER TABLE %s ADD %s%s %s%s%s%s%s%s;", + $t1_name, + $target_db =~ /Oracle/ ? '(' : '', + $f1_name, + $f1_type, + ($f1_size && $f1_type !~ /(blob|text)$/) ? "($f1_size)" : '', + !defined $f1_default ? '' + : uc $f1_default eq 'NULL' ? ' DEFAULT NULL' + : uc $f1_default eq 'CURRENT_TIMESTAMP' ? ' DEFAULT CURRENT_TIMESTAMP' + : " DEFAULT '$f1_default'", + $f1_nullable ? '' : ' NOT NULL', + $f1_auto_inc ? ' AUTO_INCREMENT' : '', + $target_db =~ /Oracle/ ? ')' : '', + ); + if ($temp_default_value) { + undef $f1_default; + push @diffs_table_adds, sprintf( + <data_type; - my $f2_size = $t2_field->size || ''; - my $f2_nullable = $t2_field->is_nullable; - my $f2_default = $t2_field->default_value; - my $f2_auto_inc = $t2_field->is_auto_increment; - if ( !$t1_field->equals($t2_field, $case_insensitive) ) { - # SQLServer timestamp fields can't be altered, so we drop and add instead - if ( $target_db =~ /SQLServer/ && $f2_type eq "timestamp" ) { - push @diffs_table_changes, "ALTER TABLE $t1_name DROP COLUMN $f1_name;"; - push @diffs_table_changes, sprintf( "ALTER TABLE %s ADD %s%s %s%s%s%s%s%s;", - $t1_name, $target_db =~ /Oracle/ ? '(' : '', - $f1_name, $f1_type, - ($f1_size && $f1_type !~ /(blob|text)$/) ? "($f1_size)" : '', - !defined $f1_default ? '' - : uc $f1_default eq 'NULL' ? ' DEFAULT NULL' - : uc $f1_default eq 'CURRENT_TIMESTAMP' ? ' DEFAULT CURRENT_TIMESTAMP' - : " DEFAULT '$f1_default'", - $f1_nullable ? '' : ' NOT NULL', - $f1_auto_inc ? ' AUTO_INCREMENT' : '', - $target_db =~ /Oracle/ ? ')' : '', - ); - next; - } - - my $changeText = $target_db =~ /SQLServer/ ? 'ALTER COLUMN' : - $target_db =~ /Oracle/ ? 'MODIFY (' : 'CHANGE'; - my $nullText = $f1_nullable ? '' : ' NOT NULL'; - $nullText = '' if $target_db =~ /Oracle/ && $f1_nullable == $f2_nullable; - push @diffs_table_changes, sprintf( "ALTER TABLE %s %s %s%s %s%s%s%s%s%s;", - $t1_name, $changeText, - $f1_name, $target_db =~ /MySQL/ ? " $f1_name" : '', - $f1_type, ($f1_size && $f1_type !~ /(blob|text)$/) ? "($f1_size)" : '', - $nullText, - !defined $f1_default || $target_db =~ /SQLServer/ ? '' - : uc $f1_default eq 'NULL' ? ' DEFAULT NULL' - : uc $f1_default eq 'CURRENT_TIMESTAMP' ? ' DEFAULT CURRENT_TIMESTAMP' - : " DEFAULT '$f1_default'", - $f1_auto_inc ? ' AUTO_INCREMENT' : '', - $target_db =~ /Oracle/ ? ')' : '', + my $f2_type = $t2_field->data_type; + my $f2_size = $t2_field->size || ''; + my $f2_nullable = $t2_field->is_nullable; + my $f2_default = $t2_field->default_value; + my $f2_auto_inc = $t2_field->is_auto_increment; + if (!$t1_field->equals($t2_field, $case_insensitive)) { + + # SQLServer timestamp fields can't be altered, so we drop and add instead + if ($target_db =~ /SQLServer/ && $f2_type eq "timestamp") { + push @diffs_table_changes, "ALTER TABLE $t1_name DROP COLUMN $f1_name;"; + push @diffs_table_changes, + sprintf( + "ALTER TABLE %s ADD %s%s %s%s%s%s%s%s;", + $t1_name, + $target_db =~ /Oracle/ ? '(' : '', + $f1_name, + $f1_type, + ($f1_size && $f1_type !~ /(blob|text)$/) ? "($f1_size)" + : '', + !defined $f1_default ? '' + : uc $f1_default eq 'NULL' ? ' DEFAULT NULL' + : uc $f1_default eq 'CURRENT_TIMESTAMP' ? ' DEFAULT CURRENT_TIMESTAMP' + : " DEFAULT '$f1_default'", + $f1_nullable ? '' : ' NOT NULL', + $f1_auto_inc ? ' AUTO_INCREMENT' : '', + $target_db =~ /Oracle/ ? ')' : '', ); - if ( defined $f1_default && $target_db =~ /SQLServer/ ) { - # Adding a column with a default value for SQL Server means adding a - # constraint and setting existing NULLs to the default value - push @diffs_table_changes, sprintf( "ALTER TABLE %s ADD CONSTRAINT DF_%s_%s %s FOR %s;", - $t1_name, $t1_name, $f1_name, uc $f1_default eq 'NULL' ? 'DEFAULT NULL' - : uc $f1_default eq 'CURRENT_TIMESTAMP' ? 'DEFAULT CURRENT_TIMESTAMP' - : "DEFAULT '$f1_default'", $f1_name, - ); - push @diffs_table_changes, sprintf( "UPDATE %s SET %s = %s WHERE %s IS NULL;", - $t1_name, $f1_name, uc $f1_default eq 'NULL' ? 'NULL' - : uc $f1_default eq 'CURRENT_TIMESTAMP' ? 'CURRENT_TIMESTAMP' - : "'$f1_default'", $f1_name, - ); - } - } + next; + } + + my $changeText + = $target_db =~ /SQLServer/ ? 'ALTER COLUMN' + : $target_db =~ /Oracle/ ? 'MODIFY (' + : 'CHANGE'; + my $nullText = $f1_nullable ? '' : ' NOT NULL'; + $nullText = '' + if $target_db =~ /Oracle/ && $f1_nullable == $f2_nullable; + push @diffs_table_changes, + sprintf( + "ALTER TABLE %s %s %s%s %s%s%s%s%s%s;", + $t1_name, + $changeText, + $f1_name, + $target_db =~ /MySQL/ ? " $f1_name" : '', + $f1_type, + ($f1_size && $f1_type !~ /(blob|text)$/) ? "($f1_size)" : '', + $nullText, + !defined $f1_default || $target_db =~ /SQLServer/ ? '' + : uc $f1_default eq 'NULL' ? ' DEFAULT NULL' + : uc $f1_default eq 'CURRENT_TIMESTAMP' ? ' DEFAULT CURRENT_TIMESTAMP' + : " DEFAULT '$f1_default'", + $f1_auto_inc ? ' AUTO_INCREMENT' : '', + $target_db =~ /Oracle/ ? ')' : '', + ); + if (defined $f1_default && $target_db =~ /SQLServer/) { + + # Adding a column with a default value for SQL Server means adding a + # constraint and setting existing NULLs to the default value + push @diffs_table_changes, + sprintf( + "ALTER TABLE %s ADD CONSTRAINT DF_%s_%s %s FOR %s;", + $t1_name, + $t1_name, + $f1_name, + uc $f1_default eq 'NULL' ? 'DEFAULT NULL' + : uc $f1_default eq 'CURRENT_TIMESTAMP' ? 'DEFAULT CURRENT_TIMESTAMP' + : "DEFAULT '$f1_default'", + $f1_name, + ); + push @diffs_table_changes, + sprintf( + "UPDATE %s SET %s = %s WHERE %s IS NULL;", + $t1_name, + $f1_name, + uc $f1_default eq 'NULL' ? 'NULL' + : uc $f1_default eq 'CURRENT_TIMESTAMP' ? 'CURRENT_TIMESTAMP' + : "'$f1_default'", + $f1_name, + ); + } } + } - my(%checked_indices, @diffs_index_creates, @diffs_index_drops); + my (%checked_indices, @diffs_index_creates, @diffs_index_drops); INDEX: - for my $i1 ( $t1->get_indices ) { - for my $i2 ( $t2->get_indices ) { - if ( $i1->equals($i2, $case_insensitive) ) { - $checked_indices{$i2} = 1; - next INDEX; - } - } - push @diffs_index_creates, sprintf( - "CREATE %sINDEX%s ON %s (%s);", - $i1->type eq NORMAL ? '' : $i1->type." ", - $i1->name ? " ".$i1->name : '', - $t1_name, - join(",", $i1->fields), - ); + for my $i1 ($t1->get_indices) { + for my $i2 ($t2->get_indices) { + if ($i1->equals($i2, $case_insensitive)) { + $checked_indices{$i2} = 1; + next INDEX; + } } + push @diffs_index_creates, + sprintf( + "CREATE %sINDEX%s ON %s (%s);", + $i1->type eq NORMAL ? '' : $i1->type . " ", + $i1->name ? " " . $i1->name : '', + $t1_name, join(",", $i1->fields), + ); + } INDEX2: - for my $i2 ( $t2->get_indices ) { - next if $checked_indices{$i2}; - for my $i1 ( $t1->get_indices ) { - next INDEX2 if $i2->equals($i1, $case_insensitive); - } - $target_db =~ /SQLServer/ - ? push @diffs_index_drops, "DROP INDEX $t1_name.".$i2->name.";" - : push @diffs_index_drops, "DROP INDEX ".$i2->name." on $t1_name;"; + for my $i2 ($t2->get_indices) { + next if $checked_indices{$i2}; + for my $i1 ($t1->get_indices) { + next INDEX2 if $i2->equals($i1, $case_insensitive); } + $target_db =~ /SQLServer/ + ? push @diffs_index_drops, "DROP INDEX $t1_name." . $i2->name . ";" + : push @diffs_index_drops, + "DROP INDEX " . $i2->name . " on $t1_name;"; + } - my(%checked_constraints, @diffs_constraint_drops); + my (%checked_constraints, @diffs_constraint_drops); CONSTRAINT: - for my $c1 ( $t1->get_constraints ) { - next if $source_db =~ /Oracle/ && $c1->type eq UNIQUE && $c1->name =~ /^SYS_/i; - for my $c2 ( $t2->get_constraints ) { - if ( $c1->equals($c2, $case_insensitive) ) { - $checked_constraints{$c2} = 1; - next CONSTRAINT; - } - } - push @diffs_at_end, "ALTER TABLE $t1_name ADD ". - constraint_to_string($c1, $source_schema).";"; + for my $c1 ($t1->get_constraints) { + next + if $source_db =~ /Oracle/ + && $c1->type eq UNIQUE + && $c1->name =~ /^SYS_/i; + for my $c2 ($t2->get_constraints) { + if ($c1->equals($c2, $case_insensitive)) { + $checked_constraints{$c2} = 1; + next CONSTRAINT; + } } + push @diffs_at_end, "ALTER TABLE $t1_name ADD " . constraint_to_string($c1, $source_schema) . ";"; + } CONSTRAINT2: - for my $c2 ( $t2->get_constraints ) { - next if $checked_constraints{$c2}; - for my $c1 ( $t1->get_constraints ) { - next CONSTRAINT2 if $c2->equals($c1, $case_insensitive); - } - if ( $c2->type eq UNIQUE ) { - push @diffs_constraint_drops, "ALTER TABLE $t1_name DROP INDEX ". - $c2->name.";"; - } elsif ( $target_db =~ /SQLServer/ ) { - push @diffs_constraint_drops, "ALTER TABLE $t1_name DROP ".$c2->name.";"; - } else { - push @diffs_constraint_drops, "ALTER TABLE $t1_name DROP ".$c2->type. - ($c2->type eq FOREIGN_KEY ? " ".$c2->name : '').";"; - } + for my $c2 ($t2->get_constraints) { + next if $checked_constraints{$c2}; + for my $c1 ($t1->get_constraints) { + next CONSTRAINT2 if $c2->equals($c1, $case_insensitive); } + if ($c2->type eq UNIQUE) { + push @diffs_constraint_drops, "ALTER TABLE $t1_name DROP INDEX " . $c2->name . ";"; + } elsif ($target_db =~ /SQLServer/) { + push @diffs_constraint_drops, "ALTER TABLE $t1_name DROP " . $c2->name . ";"; + } else { + push @diffs_constraint_drops, + "ALTER TABLE $t1_name DROP " . $c2->type . ($c2->type eq FOREIGN_KEY ? " " . $c2->name : '') . ";"; + } + } - push @diffs, @diffs_index_drops, @diffs_constraint_drops, - @diffs_table_options, @diffs_table_adds, - @diffs_table_changes, @diffs_index_creates; + push @diffs, @diffs_index_drops, @diffs_constraint_drops, + @diffs_table_options, @diffs_table_adds, + @diffs_table_changes, @diffs_index_creates; } -for my $t2 ( $target_schema->get_tables ) { - my $t2_name = $t2->name; - my $t1 = $source_schema->get_table( $t2_name, $target_db =~ /SQLServer/ ); +for my $t2 ($target_schema->get_tables) { + my $t2_name = $t2->name; + my $t1 = $source_schema->get_table($t2_name, $target_db =~ /SQLServer/); - unless ( $t1 ) { - if ( $target_db =~ /SQLServer/ ) { - for my $constraint ( $t2->get_constraints ) { - next if $constraint->type eq PRIMARY_KEY; - push @diffs, "ALTER TABLE $t2_name DROP ".$constraint->name.";"; - } - } - push @diffs_at_end, "DROP TABLE $t2_name;"; - next; + unless ($t1) { + if ($target_db =~ /SQLServer/) { + for my $constraint ($t2->get_constraints) { + next if $constraint->type eq PRIMARY_KEY; + push @diffs, "ALTER TABLE $t2_name DROP " . $constraint->name . ";"; + } } - - for my $t2_field ( $t2->get_fields ) { - my $f2_name = $t2_field->name; - my $t1_field = $t1->get_field( $f2_name ); - unless ( $t1_field ) { - my $modifier = $target_db =~ /SQLServer/ ? "COLUMN " : ''; - push @diffs, "ALTER TABLE $t2_name DROP $modifier$f2_name;"; - } + push @diffs_at_end, "DROP TABLE $t2_name;"; + next; + } + + for my $t2_field ($t2->get_fields) { + my $f2_name = $t2_field->name; + my $t1_field = $t1->get_field($f2_name); + unless ($t1_field) { + my $modifier = $target_db =~ /SQLServer/ ? "COLUMN " : ''; + push @diffs, "ALTER TABLE $t2_name DROP $modifier$f2_name;"; } + } } -if ( @new_tables ) { - my $dummy_tr = SQL::Translator->new; - $dummy_tr->schema->add_table( $_ ) for @new_tables; - my $producer = $dummy_tr->producer( $target_db ); - unshift @diffs, $producer->( $dummy_tr ); +if (@new_tables) { + my $dummy_tr = SQL::Translator->new; + $dummy_tr->schema->add_table($_) for @new_tables; + my $producer = $dummy_tr->producer($target_db); + unshift @diffs, $producer->($dummy_tr); } push(@diffs, @diffs_at_end); -if ( @diffs ) { - if ( $source_db !~ /^(MySQL|SQLServer|Oracle)$/ ) { - unshift(@diffs, "-- Target database $target_db is untested/unsupported!!!"); - } +if (@diffs) { + if ($source_db !~ /^(MySQL|SQLServer|Oracle)$/) { + unshift(@diffs, "-- Target database $target_db is untested/unsupported!!!"); + } } -if ( @diffs ) { - print join( "\n", - "-- Convert schema '$s2_name' to '$s1_name':\n", @diffs, "\n" - ); - exit(1); -} -else { - print "There were no differences.\n"; +if (@diffs) { + print join("\n", "-- Convert schema '$s2_name' to '$s1_name':\n", @diffs, "\n"); + exit(1); +} else { + print "There were no differences.\n"; } sub constraint_to_string { - my $c = shift; - my $schema = shift or die "No schema given"; - my @fields = $c->field_names or return ''; - - if ( $c->type eq PRIMARY_KEY ) { - if ( $target_db =~ /Oracle/ ) { - return (defined $c->name ? 'CONSTRAINT '.$c->name.' ' : '') . - 'PRIMARY KEY (' . join(', ', @fields). ')'; - } else { - return 'PRIMARY KEY (' . join(', ', @fields). ')'; - } + my $c = shift; + my $schema = shift or die "No schema given"; + my @fields = $c->field_names or return ''; + + if ($c->type eq PRIMARY_KEY) { + if ($target_db =~ /Oracle/) { + return (defined $c->name ? 'CONSTRAINT ' . $c->name . ' ' : '') . 'PRIMARY KEY (' . join(', ', @fields) . ')'; + } else { + return 'PRIMARY KEY (' . join(', ', @fields) . ')'; } - elsif ( $c->type eq UNIQUE ) { - if ( $target_db =~ /Oracle/ ) { - return (defined $c->name ? 'CONSTRAINT '.$c->name.' ' : '') . - 'UNIQUE (' . join(', ', @fields). ')'; - } else { - return 'UNIQUE '. - (defined $c->name ? $c->name.' ' : ''). - '(' . join(', ', @fields). ')'; - } + } elsif ($c->type eq UNIQUE) { + if ($target_db =~ /Oracle/) { + return (defined $c->name ? 'CONSTRAINT ' . $c->name . ' ' : '') . 'UNIQUE (' . join(', ', @fields) . ')'; + } else { + return 'UNIQUE ' . (defined $c->name ? $c->name . ' ' : '') . '(' . join(', ', @fields) . ')'; } - elsif ( $c->type eq FOREIGN_KEY ) { - my $def = join(' ', - map { $_ || () } 'CONSTRAINT', $c->name, 'FOREIGN KEY' - ); - - $def .= ' (' . join( ', ', @fields ) . ')'; + } elsif ($c->type eq FOREIGN_KEY) { + my $def = join(' ', map { $_ || () } 'CONSTRAINT', $c->name, 'FOREIGN KEY'); - $def .= ' REFERENCES ' . $c->reference_table; + $def .= ' (' . join(', ', @fields) . ')'; - my @rfields = map { $_ || () } $c->reference_fields; - unless ( @rfields ) { - my $rtable_name = $c->reference_table; - if ( my $ref_table = $schema->get_table( $rtable_name ) ) { - push @rfields, $ref_table->primary_key; - } - else { - warn "Can't find reference table '$rtable_name' " . - "in schema\n"; - } - } + $def .= ' REFERENCES ' . $c->reference_table; - if ( @rfields ) { - $def .= ' (' . join( ', ', @rfields ) . ')'; - } - else { - warn "FK constraint on " . 'some table' . '.' . - join('', @fields) . " has no reference fields\n"; - } + my @rfields = map { $_ || () } $c->reference_fields; + unless (@rfields) { + my $rtable_name = $c->reference_table; + if (my $ref_table = $schema->get_table($rtable_name)) { + push @rfields, $ref_table->primary_key; + } else { + warn "Can't find reference table '$rtable_name' " . "in schema\n"; + } + } - if ( $c->match_type ) { - $def .= ' MATCH ' . - ( $c->match_type =~ /full/i ) ? 'FULL' : 'PARTIAL'; - } + if (@rfields) { + $def .= ' (' . join(', ', @rfields) . ')'; + } else { + warn "FK constraint on " . 'some table' . '.' . join('', @fields) . " has no reference fields\n"; + } - if ( $c->on_delete ) { - $def .= ' ON DELETE '.join( ' ', $c->on_delete ); - } + if ($c->match_type) { + $def .= ' MATCH ' . ($c->match_type =~ /full/i) ? 'FULL' : 'PARTIAL'; + } - if ( $c->on_update ) { - $def .= ' ON UPDATE '.join( ' ', $c->on_update ); - } + if ($c->on_delete) { + $def .= ' ON DELETE ' . join(' ', $c->on_delete); + } - return $def; + if ($c->on_update) { + $def .= ' ON UPDATE ' . join(' ', $c->on_update); } + + return $def; + } } # ------------------------------------------------------------------- diff --git a/script/sqlt-dumper b/script/sqlt-dumper index 7a826fda1..8362452dd 100755 --- a/script/sqlt-dumper +++ b/script/sqlt-dumper @@ -65,37 +65,37 @@ use File::Basename qw(basename); use vars '$VERSION'; $VERSION = '1.64'; -my ( $help, $db, $skip, $skiplike, $db_user, $db_pass, $dsn ); +my ($help, $db, $skip, $skiplike, $db_user, $db_pass, $dsn); GetOptions( - 'h|help' => \$help, - 'd|f|from|db=s' => \$db, - 'skip:s' => \$skip, - 'skiplike:s' => \$skiplike, - 'u|user:s' => \$db_user, - 'p|password:s' => \$db_pass, - 'dsn:s' => \$dsn, + 'h|help' => \$help, + 'd|f|from|db=s' => \$db, + 'skip:s' => \$skip, + 'skiplike:s' => \$skiplike, + 'u|user:s' => \$db_user, + 'p|password:s' => \$db_pass, + 'dsn:s' => \$dsn, ) or pod2usage; pod2usage(0) if $help; -pod2usage( 'No database driver specified' ) unless $db; +pod2usage('No database driver specified') unless $db; $db_user ||= 'username'; $db_pass ||= 'password'; $dsn ||= "dbi:$db:_"; -my $file = shift @ARGV or pod2usage( -msg => 'No input file' ); -my $t = SQL::Translator->new( - from => $db, - to => 'Dumper', - producer_args => { - skip => $skip, - skiplike => $skiplike, - db_user => $db_user, - db_password => $db_pass, - dsn => $dsn, - } +my $file = shift @ARGV or pod2usage(-msg => 'No input file'); +my $t = SQL::Translator->new( + from => $db, + to => 'Dumper', + producer_args => { + skip => $skip, + skiplike => $skiplike, + db_user => $db_user, + db_password => $db_pass, + dsn => $dsn, + } ); -print $t->translate( $file ); +print $t->translate($file); exit(0); diff --git a/script/sqlt-graph b/script/sqlt-graph index c77dd2544..733834b68 100755 --- a/script/sqlt-graph +++ b/script/sqlt-graph @@ -114,92 +114,91 @@ $VERSION = '1.64'; # Get arguments. # my ( - $layout, $node_shape, $out_file, $output_type, $db_driver, $add_color, - $natural_join, $join_pk_only, $skip_fields, $show_datatypes, - $show_sizes, $show_constraints, $debug, $help, $height, $width, - $no_fields, $fontsize, $fontname, $skip_tables, $skip_tables_like, - $cluster, $trace + $layout, $node_shape, $out_file, $output_type, $db_driver, + $add_color, $natural_join, $join_pk_only, $skip_fields, $show_datatypes, + $show_sizes, $show_constraints, $debug, $help, $height, + $width, $no_fields, $fontsize, $fontname, $skip_tables, + $skip_tables_like, $cluster, $trace ); # multi-valued options: -my %edgeattrs = (); -my %nodeattrs = (); +my %edgeattrs = (); +my %nodeattrs = (); my %graphattrs = (); GetOptions( - 'd|db|f|from=s' => \$db_driver, - 'o|output:s' => \$out_file, - 'l|layout:s' => \$layout, - 'n|node-shape:s' => \$node_shape, - 't|output-type:s' => \$output_type, - 'height:f' => \$height, - 'width:f' => \$width, - 'fontsize=i' => \$fontsize, - 'fontname=s' => \$fontname, - 'nodeattr=s' => \%nodeattrs, - 'edgeattr=s' => \%edgeattrs, - 'graphattr=s' => \%graphattrs, - 'c|color' => \$add_color, - 'cluster:s' => \$cluster, - 'no-fields' => \$no_fields, - 'natural-join' => \$natural_join, - 'natural-join-pk' => \$join_pk_only, - 's|skip:s' => \$skip_fields, - 'skip-tables:s' => \$skip_tables, - 'skip-tables-like:s' => \$skip_tables_like, - 'show-datatypes' => \$show_datatypes, - 'show-sizes' => \$show_sizes, - 'show-constraints' => \$show_constraints, - 'debug' => \$debug, - 'trace' => \$trace, - 'h|help' => \$help, + 'd|db|f|from=s' => \$db_driver, + 'o|output:s' => \$out_file, + 'l|layout:s' => \$layout, + 'n|node-shape:s' => \$node_shape, + 't|output-type:s' => \$output_type, + 'height:f' => \$height, + 'width:f' => \$width, + 'fontsize=i' => \$fontsize, + 'fontname=s' => \$fontname, + 'nodeattr=s' => \%nodeattrs, + 'edgeattr=s' => \%edgeattrs, + 'graphattr=s' => \%graphattrs, + 'c|color' => \$add_color, + 'cluster:s' => \$cluster, + 'no-fields' => \$no_fields, + 'natural-join' => \$natural_join, + 'natural-join-pk' => \$join_pk_only, + 's|skip:s' => \$skip_fields, + 'skip-tables:s' => \$skip_tables, + 'skip-tables-like:s' => \$skip_tables_like, + 'show-datatypes' => \$show_datatypes, + 'show-sizes' => \$show_sizes, + 'show-constraints' => \$show_constraints, + 'debug' => \$debug, + 'trace' => \$trace, + 'h|help' => \$help, ) or die pod2usage; -my @files = @ARGV; # the create script(s) for the original db +my @files = @ARGV; # the create script(s) for the original db pod2usage(1) if $help; -pod2usage( -message => "No db driver specified" ) unless $db_driver; -pod2usage( -message => 'No input file' ) unless @files; - -my $translator = SQL::Translator->new( - from => $db_driver, - to => 'GraphViz', - debug => $debug || 0, - trace => $trace || 0, - producer_args => { - out_file => $out_file, - layout => $layout, - node_shape => $node_shape, - output_type => $output_type, - add_color => $add_color, - natural_join => $natural_join, - natural_join_pk => $join_pk_only, - skip_fields => $skip_fields, - skip_tables => $skip_tables, - skip_tables_like => $skip_tables_like, - show_datatypes => $show_datatypes, - show_sizes => $show_sizes, - show_constraints => $show_constraints, - cluster => $cluster, - height => $height || 0, - width => $width || 0, - fontsize => $fontsize, - fontname => $fontname, - nodeattrs => \%nodeattrs, - edgeattrs => \%edgeattrs, - graphattrs => \%graphattrs, - show_fields => $no_fields ? 0 : 1, - }, +pod2usage(-message => "No db driver specified") unless $db_driver; +pod2usage(-message => 'No input file') unless @files; + +my $translator = SQL::Translator->new( + from => $db_driver, + to => 'GraphViz', + debug => $debug || 0, + trace => $trace || 0, + producer_args => { + out_file => $out_file, + layout => $layout, + node_shape => $node_shape, + output_type => $output_type, + add_color => $add_color, + natural_join => $natural_join, + natural_join_pk => $join_pk_only, + skip_fields => $skip_fields, + skip_tables => $skip_tables, + skip_tables_like => $skip_tables_like, + show_datatypes => $show_datatypes, + show_sizes => $show_sizes, + show_constraints => $show_constraints, + cluster => $cluster, + height => $height || 0, + width => $width || 0, + fontsize => $fontsize, + fontname => $fontname, + nodeattrs => \%nodeattrs, + edgeattrs => \%edgeattrs, + graphattrs => \%graphattrs, + show_fields => $no_fields ? 0 : 1, + }, ) or die SQL::Translator->error; for my $file (@files) { - my $output = $translator->translate( $file ) or die - "Error: " . $translator->error; - if ( $out_file ) { - print "Image written to '$out_file'. Done.\n"; - } - else { - print $output; - } + my $output = $translator->translate($file) + or die "Error: " . $translator->error; + if ($out_file) { + print "Image written to '$out_file'. Done.\n"; + } else { + print $output; + } } # ------------------------------------------------------------------- diff --git a/script/sqlt.cgi b/script/sqlt.cgi index 7e44da9b7..2c5ccf339 100755 --- a/script/sqlt.cgi +++ b/script/sqlt.cgi @@ -43,501 +43,486 @@ $VERSION = '1.64'; my $q = CGI->new; eval { - if ( $q->param ) { - my $data; - if ( $q->param('schema') ) { - $data = $q->param('schema'); - } - elsif ( my $fh = $q->upload('schema_file') ) { - local $/; - $data = <$fh>; - } - die "No schema provided!\n" unless $data; + if ($q->param) { + my $data; + if ($q->param('schema')) { + $data = $q->param('schema'); + } elsif (my $fh = $q->upload('schema_file')) { + local $/; + $data = <$fh>; + } + die "No schema provided!\n" unless $data; - my $producer = $q->param('producer'); - my $output_type = $producer eq 'Diagram' - ? $q->param('diagram_output_type') - : $producer eq 'GraphViz' - ? $q->param('graphviz_output_type') - : '' - ; + my $producer = $q->param('producer'); + my $output_type + = $producer eq 'Diagram' ? $q->param('diagram_output_type') + : $producer eq 'GraphViz' ? $q->param('graphviz_output_type') + : ''; - my $t = SQL::Translator->new( - from => $q->param('parser'), - producer_args => { - add_drop_table => $q->param('add_drop_table'), - output_type => $output_type, - title => $q->param('title') || 'Schema', - natural_join => $q->param('natural_join') eq 'no' ? 0 : 1, - join_pk_only => $q->param('natural_join') eq 'pk_only' - ? 1 : 0, - add_color => $q->param('add_color'), - skip_fields => $q->param('skip_fields'), - show_fk_only => $q->param('show_fk_only'), - font_size => $q->param('font_size'), - no_columns => $q->param('no_columns'), - node_shape => $q->param('node_shape'), - layout => $q->param('layout') || '', - height => $q->param('height') || 0, - width => $q->param('width') || 0, - show_fields => $q->param('show_fields') || 0, - ttfile => $q->upload('template'), - validate => $q->param('validate'), - emit_empty_tags => $q->param('emit_empty_tags'), - attrib_values => $q->param('attrib_values'), - no_comments => !$q->param('comments'), - }, - parser_args => { - trim_fields => $q->param('trim_fields'), - scan_fields => $q->param('scan_fields'), - field_separator => $q->param('fs'), - record_separator => $q->param('rs'), - }, - ) or die SQL::Translator->error; + my $t = SQL::Translator->new( + from => $q->param('parser'), + producer_args => { + add_drop_table => $q->param('add_drop_table'), + output_type => $output_type, + title => $q->param('title') || 'Schema', + natural_join => $q->param('natural_join') eq 'no' ? 0 : 1, + join_pk_only => $q->param('natural_join') eq 'pk_only' ? 1 : 0, + add_color => $q->param('add_color'), + skip_fields => $q->param('skip_fields'), + show_fk_only => $q->param('show_fk_only'), + font_size => $q->param('font_size'), + no_columns => $q->param('no_columns'), + node_shape => $q->param('node_shape'), + layout => $q->param('layout') || '', + height => $q->param('height') || 0, + width => $q->param('width') || 0, + show_fields => $q->param('show_fields') || 0, + ttfile => $q->upload('template'), + validate => $q->param('validate'), + emit_empty_tags => $q->param('emit_empty_tags'), + attrib_values => $q->param('attrib_values'), + no_comments => !$q->param('comments'), + }, + parser_args => { + trim_fields => $q->param('trim_fields'), + scan_fields => $q->param('scan_fields'), + field_separator => $q->param('fs'), + record_separator => $q->param('rs'), + }, + ) or die SQL::Translator->error; - my $image_type = ''; - my $text_type = 'plain'; - if ( $output_type =~ /(gif|png|jpeg)/ ) { - $image_type = $output_type; - } - elsif ( $output_type eq 'svg' ) { - $image_type = 'svg+xml'; - } - elsif ( $output_type =~ /gd/ ) { - $image_type = 'png'; - } - elsif ( $output_type eq 'ps' ) { - $text_type = 'postscript'; - } - elsif ( $producer eq 'HTML' ) { - $text_type = 'html'; - } + my $image_type = ''; + my $text_type = 'plain'; + if ($output_type =~ /(gif|png|jpeg)/) { + $image_type = $output_type; + } elsif ($output_type eq 'svg') { + $image_type = 'svg+xml'; + } elsif ($output_type =~ /gd/) { + $image_type = 'png'; + } elsif ($output_type eq 'ps') { + $text_type = 'postscript'; + } elsif ($producer eq 'HTML') { + $text_type = 'html'; + } - my $header_type = $image_type ? "image/$image_type" : "text/$text_type"; + my $header_type = $image_type ? "image/$image_type" : "text/$text_type"; - $t->data( $data ); - $t->producer( $producer ); - my $output = $t->translate or die $t->error; + $t->data($data); + $t->producer($producer); + my $output = $t->translate or die $t->error; - print $q->header( -type => $header_type ), $output; - } - else { - show_form( $q ); - } + print $q->header(-type => $header_type), $output; + } else { + show_form($q); + } }; -if ( my $error = $@ ) { - print $q->header, $q->start_html('Error'), - $q->h1('Error'), $error, $q->end_html; +if (my $error = $@) { + print $q->header, $q->start_html('Error'), $q->h1('Error'), $error, $q->end_html; } # ------------------------------------------------------------------- sub show_form { - my $q = shift; - my $title = 'SQL::Translator'; + my $q = shift; + my $title = 'SQL::Translator'; - print $q->header, - $q->start_html( -title => $title ), - $q->h1( qq[$title] ), - $q->start_form(-enctype => 'multipart/form-data'), - $q->table( { -border => 1 }, - $q->Tr( - $q->td( [ - 'Upload your schema file:', - $q->filefield( -name => 'schema_file'), - ] ), - ), - $q->Tr( - $q->td( [ - 'Or paste your schema here:', - $q->textarea( - -name => 'schema', - -rows => 5, - -columns => 60, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Parser:', - $q->radio_group( - -name => 'parser', - -values => [ qw( MySQL PostgreSQL Oracle - Sybase Excel XML-SQLFairy xSV - ) ], - -default => 'MySQL', - -rows => 3, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Producer:', - $q->radio_group( - -name => 'producer', - -values => [ qw[ ClassDBI Diagram GraphViz HTML - MySQL Oracle POD PostgreSQL SQLite Sybase - TTSchema XML-SQLFairy - ] ], - -default => 'GraphViz', - -rows => 3, - ), - ] ), - ), - $q->Tr( - $q->td( - { -colspan => 2, -align => 'center' }, - $q->submit( - -name => 'submit', - -value => 'Submit', - ) - ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'General Options:' - ), - ), - $q->Tr( - $q->td( [ - 'Validate Schema:', - $q->radio_group( - -name => 'validate', - -values => [ 1, 0 ], - -labels => { - 1 => 'Yes', - 0 => 'No' - }, - -default => 0, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'DB Producer Options:' - ), - ), - $q->Tr( - $q->td( [ - 'Add "DROP TABLE" statements:', - $q->radio_group( - -name => 'add_drop_table', - -values => [ 1, 0 ], - -labels => { - 1 => 'Yes', - 0 => 'No' - }, - -default => 0, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Include comments:', - $q->radio_group( - -name => 'comments', - -values => [ 1, 0 ], - -labels => { - 1 => 'Yes', - 0 => 'No' - }, - -default => 1, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'HTML/POD/Diagram Producer Options:' - ), - ), - $q->Tr( - $q->td( [ - 'Title:', - $q->textfield('title'), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'TTSchema Producer Options:' - ), - ), - $q->Tr( - $q->td( [ - 'Template:', - $q->filefield( -name => 'template'), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'Graphical Producer Options' - ), - ), - $q->Tr( - $q->td( [ - 'Perform Natural Joins:', - $q->radio_group( - -name => 'natural_join', - -values => [ 'no', 'yes', 'pk_only' ], - -labels => { - no => 'No', - yes => 'Yes, on all like-named fields', - pk_only => 'Yes, but only from primary keys' - }, - -default => 'no', - -rows => 3, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Skip These Fields in Natural Joins:', - $q->textarea( - -name => 'skip_fields', - -rows => 3, - -columns => 60, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Show Only Foreign Keys:', - $q->radio_group( - -name => 'show_fk_only', - -values => [ 1, 0 ], - -default => 0, - -labels => { - 1 => 'Yes', - 0 => 'No', - }, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Add Color:', - $q->radio_group( - -name => 'add_color', - -values => [ 1, 0 ], - -labels => { - 1 => 'Yes', - 0 => 'No' - }, - -default => 1, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Show Field Names:', - $q->radio_group( - -name => 'show_fields', - -values => [ 1, 0 ], - -default => 1, - -labels => { - 1 => 'Yes', - 0 => 'No', - }, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'Diagram Producer Options' - ), - ), - $q->Tr( - $q->td( [ - 'Output Type:', - $q->radio_group( - -name => 'diagram_output_type', - -values => [ 'png', 'jpeg' ], - -default => 'png', - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Font Size:', - $q->radio_group( - -name => 'font_size', - -values => [ qw( small medium large ) ], - -default => 'medium', - -rows => 3, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Number of Columns:', - $q->textfield('no_columns'), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'GraphViz Producer Options' - ), - ), - $q->Tr( - $q->td( [ - 'Output Type:', - $q->radio_group( - -name => 'graphviz_output_type', - -values => [ qw( canon text ps hpgl pcl mif pic - gd gd2 gif jpeg png wbmp cmap ismap imap - vrml vtx mp fig svg plain - ) ], - -default => 'png', - -rows => 4, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Layout:', - $q->radio_group( - -name => 'layout', - -values => [ qw( dot neato twopi ) ], - -default => 'dot', - -rows => 3, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Node Shape:', - $q->radio_group( - -name => 'node_shape', - -values => [ qw( record plaintext ellipse - circle egg triangle box diamond trapezium - parallelogram house hexagon octagon - ) ], - -default => 'record', - -rows => 4, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Height:', - $q->textfield( -name => 'height' ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Width:', - $q->textfield( -name => 'width' ), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'XML Producer Options:' - ), - ), - $q->Tr( - $q->td( [ - 'Use attributes for values:', - $q->radio_group( - -name => 'attrib-values', - -values => [ 1, 0 ], - -labels => { - 1 => 'Yes', - 0 => 'No' - }, - -default => 0, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Emit Empty Tags:', - $q->radio_group( - -name => 'emit-empty-tags', - -values => [ 1, 0 ], - -labels => { - 1 => 'Yes', - 0 => 'No' - }, - -default => 0, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->th( - { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, - 'xSV Parser Options' - ), - ), - $q->Tr( - $q->td( [ - 'Field Separator:', - $q->textfield( -name => 'fs' ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Record Separator:', - $q->textfield( -name => 'rs' ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Trim Whitespace Around Fields:', - $q->radio_group( - -name => 'trim_fields', - -values => [ 1, 0 ], - -default => 1, - -labels => { - 1 => 'Yes', - 0 => 'No', - }, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->td( [ - 'Scan Fields for Data Type:', - $q->radio_group( - -name => 'scan_fields', - -values => [ 1, 0 ], - -default => 1, - -labels => { - 1 => 'Yes', - 0 => 'No', - }, - -rows => 2, - ), - ] ), - ), - $q->Tr( - $q->td( - { -colspan => 2, -align => 'center' }, - $q->submit( - -name => 'submit', - -value => 'Submit', - ) - ), - ), + print $q->header, + $q->start_html(-title => $title), + $q->h1(qq[$title]), + $q->start_form(-enctype => 'multipart/form-data'), $q->table( + { -border => 1 }, + $q->Tr($q->td([ 'Upload your schema file:', $q->filefield(-name => 'schema_file'), ]),), + $q->Tr( + $q->td([ + 'Or paste your schema here:', + $q->textarea( + -name => 'schema', + -rows => 5, + -columns => 60, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Parser:', + $q->radio_group( + -name => 'parser', + -values => [ qw( MySQL PostgreSQL Oracle + Sybase Excel XML-SQLFairy xSV + ) ], + -default => 'MySQL', + -rows => 3, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Producer:', + $q->radio_group( + -name => 'producer', + -values => [ qw[ ClassDBI Diagram GraphViz HTML + MySQL Oracle POD PostgreSQL SQLite Sybase + TTSchema XML-SQLFairy + ] ], + -default => 'GraphViz', + -rows => 3, + ), + ]), + ), + $q->Tr( + $q->td( + { -colspan => 2, -align => 'center' }, + $q->submit( + -name => 'submit', + -value => 'Submit', + ) + ), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'General Options:' + ), + ), + $q->Tr( + $q->td([ + 'Validate Schema:', + $q->radio_group( + -name => 'validate', + -values => [ 1, 0 ], + -labels => { + 1 => 'Yes', + 0 => 'No' + }, + -default => 0, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'DB Producer Options:' + ), + ), + $q->Tr( + $q->td([ + 'Add "DROP TABLE" statements:', + $q->radio_group( + -name => 'add_drop_table', + -values => [ 1, 0 ], + -labels => { + 1 => 'Yes', + 0 => 'No' + }, + -default => 0, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Include comments:', + $q->radio_group( + -name => 'comments', + -values => [ 1, 0 ], + -labels => { + 1 => 'Yes', + 0 => 'No' + }, + -default => 1, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'HTML/POD/Diagram Producer Options:' + ), + ), + $q->Tr( + $q->td([ + 'Title:', + $q->textfield('title'), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'TTSchema Producer Options:' + ), + ), + $q->Tr( + $q->td([ + 'Template:', + $q->filefield(-name => 'template'), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'Graphical Producer Options' + ), + ), + $q->Tr( + $q->td([ + 'Perform Natural Joins:', + $q->radio_group( + -name => 'natural_join', + -values => [ 'no', 'yes', 'pk_only' ], + -labels => { + no => 'No', + yes => 'Yes, on all like-named fields', + pk_only => 'Yes, but only from primary keys' + }, + -default => 'no', + -rows => 3, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Skip These Fields in Natural Joins:', + $q->textarea( + -name => 'skip_fields', + -rows => 3, + -columns => 60, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Show Only Foreign Keys:', + $q->radio_group( + -name => 'show_fk_only', + -values => [ 1, 0 ], + -default => 0, + -labels => { + 1 => 'Yes', + 0 => 'No', + }, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Add Color:', + $q->radio_group( + -name => 'add_color', + -values => [ 1, 0 ], + -labels => { + 1 => 'Yes', + 0 => 'No' + }, + -default => 1, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Show Field Names:', + $q->radio_group( + -name => 'show_fields', + -values => [ 1, 0 ], + -default => 1, + -labels => { + 1 => 'Yes', + 0 => 'No', + }, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'Diagram Producer Options' + ), + ), + $q->Tr( + $q->td([ + 'Output Type:', + $q->radio_group( + -name => 'diagram_output_type', + -values => [ 'png', 'jpeg' ], + -default => 'png', + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Font Size:', + $q->radio_group( + -name => 'font_size', + -values => [qw( small medium large )], + -default => 'medium', + -rows => 3, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Number of Columns:', + $q->textfield('no_columns'), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'GraphViz Producer Options' + ), + ), + $q->Tr( + $q->td([ + 'Output Type:', + $q->radio_group( + -name => 'graphviz_output_type', + -values => [ qw( canon text ps hpgl pcl mif pic + gd gd2 gif jpeg png wbmp cmap ismap imap + vrml vtx mp fig svg plain + ) ], + -default => 'png', + -rows => 4, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Layout:', + $q->radio_group( + -name => 'layout', + -values => [qw( dot neato twopi )], + -default => 'dot', + -rows => 3, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Node Shape:', + $q->radio_group( + -name => 'node_shape', + -values => [ qw( record plaintext ellipse + circle egg triangle box diamond trapezium + parallelogram house hexagon octagon + ) ], + -default => 'record', + -rows => 4, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Height:', + $q->textfield(-name => 'height'), + ]), + ), + $q->Tr( + $q->td([ + 'Width:', + $q->textfield(-name => 'width'), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'XML Producer Options:' + ), + ), + $q->Tr( + $q->td([ + 'Use attributes for values:', + $q->radio_group( + -name => 'attrib-values', + -values => [ 1, 0 ], + -labels => { + 1 => 'Yes', + 0 => 'No' + }, + -default => 0, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Emit Empty Tags:', + $q->radio_group( + -name => 'emit-empty-tags', + -values => [ 1, 0 ], + -labels => { + 1 => 'Yes', + 0 => 'No' + }, + -default => 0, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->th( + { align => 'left', bgcolor => 'lightgrey', colspan => 2 }, + 'xSV Parser Options' + ), + ), + $q->Tr( + $q->td([ + 'Field Separator:', + $q->textfield(-name => 'fs'), + ]), + ), + $q->Tr( + $q->td([ + 'Record Separator:', + $q->textfield(-name => 'rs'), + ]), + ), + $q->Tr( + $q->td([ + 'Trim Whitespace Around Fields:', + $q->radio_group( + -name => 'trim_fields', + -values => [ 1, 0 ], + -default => 1, + -labels => { + 1 => 'Yes', + 0 => 'No', + }, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->td([ + 'Scan Fields for Data Type:', + $q->radio_group( + -name => 'scan_fields', + -values => [ 1, 0 ], + -default => 1, + -labels => { + 1 => 'Yes', + 0 => 'No', + }, + -rows => 2, + ), + ]), + ), + $q->Tr( + $q->td( + { -colspan => 2, -align => 'center' }, + $q->submit( + -name => 'submit', + -value => 'Submit', + ) + ), ), - $q->end_form, - $q->end_html; + ), + $q->end_form, + $q->end_html; } # ------------------------------------------------------------------- diff --git a/t/02mysql-parser.t b/t/02mysql-parser.t index d521b9d6e..397161d62 100644 --- a/t/02mysql-parser.t +++ b/t/02mysql-parser.t @@ -8,17 +8,17 @@ use Test::More; use SQL::Translator; use SQL::Translator::Schema::Constants; use SQL::Translator::Utils qw//; -use Test::SQL::Translator qw(maybe_plan); -use FindBin qw/$Bin/; +use Test::SQL::Translator qw(maybe_plan); +use FindBin qw/$Bin/; BEGIN { - maybe_plan(undef, "SQL::Translator::Parser::MySQL"); - SQL::Translator::Parser::MySQL->import('parse'); + maybe_plan(undef, "SQL::Translator::Parser::MySQL"); + SQL::Translator::Parser::MySQL->import('parse'); } { - my $tr = SQL::Translator->new; - my $data = q|create table "sessions" ( + my $tr = SQL::Translator->new; + my $data = q|create table "sessions" ( id char(32) not null default '0' primary key, a_session text, ssn varchar(12) unique key, @@ -26,51 +26,52 @@ BEGIN { fulltext key `session_fulltext` (a_session) );|; - my $val = parse($tr, $data); - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Right number of tables (1)' ); - my $table = shift @tables; - is( $table->name, 'sessions', 'Found "sessions" table' ); - - my @fields = $table->get_fields; - is( scalar @fields, 4, 'Right number of fields (4)' ); - my $f1 = shift @fields; - my $f2 = shift @fields; - is( $f1->name, 'id', 'First field name is "id"' ); - is( $f1->data_type, 'char', 'Type is "char"' ); - is( $f1->size, 32, 'Size is "32"' ); - is( $f1->is_nullable, 0, 'Field cannot be null' ); - is( $f1->default_value, '0', 'Default value is "0"' ); - is( $f1->is_primary_key, 1, 'Field is PK' ); - - is( $f2->name, 'a_session', 'Second field name is "a_session"' ); - is( $f2->data_type, 'text', 'Type is "text"' ); - is( $f2->size, 65_535, 'Size is "65,535"' ); - is( $f2->is_nullable, 1, 'Field can be null' ); - is( $f2->default_value, undef, 'Default value is undefined' ); - is( $f2->is_primary_key, 0, 'Field is not PK' ); - - my @indices = $table->get_indices; - is( scalar @indices, 2, 'Right number of indices (2)' ); - my $i = pop @indices; - is( $i->type, 'FULLTEXT', 'Found fulltext' ); - - my @constraints = $table->get_constraints; - is( scalar @constraints, 2, 'Right number of constraints (2)' ); - my $c = shift @constraints; - is( $c->type, PRIMARY_KEY, 'Constraint is a PK' ); - is( join(',', $c->fields), 'id', 'Constraint is on "id"' ); - my $c2 = shift @constraints; - is( $c2->type, UNIQUE, 'Constraint is UNIQUE' ); - is( join(',', $c2->fields), 'ssn', 'Constraint is on "ssn"' ); + my $val = parse($tr, $data); + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Right number of tables (1)'); + my $table = shift @tables; + is($table->name, 'sessions', 'Found "sessions" table'); + + my @fields = $table->get_fields; + is(scalar @fields, 4, 'Right number of fields (4)'); + my $f1 = shift @fields; + my $f2 = shift @fields; + is($f1->name, 'id', 'First field name is "id"'); + is($f1->data_type, 'char', 'Type is "char"'); + is($f1->size, 32, 'Size is "32"'); + is($f1->is_nullable, 0, 'Field cannot be null'); + is($f1->default_value, '0', 'Default value is "0"'); + is($f1->is_primary_key, 1, 'Field is PK'); + + is($f2->name, 'a_session', 'Second field name is "a_session"'); + is($f2->data_type, 'text', 'Type is "text"'); + is($f2->size, 65_535, 'Size is "65,535"'); + is($f2->is_nullable, 1, 'Field can be null'); + is($f2->default_value, undef, 'Default value is undefined'); + is($f2->is_primary_key, 0, 'Field is not PK'); + + my @indices = $table->get_indices; + is(scalar @indices, 2, 'Right number of indices (2)'); + my $i = pop @indices; + is($i->type, 'FULLTEXT', 'Found fulltext'); + + my @constraints = $table->get_constraints; + is(scalar @constraints, 2, 'Right number of constraints (2)'); + my $c = shift @constraints; + is($c->type, PRIMARY_KEY, 'Constraint is a PK'); + is(join(',', $c->fields), 'id', 'Constraint is on "id"'); + my $c2 = shift @constraints; + is($c2->type, UNIQUE, 'Constraint is UNIQUE'); + is(join(',', $c2->fields), 'ssn', 'Constraint is on "ssn"'); } { - my $tr = SQL::Translator->new; - my $data = parse($tr, - q[ + my $tr = SQL::Translator->new; + my $data = parse( + $tr, + q[ CREATE TABLE `check` ( check_id int(7) unsigned zerofill NOT NULL default '0000000' auto_increment primary key, @@ -92,165 +93,166 @@ BEGIN { KEY name_idx (name(10)) ) TYPE=MyISAM PACK_KEYS=1; ] - ); - - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Right number of tables (1)' ); - my $table = shift @tables; - is( $table->name, 'check', 'Found "check" table' ); - - my @fields = $table->get_fields; - is( scalar @fields, 13, 'Right number of fields (13)' ); - my $f1 = shift @fields; - is( $f1->name, 'check_id', 'First field name is "check_id"' ); - is( $f1->data_type, 'int', 'Type is "int"' ); - is( $f1->size, 7, 'Size is "7"' ); - is( $f1->is_nullable, 0, 'Field cannot be null' ); - is( $f1->default_value, '0000000', 'Default value is "0000000"' ); - is( $f1->is_primary_key, 1, 'Field is PK' ); - is( $f1->is_auto_increment, 1, 'Field is auto inc' ); - my %extra = $f1->extra; - ok( defined $extra{'unsigned'}, 'Field is unsigned' ); - ok( defined $extra{'zerofill'}, 'Field is zerofill' ); - - my $f2 = shift @fields; - is( $f2->name, 'successful', 'Second field name is "successful"' ); - is( $f2->data_type, 'date', 'Type is "date"' ); - is( $f2->size, 0, 'Size is "0"' ); - is( $f2->is_nullable, 0, 'Field cannot be null' ); - is( $f2->default_value, '0000-00-00', 'Default value is "0000-00-00"' ); - is( $f2->is_primary_key, 0, 'Field is not PK' ); - - my $f3 = shift @fields; - is( $f3->name, 'unsuccessful', 'Third field name is "unsuccessful"' ); - is( $f3->data_type, 'date', 'Type is "date"' ); - is( $f3->size, 0, 'Size is "0"' ); - is( $f3->is_nullable, 1, 'Field can be null' ); - is( $f3->default_value, '0000-00-00', 'Default value is "0000-00-00"' ); - is( $f3->is_primary_key, 0, 'Field is not PK' ); - - my $f4 = shift @fields; - is( $f4->name, 'i1', 'Fourth field name is "i1"' ); - is( $f4->data_type, 'int', 'Type is "int"' ); - is( $f4->size, 11, 'Size is "11"' ); - is( $f4->is_nullable, 0, 'Field cannot be null' ); - is( $f4->default_value, '0', 'Default value is "0"' ); - is( $f4->is_primary_key, 0, 'Field is not PK' ); - - my $f5 = shift @fields; - is( $f5->name, 's1', 'Fifth field name is "s1"' ); - is( $f5->data_type, 'set', 'Type is "set"' ); - is( $f5->size, 1, 'Size is "1"' ); - is( $f5->is_nullable, 1, 'Field can be null' ); - is( $f5->default_value, 'b', 'Default value is "b"' ); - is( $f5->is_primary_key, 0, 'Field is not PK' ); - my %f5extra = $f5->extra; - is( join(',', @{ $f5extra{'list'} || [] }), 'a,b,c', 'List is "a,b,c"' ); - - my $f6 = shift @fields; - is( $f6->name, 'e1', 'Sixth field name is "e1"' ); - is( $f6->data_type, 'enum', 'Type is "enum"' ); - is( $f6->size, 1, 'Size is "1"' ); - is( $f6->is_nullable, 1, 'Field can be null' ); - is( $f6->default_value, 'c', 'Default value is "c"' ); - is( $f6->is_primary_key, 0, 'Field is not PK' ); - my %f6extra = $f6->extra; - is( join(',', @{ $f6extra{'list'} || [] }), 'a,b,c', 'List is "a,b,c"' ); - - my $f7 = shift @fields; - is( $f7->name, 'name', 'Seventh field name is "name"' ); - is( $f7->data_type, 'varchar', 'Type is "varchar"' ); - is( $f7->size, 30, 'Size is "30"' ); - is( $f7->is_nullable, 1, 'Field can be null' ); - is( $f7->default_value, 'NULL', 'Default value is "NULL"' ); - is( $f7->is_primary_key, 0, 'Field is not PK' ); - - my $f8 = shift @fields; - is( $f8->name, 'foo_type', 'Eighth field name is "foo_type"' ); - is( $f8->data_type, 'enum', 'Type is "enum"' ); - is( $f8->size, 3, 'Size is "2"' ); - is( $f8->is_nullable, 0, 'Field cannot be null' ); - is( $f8->default_value, 'vk', 'Default value is "vk"' ); - is( $f8->is_primary_key, 0, 'Field is not PK' ); - my %f8extra = $f8->extra; - is( join(',', @{ $f8extra{'list'} || [] }), 'vk,c\'k', 'List is "vk,c\'k"' ); - - my $f9 = shift @fields; - is( $f9->name, 'date', 'Ninth field name is "date"' ); - is( $f9->data_type, 'timestamp', 'Type is "timestamp"' ); - is( $f9->size, 0, 'Size is "0"' ); - is( $f9->is_nullable, 1, 'Field can be null' ); - is( $f9->default_value, undef, 'Default value is undefined' ); - is( $f9->is_primary_key, 0, 'Field is not PK' ); - - my $f10 = shift @fields; - is( $f10->name, 'time_stamp2', 'Tenth field name is "time_stamp2"' ); - is( $f10->data_type, 'timestamp', 'Type is "timestamp"' ); - is( $f10->size, 0, 'Size is "0"' ); - is( $f10->is_nullable, 1, 'Field can be null' ); - is( $f10->default_value, undef, 'Default value is undefined' ); - is( $f10->is_primary_key, 0, 'Field is not PK' ); - - my $f11 = shift @fields; - is( $f11->name, 'foo_enabled', 'Eleventh field name is "foo_enabled"' ); - is( $f11->data_type, 'bit', 'Type is "bit"' ); - is( $f11->size, 1, 'Size is "1"' ); - is( $f11->is_nullable, 1, 'Field can be null' ); - is( $f11->default_value, '0', 'Default value is 0' ); - is( $f11->is_primary_key, 0, 'Field is not PK' ); - - my $f12 = shift @fields; - is( $f12->name, 'bar_enabled', 'Twelveth field name is "bar_enabled"' ); - is( $f12->data_type, 'bit', 'Type is "bit"' ); - is( $f12->size, 1, 'Size is "1"' ); - is( $f12->is_nullable, 1, 'Field can be null' ); - is( $f12->default_value, '1', 'Default value is 1' ); - is( $f12->is_primary_key, 0, 'Field is not PK' ); - - my $f13 = shift @fields; - is( $f13->name, 'long_foo_enabled', 'Thirteenth field name is "long_foo_enabled"' ); - is( $f13->data_type, 'bit', 'Type is "bit"' ); - is( $f13->size, 10, 'Size is "10"' ); - is( $f13->is_nullable, 1, 'Field can be null' ); - is( $f13->default_value, '1010101', 'Default value is 1010101' ); - is( $f13->is_primary_key, 0, 'Field is not PK' ); - - my @indices = $table->get_indices; - is( scalar @indices, 3, 'Right number of indices (3)' ); - - my $i1 = shift @indices; - is( $i1->name, '', 'No name on index' ); - is( $i1->type, NORMAL, 'Normal index' ); - is( join(',', $i1->fields ), 'i1', 'Index is on field "i1"' ); - - my $i2 = shift @indices; - is( $i2->name, 'date_idx', 'Name is "date_idx"' ); - is( $i2->type, NORMAL, 'Normal index' ); - is( join(',', $i2->fields ), 'date', 'Index is on field "date"' ); - - my $i3 = shift @indices; - is( $i3->name, 'name_idx', 'Name is "name_idx"' ); - is( $i3->type, NORMAL, 'Normal index' ); - is( join(',', $i3->fields ), 'name(10)', 'Index is on field "name(10)"' ); - - my @constraints = $table->get_constraints; - is( scalar @constraints, 2, 'Right number of constraints (2)' ); - - my $c1 = shift @constraints; - is( $c1->type, PRIMARY_KEY, 'Constraint is a PK' ); - is( join(',', $c1->fields), 'check_id', 'Constraint is on "check_id"' ); - - my $c2 = shift @constraints; - is( $c2->type, UNIQUE, 'Constraint is UNIQUE' ); - is( join(',', $c2->fields), 'date,i1', 'Constraint is on "date, i1"' ); + ); + + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Right number of tables (1)'); + my $table = shift @tables; + is($table->name, 'check', 'Found "check" table'); + + my @fields = $table->get_fields; + is(scalar @fields, 13, 'Right number of fields (13)'); + my $f1 = shift @fields; + is($f1->name, 'check_id', 'First field name is "check_id"'); + is($f1->data_type, 'int', 'Type is "int"'); + is($f1->size, 7, 'Size is "7"'); + is($f1->is_nullable, 0, 'Field cannot be null'); + is($f1->default_value, '0000000', 'Default value is "0000000"'); + is($f1->is_primary_key, 1, 'Field is PK'); + is($f1->is_auto_increment, 1, 'Field is auto inc'); + my %extra = $f1->extra; + ok(defined $extra{'unsigned'}, 'Field is unsigned'); + ok(defined $extra{'zerofill'}, 'Field is zerofill'); + + my $f2 = shift @fields; + is($f2->name, 'successful', 'Second field name is "successful"'); + is($f2->data_type, 'date', 'Type is "date"'); + is($f2->size, 0, 'Size is "0"'); + is($f2->is_nullable, 0, 'Field cannot be null'); + is($f2->default_value, '0000-00-00', 'Default value is "0000-00-00"'); + is($f2->is_primary_key, 0, 'Field is not PK'); + + my $f3 = shift @fields; + is($f3->name, 'unsuccessful', 'Third field name is "unsuccessful"'); + is($f3->data_type, 'date', 'Type is "date"'); + is($f3->size, 0, 'Size is "0"'); + is($f3->is_nullable, 1, 'Field can be null'); + is($f3->default_value, '0000-00-00', 'Default value is "0000-00-00"'); + is($f3->is_primary_key, 0, 'Field is not PK'); + + my $f4 = shift @fields; + is($f4->name, 'i1', 'Fourth field name is "i1"'); + is($f4->data_type, 'int', 'Type is "int"'); + is($f4->size, 11, 'Size is "11"'); + is($f4->is_nullable, 0, 'Field cannot be null'); + is($f4->default_value, '0', 'Default value is "0"'); + is($f4->is_primary_key, 0, 'Field is not PK'); + + my $f5 = shift @fields; + is($f5->name, 's1', 'Fifth field name is "s1"'); + is($f5->data_type, 'set', 'Type is "set"'); + is($f5->size, 1, 'Size is "1"'); + is($f5->is_nullable, 1, 'Field can be null'); + is($f5->default_value, 'b', 'Default value is "b"'); + is($f5->is_primary_key, 0, 'Field is not PK'); + my %f5extra = $f5->extra; + is(join(',', @{ $f5extra{'list'} || [] }), 'a,b,c', 'List is "a,b,c"'); + + my $f6 = shift @fields; + is($f6->name, 'e1', 'Sixth field name is "e1"'); + is($f6->data_type, 'enum', 'Type is "enum"'); + is($f6->size, 1, 'Size is "1"'); + is($f6->is_nullable, 1, 'Field can be null'); + is($f6->default_value, 'c', 'Default value is "c"'); + is($f6->is_primary_key, 0, 'Field is not PK'); + my %f6extra = $f6->extra; + is(join(',', @{ $f6extra{'list'} || [] }), 'a,b,c', 'List is "a,b,c"'); + + my $f7 = shift @fields; + is($f7->name, 'name', 'Seventh field name is "name"'); + is($f7->data_type, 'varchar', 'Type is "varchar"'); + is($f7->size, 30, 'Size is "30"'); + is($f7->is_nullable, 1, 'Field can be null'); + is($f7->default_value, 'NULL', 'Default value is "NULL"'); + is($f7->is_primary_key, 0, 'Field is not PK'); + + my $f8 = shift @fields; + is($f8->name, 'foo_type', 'Eighth field name is "foo_type"'); + is($f8->data_type, 'enum', 'Type is "enum"'); + is($f8->size, 3, 'Size is "2"'); + is($f8->is_nullable, 0, 'Field cannot be null'); + is($f8->default_value, 'vk', 'Default value is "vk"'); + is($f8->is_primary_key, 0, 'Field is not PK'); + my %f8extra = $f8->extra; + is(join(',', @{ $f8extra{'list'} || [] }), 'vk,c\'k', 'List is "vk,c\'k"'); + + my $f9 = shift @fields; + is($f9->name, 'date', 'Ninth field name is "date"'); + is($f9->data_type, 'timestamp', 'Type is "timestamp"'); + is($f9->size, 0, 'Size is "0"'); + is($f9->is_nullable, 1, 'Field can be null'); + is($f9->default_value, undef, 'Default value is undefined'); + is($f9->is_primary_key, 0, 'Field is not PK'); + + my $f10 = shift @fields; + is($f10->name, 'time_stamp2', 'Tenth field name is "time_stamp2"'); + is($f10->data_type, 'timestamp', 'Type is "timestamp"'); + is($f10->size, 0, 'Size is "0"'); + is($f10->is_nullable, 1, 'Field can be null'); + is($f10->default_value, undef, 'Default value is undefined'); + is($f10->is_primary_key, 0, 'Field is not PK'); + + my $f11 = shift @fields; + is($f11->name, 'foo_enabled', 'Eleventh field name is "foo_enabled"'); + is($f11->data_type, 'bit', 'Type is "bit"'); + is($f11->size, 1, 'Size is "1"'); + is($f11->is_nullable, 1, 'Field can be null'); + is($f11->default_value, '0', 'Default value is 0'); + is($f11->is_primary_key, 0, 'Field is not PK'); + + my $f12 = shift @fields; + is($f12->name, 'bar_enabled', 'Twelveth field name is "bar_enabled"'); + is($f12->data_type, 'bit', 'Type is "bit"'); + is($f12->size, 1, 'Size is "1"'); + is($f12->is_nullable, 1, 'Field can be null'); + is($f12->default_value, '1', 'Default value is 1'); + is($f12->is_primary_key, 0, 'Field is not PK'); + + my $f13 = shift @fields; + is($f13->name, 'long_foo_enabled', 'Thirteenth field name is "long_foo_enabled"'); + is($f13->data_type, 'bit', 'Type is "bit"'); + is($f13->size, 10, 'Size is "10"'); + is($f13->is_nullable, 1, 'Field can be null'); + is($f13->default_value, '1010101', 'Default value is 1010101'); + is($f13->is_primary_key, 0, 'Field is not PK'); + + my @indices = $table->get_indices; + is(scalar @indices, 3, 'Right number of indices (3)'); + + my $i1 = shift @indices; + is($i1->name, '', 'No name on index'); + is($i1->type, NORMAL, 'Normal index'); + is(join(',', $i1->fields), 'i1', 'Index is on field "i1"'); + + my $i2 = shift @indices; + is($i2->name, 'date_idx', 'Name is "date_idx"'); + is($i2->type, NORMAL, 'Normal index'); + is(join(',', $i2->fields), 'date', 'Index is on field "date"'); + + my $i3 = shift @indices; + is($i3->name, 'name_idx', 'Name is "name_idx"'); + is($i3->type, NORMAL, 'Normal index'); + is(join(',', $i3->fields), 'name(10)', 'Index is on field "name(10)"'); + + my @constraints = $table->get_constraints; + is(scalar @constraints, 2, 'Right number of constraints (2)'); + + my $c1 = shift @constraints; + is($c1->type, PRIMARY_KEY, 'Constraint is a PK'); + is(join(',', $c1->fields), 'check_id', 'Constraint is on "check_id"'); + + my $c2 = shift @constraints; + is($c2->type, UNIQUE, 'Constraint is UNIQUE'); + is(join(',', $c2->fields), 'date,i1', 'Constraint is on "date, i1"'); } { - my $tr = SQL::Translator->new; - my $data = parse($tr, - q[ + my $tr = SQL::Translator->new; + my $data = parse( + $tr, + q[ CREATE TABLE orders ( order_id integer NOT NULL comment ' ' auto_increment, member_id varchar(255) comment 'fk to ''member''', @@ -284,149 +286,139 @@ BEGIN { PRIMARY KEY (address_id) ) TYPE=INNODB; ] - ) or die $tr->error; - - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 2, 'Right number of tables (2)' ); - - my $t1 = shift @tables; - is( $t1->name, 'orders', 'Found "orders" table' ); - is( $t1->comments, 'orders table comment', 'Table comment OK' ); - - my @fields = $t1->get_fields; - is( scalar @fields, 10, 'Right number of fields (10)' ); - - my $f1 = shift @fields; - is( $f1->name, 'order_id', 'First field name is "order_id"' ); - is( $f1->data_type, 'int', 'Type is "int"' ); - is( $f1->size, 11, 'Size is "11"' ); - is( $f1->is_nullable, 0, 'Field cannot be null' ); - is( $f1->default_value, undef, 'Default value is undefined' ); - is( $f1->is_primary_key, 1, 'Field is PK' ); - is( $f1->is_auto_increment, 1, 'Field is auto inc' ); - is_deeply( [$f1->comments],[' '], 'Field comment OK' ); - - my $f2 = shift @fields; - is( $f2->name, 'member_id', 'Second field name is "member_id"' ); - is( $f2->data_type, 'varchar', 'Type is "varchar"' ); - is( $f2->size, 255, 'Size is "255"' ); - is( $f2->is_nullable, 1, 'Field can be null' ); - is( $f2->comments, 'fk to \'member\'', 'Field comment OK' ); - is( $f2->default_value, undef, 'Default value is undefined' ); - - my $f3 = shift @fields; - is( $f3->name, 'billing_address_id', - 'Third field name is "billing_address_id"' ); - is( $f3->data_type, 'int', 'Type is "int"' ); - is( $f3->size, 11, 'Size is "11"' ); - - my $f4 = shift @fields; - is( $f4->name, 'shipping_address_id', - 'Fourth field name is "shipping_address_id"' ); - is( $f4->data_type, 'int', 'Type is "int"' ); - is( $f4->size, 11, 'Size is "11"' ); - - my $f5 = shift @fields; - is( $f5->name, 'credit_card_id', 'Fifth field name is "credit_card_id"' ); - is( $f5->data_type, 'int', 'Type is "int"' ); - is( $f5->size, 11, 'Size is "11"' ); - - my $f6 = shift @fields; - is( $f6->name, 'status', 'Sixth field name is "status"' ); - is( $f6->data_type, 'smallint', 'Type is "smallint"' ); - is( $f6->size, 6, 'Size is "6"' ); - is( $f6->is_nullable, 0, 'Field cannot be null' ); - - my $f7 = shift @fields; - is( $f7->name, 'store_id', 'Seventh field name is "store_id"' ); - is( $f7->data_type, 'varchar', 'Type is "varchar"' ); - is( $f7->size, 255, 'Size is "255"' ); - is( $f7->is_nullable, 0, 'Field cannot be null' ); - is( $f7->is_foreign_key, 1, 'Field is a FK' ); - my $fk_ref = $f7->foreign_key_reference; - isa_ok( $fk_ref, 'SQL::Translator::Schema::Constraint', 'FK' ); - is( $fk_ref->reference_table, 'store', 'FK is to "store" table' ); - - my $f8 = shift @fields; - is( $f8->name, 'tax', 'Eighth field name is "tax"' ); - is( $f8->data_type, 'decimal', 'Type is "decimal"' ); - is( $f8->size, '8,2', 'Size is "8,2"' ); - - my $f9 = shift @fields; - is( $f9->name, 'shipping_charge', 'Ninth field name is "shipping_charge"' ); - is( $f9->data_type, 'decimal', 'Type is "decimal"' ); - is( $f9->size, '8,2', 'Size is "8,2"' ); - - my $f10 = shift @fields; - is( $f10->name, 'price_paid', 'Tenth field name is "price_paid"' ); - is( $f10->data_type, 'decimal', 'Type is "decimal"' ); - is( $f10->size, '8,2', 'Size is "8,2"' ); - - my @indices = $t1->get_indices; - is( scalar @indices, 4, 'Right number of indices (4)' ); - - my $i1 = shift @indices; - is( $i1->type, NORMAL, 'First index is normal' ); - is( join(',', $i1->fields), 'status', 'Index is on "status"' ); - - my $i2 = shift @indices; - is( $i2->type, NORMAL, 'Second index is normal' ); - is( join(',', $i2->fields), 'billing_address_id', - 'Index is on "billing_address_id"' ); - - my $i3 = shift @indices; - is( $i3->type, NORMAL, 'Third index is normal' ); - is( join(',', $i3->fields), 'shipping_address_id', - 'Index is on "shipping_address_id"' ); - - my $i4 = shift @indices; - is( $i4->type, NORMAL, 'Third index is normal' ); - is( join(',', $i4->fields), 'member_id,store_id', - 'Index is on "member_id,store_id"' ); - - my @constraints = $t1->get_constraints; - is( scalar @constraints, 5, 'Right number of constraints (5)' ); - - my $c1 = shift @constraints; - is( $c1->type, PRIMARY_KEY, 'Constraint is a PK' ); - is( join(',', $c1->fields), 'order_id', 'Constraint is on "order_id"' ); - - my $c2 = shift @constraints; - is( $c2->type, FOREIGN_KEY, 'Constraint is a FK' ); - is( join(',', $c2->fields), 'status', 'Constraint is on "status"' ); - is( $c2->reference_table, 'order_status', 'To table "order_status"' ); - is( join(',', $c2->reference_fields), 'id', 'To field "id"' ); - - my $c3 = shift @constraints; - is( $c3->type, FOREIGN_KEY, 'Constraint is a FK' ); - is( join(',', $c3->fields), 'billing_address_id', - 'Constraint is on "billing_address_id"' ); - is( $c3->reference_table, 'address', 'To table "address"' ); - is( join(',', $c3->reference_fields), 'address_id', - 'To field "address_id"' ); - - my $c4 = shift @constraints; - is( $c4->type, FOREIGN_KEY, 'Constraint is a FK' ); - is( join(',', $c4->fields), 'shipping_address_id', - 'Constraint is on "shipping_address_id"' ); - is( $c4->reference_table, 'address', 'To table "address"' ); - is( join(',', $c4->reference_fields), 'address_id', - 'To field "address_id"' ); - - my $c5 = shift @constraints; - is( $c5->type, FOREIGN_KEY, 'Constraint is a FK' ); - is( join(',', $c5->fields), 'store_id', 'Constraint is on "store_id"' ); - is( $c5->reference_table, 'store', 'To table "store"' ); - is( join(',', map { $_ || '' } $c5->reference_fields), '', - 'No reference fields defined' ); - - my $t2 = shift @tables; - is( $t2->name, 'address', 'Found "address" table' ); - - my @t2_fields = $t2->get_fields; - is( scalar @t2_fields, 8, 'Right number of fields (8)' ); + ) or die $tr->error; + + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 2, 'Right number of tables (2)'); + + my $t1 = shift @tables; + is($t1->name, 'orders', 'Found "orders" table'); + is($t1->comments, 'orders table comment', 'Table comment OK'); + + my @fields = $t1->get_fields; + is(scalar @fields, 10, 'Right number of fields (10)'); + + my $f1 = shift @fields; + is($f1->name, 'order_id', 'First field name is "order_id"'); + is($f1->data_type, 'int', 'Type is "int"'); + is($f1->size, 11, 'Size is "11"'); + is($f1->is_nullable, 0, 'Field cannot be null'); + is($f1->default_value, undef, 'Default value is undefined'); + is($f1->is_primary_key, 1, 'Field is PK'); + is($f1->is_auto_increment, 1, 'Field is auto inc'); + is_deeply([ $f1->comments ], [' '], 'Field comment OK'); + + my $f2 = shift @fields; + is($f2->name, 'member_id', 'Second field name is "member_id"'); + is($f2->data_type, 'varchar', 'Type is "varchar"'); + is($f2->size, 255, 'Size is "255"'); + is($f2->is_nullable, 1, 'Field can be null'); + is($f2->comments, 'fk to \'member\'', 'Field comment OK'); + is($f2->default_value, undef, 'Default value is undefined'); + + my $f3 = shift @fields; + is($f3->name, 'billing_address_id', 'Third field name is "billing_address_id"'); + is($f3->data_type, 'int', 'Type is "int"'); + is($f3->size, 11, 'Size is "11"'); + + my $f4 = shift @fields; + is($f4->name, 'shipping_address_id', 'Fourth field name is "shipping_address_id"'); + is($f4->data_type, 'int', 'Type is "int"'); + is($f4->size, 11, 'Size is "11"'); + + my $f5 = shift @fields; + is($f5->name, 'credit_card_id', 'Fifth field name is "credit_card_id"'); + is($f5->data_type, 'int', 'Type is "int"'); + is($f5->size, 11, 'Size is "11"'); + + my $f6 = shift @fields; + is($f6->name, 'status', 'Sixth field name is "status"'); + is($f6->data_type, 'smallint', 'Type is "smallint"'); + is($f6->size, 6, 'Size is "6"'); + is($f6->is_nullable, 0, 'Field cannot be null'); + + my $f7 = shift @fields; + is($f7->name, 'store_id', 'Seventh field name is "store_id"'); + is($f7->data_type, 'varchar', 'Type is "varchar"'); + is($f7->size, 255, 'Size is "255"'); + is($f7->is_nullable, 0, 'Field cannot be null'); + is($f7->is_foreign_key, 1, 'Field is a FK'); + my $fk_ref = $f7->foreign_key_reference; + isa_ok($fk_ref, 'SQL::Translator::Schema::Constraint', 'FK'); + is($fk_ref->reference_table, 'store', 'FK is to "store" table'); + + my $f8 = shift @fields; + is($f8->name, 'tax', 'Eighth field name is "tax"'); + is($f8->data_type, 'decimal', 'Type is "decimal"'); + is($f8->size, '8,2', 'Size is "8,2"'); + + my $f9 = shift @fields; + is($f9->name, 'shipping_charge', 'Ninth field name is "shipping_charge"'); + is($f9->data_type, 'decimal', 'Type is "decimal"'); + is($f9->size, '8,2', 'Size is "8,2"'); + + my $f10 = shift @fields; + is($f10->name, 'price_paid', 'Tenth field name is "price_paid"'); + is($f10->data_type, 'decimal', 'Type is "decimal"'); + is($f10->size, '8,2', 'Size is "8,2"'); + + my @indices = $t1->get_indices; + is(scalar @indices, 4, 'Right number of indices (4)'); + + my $i1 = shift @indices; + is($i1->type, NORMAL, 'First index is normal'); + is(join(',', $i1->fields), 'status', 'Index is on "status"'); + + my $i2 = shift @indices; + is($i2->type, NORMAL, 'Second index is normal'); + is(join(',', $i2->fields), 'billing_address_id', 'Index is on "billing_address_id"'); + + my $i3 = shift @indices; + is($i3->type, NORMAL, 'Third index is normal'); + is(join(',', $i3->fields), 'shipping_address_id', 'Index is on "shipping_address_id"'); + + my $i4 = shift @indices; + is($i4->type, NORMAL, 'Third index is normal'); + is(join(',', $i4->fields), 'member_id,store_id', 'Index is on "member_id,store_id"'); + + my @constraints = $t1->get_constraints; + is(scalar @constraints, 5, 'Right number of constraints (5)'); + + my $c1 = shift @constraints; + is($c1->type, PRIMARY_KEY, 'Constraint is a PK'); + is(join(',', $c1->fields), 'order_id', 'Constraint is on "order_id"'); + + my $c2 = shift @constraints; + is($c2->type, FOREIGN_KEY, 'Constraint is a FK'); + is(join(',', $c2->fields), 'status', 'Constraint is on "status"'); + is($c2->reference_table, 'order_status', 'To table "order_status"'); + is(join(',', $c2->reference_fields), 'id', 'To field "id"'); + + my $c3 = shift @constraints; + is($c3->type, FOREIGN_KEY, 'Constraint is a FK'); + is(join(',', $c3->fields), 'billing_address_id', 'Constraint is on "billing_address_id"'); + is($c3->reference_table, 'address', 'To table "address"'); + is(join(',', $c3->reference_fields), 'address_id', 'To field "address_id"'); + + my $c4 = shift @constraints; + is($c4->type, FOREIGN_KEY, 'Constraint is a FK'); + is(join(',', $c4->fields), 'shipping_address_id', 'Constraint is on "shipping_address_id"'); + is($c4->reference_table, 'address', 'To table "address"'); + is(join(',', $c4->reference_fields), 'address_id', 'To field "address_id"'); + + my $c5 = shift @constraints; + is($c5->type, FOREIGN_KEY, 'Constraint is a FK'); + is(join(',', $c5->fields), 'store_id', 'Constraint is on "store_id"'); + is($c5->reference_table, 'store', 'To table "store"'); + is(join(',', map { $_ || '' } $c5->reference_fields), '', 'No reference fields defined'); + + my $t2 = shift @tables; + is($t2->name, 'address', 'Found "address" table'); + + my @t2_fields = $t2->get_fields; + is(scalar @t2_fields, 8, 'Right number of fields (8)'); } # djh Tests for: @@ -436,9 +428,10 @@ BEGIN { # Ignoring INSERT statements # { - my $tr = SQL::Translator->new; - my $data = parse($tr, - q[ + my $tr = SQL::Translator->new; + my $data = parse( + $tr, + q[ USE database_name; CREATE TABLE one ( @@ -462,44 +455,44 @@ BEGIN { INSERT absolutely *#! any old $£ ? rubbish, even "quoted; semi-what""sits"; ] - ) or die $tr->error; - - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my $db_name = $schema->name; - is( $db_name, 'database_name', 'Database name extracted from USE' ); - my @tables = $schema->get_tables; - is( scalar @tables, 2, 'Right number of tables (2)' ); - my $table1 = shift @tables; - is( $table1->name, 'one', 'Found "one" table' ); - my $table2 = shift @tables; - is( $table2->name, 'two', 'Found "two" table' ); - - my @constraints = $table1->get_constraints; - is(scalar @constraints, 2, 'Right number of constraints (2) on table one'); - - my $t1c1 = shift @constraints; - is( $t1c1->type, PRIMARY_KEY, 'Constraint is a PK' ); - is( join(',', $t1c1->fields), 'id', 'Constraint is on "id"' ); - - my $t1c2 = shift @constraints; - is( $t1c2->type, FOREIGN_KEY, 'Constraint is a FK' ); - is( join(',', $t1c2->fields), 'two_id', 'Constraint is on "two_id"' ); - is( $t1c2->reference_table, 'two', 'To table "two"' ); - is( join(',', $t1c2->reference_fields), 'id', 'To field "id"' ); - - @constraints = $table2->get_constraints; - is(scalar @constraints, 2, 'Right number of constraints (2) on table two'); - - my $t2c1 = shift @constraints; - is( $t2c1->type, PRIMARY_KEY, 'Constraint is a PK' ); - is( join(',', $t2c1->fields), 'id', 'Constraint is on "id"' ); - - my $t2c2 = shift @constraints; - is( $t2c2->type, FOREIGN_KEY, 'Constraint is a FK' ); - is( join(',', $t2c2->fields), 'one_id', 'Constraint is on "one_id"' ); - is( $t2c2->reference_table, 'one', 'To table "one"' ); - is( join(',', $t2c2->reference_fields), 'id', 'To field "id"' ); + ) or die $tr->error; + + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my $db_name = $schema->name; + is($db_name, 'database_name', 'Database name extracted from USE'); + my @tables = $schema->get_tables; + is(scalar @tables, 2, 'Right number of tables (2)'); + my $table1 = shift @tables; + is($table1->name, 'one', 'Found "one" table'); + my $table2 = shift @tables; + is($table2->name, 'two', 'Found "two" table'); + + my @constraints = $table1->get_constraints; + is(scalar @constraints, 2, 'Right number of constraints (2) on table one'); + + my $t1c1 = shift @constraints; + is($t1c1->type, PRIMARY_KEY, 'Constraint is a PK'); + is(join(',', $t1c1->fields), 'id', 'Constraint is on "id"'); + + my $t1c2 = shift @constraints; + is($t1c2->type, FOREIGN_KEY, 'Constraint is a FK'); + is(join(',', $t1c2->fields), 'two_id', 'Constraint is on "two_id"'); + is($t1c2->reference_table, 'two', 'To table "two"'); + is(join(',', $t1c2->reference_fields), 'id', 'To field "id"'); + + @constraints = $table2->get_constraints; + is(scalar @constraints, 2, 'Right number of constraints (2) on table two'); + + my $t2c1 = shift @constraints; + is($t2c1->type, PRIMARY_KEY, 'Constraint is a PK'); + is(join(',', $t2c1->fields), 'id', 'Constraint is on "id"'); + + my $t2c2 = shift @constraints; + is($t2c2->type, FOREIGN_KEY, 'Constraint is a FK'); + is(join(',', $t2c2->fields), 'one_id', 'Constraint is on "one_id"'); + is($t2c2->reference_table, 'one', 'To table "one"'); + is(join(',', $t2c2->reference_fields), 'id', 'To field "id"'); } # cch Tests for: @@ -509,9 +502,10 @@ BEGIN { # charset table option # { - my $tr = SQL::Translator->new(parser_args => {mysql_parser_version => 50013}); - my $data = parse($tr, - q[ + my $tr = SQL::Translator->new(parser_args => { mysql_parser_version => 50013 }); + my $data = parse( + $tr, + q[ DELIMITER ;; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;; /*!50003 CREATE */ /*!50017 DEFINER=`cmdomain`@`localhost` */ @@ -605,358 +599,353 @@ BEGIN { WHERE group_acl.group_id = user_group.group_id ; END */;; ] - ) or die $tr->error; - - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Right number of tables (1)' ); - my $table1 = shift @tables; - is( $table1->name, 'one', 'Found "one" table' ); - - my @fields = $table1->get_fields; - is(scalar @fields, 3, 'Right number of fields (3) on table one'); - my $tableTypeFound = 0; - my $charsetFound = 0; - for my $t1_option_ref ( $table1->options ) { - my($key, $value) = %{$t1_option_ref}; - if ( $key eq 'TYPE' ) { - is($value, 'INNODB', 'Table has right table type option' ); - $tableTypeFound = 1; - } elsif ( $key eq 'CHARACTER SET' ) { - is($value, 'latin1', 'Table has right character set option' ); - $charsetFound = 1; - } + ) or die $tr->error; + + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Right number of tables (1)'); + my $table1 = shift @tables; + is($table1->name, 'one', 'Found "one" table'); + + my @fields = $table1->get_fields; + is(scalar @fields, 3, 'Right number of fields (3) on table one'); + my $tableTypeFound = 0; + my $charsetFound = 0; + for my $t1_option_ref ($table1->options) { + my ($key, $value) = %{$t1_option_ref}; + if ($key eq 'TYPE') { + is($value, 'INNODB', 'Table has right table type option'); + $tableTypeFound = 1; + } elsif ($key eq 'CHARACTER SET') { + is($value, 'latin1', 'Table has right character set option'); + $charsetFound = 1; } - fail('Table did not have a type option') unless $tableTypeFound; - fail('Table did not have a character set option') unless $charsetFound; - - my $t1f1 = shift @fields; - is( $t1f1->data_type, 'varchar', 'Field is a varchar' ); - is( $t1f1->size, 255, 'Field is right size' ); - is( $t1f1->extra('character set'), 'latin1', 'Field has right character set qualifier' ); - is( $t1f1->extra('collate'), 'latin1_bin', 'Field has right collate qualifier' ); - is( $t1f1->default_value, 'NULL', 'Field has right default value' ); - - my $t1f2 = shift @fields; - is( $t1f2->data_type, 'timestamp', 'Field is a timestamp' ); - ok( !$t1f2->is_nullable, 'Field is not nullable' ); - is_deeply( - $t1f2->default_value, - \'CURRENT_TIMESTAMP', - 'Field has right default value' - ); - is_deeply( $t1f2->extra('on update'), \'CURRENT_TIMESTAMP', 'Field has right on update qualifier' ); - - my $t1f3 = shift @fields; - is( $t1f3->data_type, 'datetime', 'Field is a datetime' ); - ok( !$t1f3->is_nullable, 'Field is not nullable' ); - is_deeply( - $t1f3->default_value, - \'CURRENT_TIMESTAMP', - 'Field has right default value' - ); - - my @views = $schema->get_views; - is( scalar @views, 3, 'Right number of views (3)' ); - - my ($view1, $view2, $view3) = @views; - is( $view1->name, 'vs_asset', 'Found "vs_asset" view' ); - is( $view2->name, 'vs_asset2', 'Found "vs_asset2" view' ); - is( $view3->name, 'vs_asset3', 'Found "vs_asset3" view' ); - like($view1->sql, qr/vs_asset/, "Detected view vs_asset"); - - # KYC - commenting this out as I don't understand why this string - # should /not/ be detected when it is in the SQL - 2/28/12 - # like($view1->sql, qr/cfgmgmt_mig/, "Did not detect cfgmgmt_mig"); - - is( join(',', $view1->fields), - join(',', qw[ asset_id fq_name folder_name asset_name annotation - asset_type foreign_asset_id foreign_asset_id2 date_created - date_modified container_id creator_id modifier_id user_access - ] ), - 'First view has correct fields' - ); - - my @options = $view1->options; - - is_deeply( - \@options, - [ - 'ALGORITHM=UNDEFINED', - 'DEFINER=`cmdomain`@`localhost`', - 'SQL SECURITY DEFINER', - ], - 'Only version 50013 options parsed', - ); - - my @procs = $schema->get_procedures; - is( scalar @procs, 2, 'Right number of procedures (2)' ); - my $proc1 = shift @procs; - is( $proc1->name, 'ap_from_millitime_nullable', 'Found "ap_from_millitime_nullable" procedure' ); - like($proc1->sql, qr/CREATE FUNCTION ap_from_millitime_nullable/, "Detected procedure ap_from_millitime_nullable"); - my $proc2 = shift @procs; - is( $proc2->name, 'sp_update_security_acl', 'Found "sp_update_security_acl" procedure' ); - like($proc2->sql, qr/CREATE PROCEDURE sp_update_security_acl/, "Detected procedure sp_update_security_acl"); + } + fail('Table did not have a type option') unless $tableTypeFound; + fail('Table did not have a character set option') unless $charsetFound; + + my $t1f1 = shift @fields; + is($t1f1->data_type, 'varchar', 'Field is a varchar'); + is($t1f1->size, 255, 'Field is right size'); + is($t1f1->extra('character set'), 'latin1', 'Field has right character set qualifier'); + is($t1f1->extra('collate'), 'latin1_bin', 'Field has right collate qualifier'); + is($t1f1->default_value, 'NULL', 'Field has right default value'); + + my $t1f2 = shift @fields; + is($t1f2->data_type, 'timestamp', 'Field is a timestamp'); + ok(!$t1f2->is_nullable, 'Field is not nullable'); + is_deeply($t1f2->default_value, \'CURRENT_TIMESTAMP', 'Field has right default value'); + is_deeply($t1f2->extra('on update'), \'CURRENT_TIMESTAMP', 'Field has right on update qualifier'); + + my $t1f3 = shift @fields; + is($t1f3->data_type, 'datetime', 'Field is a datetime'); + ok(!$t1f3->is_nullable, 'Field is not nullable'); + is_deeply($t1f3->default_value, \'CURRENT_TIMESTAMP', 'Field has right default value'); + + my @views = $schema->get_views; + is(scalar @views, 3, 'Right number of views (3)'); + + my ($view1, $view2, $view3) = @views; + is($view1->name, 'vs_asset', 'Found "vs_asset" view'); + is($view2->name, 'vs_asset2', 'Found "vs_asset2" view'); + is($view3->name, 'vs_asset3', 'Found "vs_asset3" view'); + like($view1->sql, qr/vs_asset/, "Detected view vs_asset"); + + # KYC - commenting this out as I don't understand why this string + # should /not/ be detected when it is in the SQL - 2/28/12 + # like($view1->sql, qr/cfgmgmt_mig/, "Did not detect cfgmgmt_mig"); + + is( + join(',', $view1->fields), + join( + ',', qw[ asset_id fq_name folder_name asset_name annotation + asset_type foreign_asset_id foreign_asset_id2 date_created + date_modified container_id creator_id modifier_id user_access + ] + ), + 'First view has correct fields' + ); + + my @options = $view1->options; + + is_deeply( + \@options, + [ 'ALGORITHM=UNDEFINED', 'DEFINER=`cmdomain`@`localhost`', 'SQL SECURITY DEFINER', ], + 'Only version 50013 options parsed', + ); + + my @procs = $schema->get_procedures; + is(scalar @procs, 2, 'Right number of procedures (2)'); + my $proc1 = shift @procs; + is($proc1->name, 'ap_from_millitime_nullable', 'Found "ap_from_millitime_nullable" procedure'); + like($proc1->sql, qr/CREATE FUNCTION ap_from_millitime_nullable/, "Detected procedure ap_from_millitime_nullable"); + my $proc2 = shift @procs; + is($proc2->name, 'sp_update_security_acl', 'Found "sp_update_security_acl" procedure'); + like($proc2->sql, qr/CREATE PROCEDURE sp_update_security_acl/, "Detected procedure sp_update_security_acl"); } # Tests for collate table option { - my $tr = SQL::Translator->new(parser_args => {mysql_parser_version => 50003}); - my $data = parse($tr, - q[ + my $tr = SQL::Translator->new(parser_args => { mysql_parser_version => 50003 }); + my $data = parse( + $tr, + q[ CREATE TABLE test ( id int ) DEFAULT CHARACTER SET latin1 COLLATE latin1_bin; - ] ); - - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Right number of tables (1)' ); - my $table1 = shift @tables; - is( $table1->name, 'test', 'Found "test" table' ); - - - my $collate = "Not found!"; - my $charset = "Not found!"; - for my $t1_option_ref ( $table1->options ) { - my($key, $value) = %{$t1_option_ref}; - $collate = $value if $key eq 'COLLATE'; - $charset = $value if $key eq 'CHARACTER SET'; - } - is($collate, 'latin1_bin', "Collate found"); - is($charset, 'latin1', "Character set found"); + ] + ); + + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Right number of tables (1)'); + my $table1 = shift @tables; + is($table1->name, 'test', 'Found "test" table'); + + my $collate = "Not found!"; + my $charset = "Not found!"; + for my $t1_option_ref ($table1->options) { + my ($key, $value) = %{$t1_option_ref}; + $collate = $value if $key eq 'COLLATE'; + $charset = $value if $key eq 'CHARACTER SET'; + } + is($collate, 'latin1_bin', "Collate found"); + is($charset, 'latin1', "Character set found"); } # Test the mysql version parser (probably needs to migrate to t/utils.t) my $parse_as = { - perl => { - '3.23.2' => 3.023002, - '4' => 4.000000, - '50003' => 5.000003, - '5.01.0' => 5.001000, - '5.1' => 5.001000, - }, - mysql => { - '3.23.2' => 32302, - '4' => 40000, - '50003' => 50003, - '5.01.0' => 50100, - '5.1' => 50100, - }, + perl => { + '3.23.2' => 3.023002, + '4' => 4.000000, + '50003' => 5.000003, + '5.01.0' => 5.001000, + '5.1' => 5.001000, + }, + mysql => { + '3.23.2' => 32302, + '4' => 40000, + '50003' => 50003, + '5.01.0' => 50100, + '5.1' => 50100, + }, }; for my $target (keys %$parse_as) { - for my $str (keys %{$parse_as->{$target}}) { - cmp_ok ( - SQL::Translator::Utils::parse_mysql_version ($str, $target), - '==', - $parse_as->{$target}{$str}, - "'$str' parsed as $target version '$parse_as->{$target}{$str}'", - ); - } + for my $str (keys %{ $parse_as->{$target} }) { + cmp_ok( + SQL::Translator::Utils::parse_mysql_version($str, $target), + '==', + $parse_as->{$target}{$str}, + "'$str' parsed as $target version '$parse_as->{$target}{$str}'", + ); + } } -eval { SQL::Translator::Utils::parse_mysql_version ('bogus5.1') }; -ok ($@, 'Exception thrown on invalid version string'); +eval { SQL::Translator::Utils::parse_mysql_version('bogus5.1') }; +ok($@, 'Exception thrown on invalid version string'); { - my $tr = SQL::Translator->new; - my $data = q|create table merge_example ( + my $tr = SQL::Translator->new; + my $data = q|create table merge_example ( id int(11) NOT NULL auto_increment, shape_field geometry NOT NULL, PRIMARY KEY (id), SPATIAL KEY shape_field (shape_field) ) ENGINE=MRG_MyISAM UNION=(`sometable_0`,`sometable_1`,`sometable_2`);|; - my $val = parse($tr, $data); - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Right number of tables (1)' ); - my $table = shift @tables; - is( $table->name, 'merge_example', 'Found "merge_example" table' ); - - my $tableTypeFound = 0; - my $unionFound = 0; - for my $t_option_ref ( $table->options ) { - my($key, $value) = %{$t_option_ref}; - if ( $key eq 'ENGINE' ) { - is($value, 'MRG_MyISAM', 'Table has right table engine option' ); - $tableTypeFound = 1; - } elsif ( $key eq 'UNION' ) { - is_deeply($value, [ 'sometable_0','sometable_1','sometable_2' ], - "UNION option has correct set"); - $unionFound = 1; - } + my $val = parse($tr, $data); + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Right number of tables (1)'); + my $table = shift @tables; + is($table->name, 'merge_example', 'Found "merge_example" table'); + + my $tableTypeFound = 0; + my $unionFound = 0; + for my $t_option_ref ($table->options) { + my ($key, $value) = %{$t_option_ref}; + if ($key eq 'ENGINE') { + is($value, 'MRG_MyISAM', 'Table has right table engine option'); + $tableTypeFound = 1; + } elsif ($key eq 'UNION') { + is_deeply($value, [ 'sometable_0', 'sometable_1', 'sometable_2' ], "UNION option has correct set"); + $unionFound = 1; } - - fail('Table did not have a type option') unless $tableTypeFound; - fail('Table did not have a union option') unless $unionFound; - - my @fields = $table->get_fields; - is( scalar @fields, 2, 'Right number of fields (2)' ); - my $f1 = shift @fields; - my $f2 = shift @fields; - is( $f1->name, 'id', 'First field name is "id"' ); - is( $f1->data_type, 'int', 'Type is "int"' ); - is( $f1->size, 11, 'Size is "11"' ); - is( $f1->is_nullable, 0, 'Field cannot be null' ); - is( $f1->is_primary_key, 1, 'Field is PK' ); - - is( $f2->name, 'shape_field', 'Second field name is "shape_field"' ); - is( $f2->data_type, 'geometry', 'Type is "geometry"' ); - is( $f2->is_nullable, 0, 'Field cannot be null' ); - is( $f2->is_primary_key, 0, 'Field is not PK' ); - - my @indices = $table->get_indices; - is( scalar @indices, 1, 'Right number of indices (1)' ); - my $i1 = shift @indices; - is( $i1->name, 'shape_field', 'No name on index' ); - is( $i1->type, SPATIAL, 'Spatial index' ); - - my @constraints = $table->get_constraints; - is( scalar @constraints, 1, 'Right number of constraints (1)' ); - my $c = shift @constraints; - is( $c->type, PRIMARY_KEY, 'Constraint is a PK' ); - is( join(',', $c->fields), 'id', 'Constraint is on "id"' ); + } + + fail('Table did not have a type option') unless $tableTypeFound; + fail('Table did not have a union option') unless $unionFound; + + my @fields = $table->get_fields; + is(scalar @fields, 2, 'Right number of fields (2)'); + my $f1 = shift @fields; + my $f2 = shift @fields; + is($f1->name, 'id', 'First field name is "id"'); + is($f1->data_type, 'int', 'Type is "int"'); + is($f1->size, 11, 'Size is "11"'); + is($f1->is_nullable, 0, 'Field cannot be null'); + is($f1->is_primary_key, 1, 'Field is PK'); + + is($f2->name, 'shape_field', 'Second field name is "shape_field"'); + is($f2->data_type, 'geometry', 'Type is "geometry"'); + is($f2->is_nullable, 0, 'Field cannot be null'); + is($f2->is_primary_key, 0, 'Field is not PK'); + + my @indices = $table->get_indices; + is(scalar @indices, 1, 'Right number of indices (1)'); + my $i1 = shift @indices; + is($i1->name, 'shape_field', 'No name on index'); + is($i1->type, SPATIAL, 'Spatial index'); + + my @constraints = $table->get_constraints; + is(scalar @constraints, 1, 'Right number of constraints (1)'); + my $c = shift @constraints; + is($c->type, PRIMARY_KEY, 'Constraint is a PK'); + is(join(',', $c->fields), 'id', 'Constraint is on "id"'); } { - my @data = ( - q|create table quote ( + my @data = ( + q|create table quote ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id) ) ENGINE="innodb";|, - q|create table quote ( + q|create table quote ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id) ) ENGINE='innodb';|, - q|create table quote ( + q|create table quote ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id) ) ENGINE=innodb;|, - ); - for my $data (@data) { - my $tr = SQL::Translator->new; - - my $val = parse($tr, $data); - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Right number of tables (1)' ); - my $table = shift @tables; - is( $table->name, 'quote', 'Found "quote" table' ); - - my $tableTypeFound = 0; - for my $t_option_ref ( $table->options ) { - my($key, $value) = %{$t_option_ref}; - if ( $key eq 'ENGINE' ) { - is($value, 'innodb', 'Table has right table engine option' ); - $tableTypeFound = 1; - } - } - - fail('Table did not have a type option') unless $tableTypeFound; - - my @fields = $table->get_fields; - my $f1 = shift @fields; - is( $f1->name, 'id', 'First field name is "id"' ); - is( $f1->data_type, 'int', 'Type is "int"' ); - is( $f1->size, 11, 'Size is "11"' ); - is( $f1->is_nullable, 0, 'Field cannot be null' ); - is( $f1->is_primary_key, 1, 'Field is PK' ); + ); + for my $data (@data) { + my $tr = SQL::Translator->new; + + my $val = parse($tr, $data); + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Right number of tables (1)'); + my $table = shift @tables; + is($table->name, 'quote', 'Found "quote" table'); + + my $tableTypeFound = 0; + for my $t_option_ref ($table->options) { + my ($key, $value) = %{$t_option_ref}; + if ($key eq 'ENGINE') { + is($value, 'innodb', 'Table has right table engine option'); + $tableTypeFound = 1; + } } + + fail('Table did not have a type option') unless $tableTypeFound; + + my @fields = $table->get_fields; + my $f1 = shift @fields; + is($f1->name, 'id', 'First field name is "id"'); + is($f1->data_type, 'int', 'Type is "int"'); + is($f1->size, 11, 'Size is "11"'); + is($f1->is_nullable, 0, 'Field cannot be null'); + is($f1->is_primary_key, 1, 'Field is PK'); + } } { - my $tr = SQL::Translator->new; - my $data = q|create table "sessions" ( + my $tr = SQL::Translator->new; + my $data = q|create table "sessions" ( id char(32) not null default '0' primary key, ssn varchar(12) NOT NULL default 'test single quotes like in you''re', user varchar(20) NOT NULL default 'test single quotes escaped like you\'re', key using btree (ssn) );|; - my $val = parse($tr, $data); - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Right number of tables (1)' ); - my $table = shift @tables; - is( $table->name, 'sessions', 'Found "sessions" table' ); - - my @fields = $table->get_fields; - is( scalar @fields, 3, 'Right number of fields (3)' ); - my $f1 = shift @fields; - my $f2 = shift @fields; - my $f3 = shift @fields; - is( $f1->name, 'id', 'First field name is "id"' ); - is( $f1->data_type, 'char', 'Type is "char"' ); - is( $f1->size, 32, 'Size is "32"' ); - is( $f1->is_nullable, 0, 'Field cannot be null' ); - is( $f1->default_value, '0', 'Default value is "0"' ); - is( $f1->is_primary_key, 1, 'Field is PK' ); - - is( $f2->name, 'ssn', 'Second field name is "ssn"' ); - is( $f2->data_type, 'varchar', 'Type is "varchar"' ); - is( $f2->size, 12, 'Size is "12"' ); - is( $f2->is_nullable, 0, 'Field can not be null' ); - is( $f2->default_value, "test single quotes like in you're", "Single quote in default value is unescaped properly" ); - is( $f2->is_primary_key, 0, 'Field is not PK' ); - - # this is more of a sanity test because the original sqlt regex for default looked for an escaped quote represented as \' - # however in mysql 5.x (and probably other previous versions) still actually outputs that as '' - is( $f3->name, 'user', 'Second field name is "user"' ); - is( $f3->data_type, 'varchar', 'Type is "varchar"' ); - is( $f3->size, 20, 'Size is "20"' ); - is( $f3->is_nullable, 0, 'Field can not be null' ); - is( $f3->default_value, "test single quotes escaped like you're", "Single quote in default value is unescaped properly" ); - is( $f3->is_primary_key, 0, 'Field is not PK' ); + my $val = parse($tr, $data); + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Right number of tables (1)'); + my $table = shift @tables; + is($table->name, 'sessions', 'Found "sessions" table'); + + my @fields = $table->get_fields; + is(scalar @fields, 3, 'Right number of fields (3)'); + my $f1 = shift @fields; + my $f2 = shift @fields; + my $f3 = shift @fields; + is($f1->name, 'id', 'First field name is "id"'); + is($f1->data_type, 'char', 'Type is "char"'); + is($f1->size, 32, 'Size is "32"'); + is($f1->is_nullable, 0, 'Field cannot be null'); + is($f1->default_value, '0', 'Default value is "0"'); + is($f1->is_primary_key, 1, 'Field is PK'); + + is($f2->name, 'ssn', 'Second field name is "ssn"'); + is($f2->data_type, 'varchar', 'Type is "varchar"'); + is($f2->size, 12, 'Size is "12"'); + is($f2->is_nullable, 0, 'Field can not be null'); + is($f2->default_value, "test single quotes like in you're", "Single quote in default value is unescaped properly"); + is($f2->is_primary_key, 0, 'Field is not PK'); + +# this is more of a sanity test because the original sqlt regex for default looked for an escaped quote represented as \' +# however in mysql 5.x (and probably other previous versions) still actually outputs that as '' + is($f3->name, 'user', 'Second field name is "user"'); + is($f3->data_type, 'varchar', 'Type is "varchar"'); + is($f3->size, 20, 'Size is "20"'); + is($f3->is_nullable, 0, 'Field can not be null'); + is( + $f3->default_value, + "test single quotes escaped like you're", + "Single quote in default value is unescaped properly" + ); + is($f3->is_primary_key, 0, 'Field is not PK'); } { - # silence PR::D from spewing on STDERR - local $::RD_ERRORS = 0; - local $::RD_WARN = 0; - local $::RD_HINT = 0; - my $tr = SQL::Translator->new; - my $data = q|create table "sessions" ( + # silence PR::D from spewing on STDERR + local $::RD_ERRORS = 0; + local $::RD_WARN = 0; + local $::RD_HINT = 0; + my $tr = SQL::Translator->new; + my $data = q|create table "sessions" ( id char(32) not null default, ssn varchar(12) NOT NULL default 'test single quotes like in you''re', user varchar(20) NOT NULL default 'test single quotes escaped like you\'re', key using btree (ssn) );|; - my $val= parse($tr,$data); - ok ($tr->error =~ /Parse failed\./, 'Parse failed error without default value'); + my $val = parse($tr, $data); + ok($tr->error =~ /Parse failed\./, 'Parse failed error without default value'); } { - # make sure empty string default value still works - my $tr = SQL::Translator->new; - my $data = q|create table "sessions" ( + # make sure empty string default value still works + my $tr = SQL::Translator->new; + my $data = q|create table "sessions" ( id char(32) not null DEFAULT '', ssn varchar(12) NOT NULL default "", key using btree (ssn) );|; - my $val= parse($tr,$data); - - my @fields = $tr->schema->get_table('sessions')->get_fields; - is (scalar @fields, 2, 'Both fields parsed correctly'); - for (@fields) { - my $def = $_->default_value; - ok( (defined $def and $def eq ''), "Defaults on field $_ correct" ); - } + my $val = parse($tr, $data); + + my @fields = $tr->schema->get_table('sessions')->get_fields; + is(scalar @fields, 2, 'Both fields parsed correctly'); + for (@fields) { + my $def = $_->default_value; + ok((defined $def and $def eq ''), "Defaults on field $_ correct"); + } } { - # test rt70437 and rt71468 - my $file = "$Bin/data/mysql/cashmusic_db.sql"; - ok (-f $file,"File exists"); - my $tr = SQL::Translator->new( parser => 'MySQL'); - ok ($tr->translate($file),'File translated'); - ok (!$tr->error, 'no error'); - ok (my $schema = $tr->schema, 'got schema'); + # test rt70437 and rt71468 + my $file = "$Bin/data/mysql/cashmusic_db.sql"; + ok(-f $file, "File exists"); + my $tr = SQL::Translator->new(parser => 'MySQL'); + ok($tr->translate($file), 'File translated'); + ok(!$tr->error, 'no error'); + ok(my $schema = $tr->schema, 'got schema'); } done_testing; diff --git a/t/03mysql-to-oracle.t b/t/03mysql-to-oracle.t index 5b64c598d..652996128 100644 --- a/t/03mysql-to-oracle.t +++ b/t/03mysql-to-oracle.t @@ -19,23 +19,21 @@ CREATE INDEX random_foo ON random(foo); |; BEGIN { - maybe_plan(undef, - 'SQL::Translator::Parser::MySQL', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(undef, 'SQL::Translator::Parser::MySQL', 'SQL::Translator::Producer::Oracle'); } -my $tr = SQL::Translator->new( - parser => "MySQL", - producer => "Oracle", - quote_table_names => 0, - quote_field_names => 0, +my $tr = SQL::Translator->new( + parser => "MySQL", + producer => "Oracle", + quote_table_names => 0, + quote_field_names => 0, ); my $output = $tr->translate(\$create); -ok( $output, 'Translate MySQL to Oracle' ); -ok( $output =~ /CREATE INDEX random_foo /, 'Normal index definition translated.'); -ok( $output =~ /CREATE UNIQUE INDEX random_foo_update /, 'Unique index definition translated.'); -ok( $output =~ /\QCHECK (bar IN ('wibble', 'wo''bble'))\E/, 'Enum translated and escaped.'); +ok($output, 'Translate MySQL to Oracle'); +ok($output =~ /CREATE INDEX random_foo /, 'Normal index definition translated.'); +ok($output =~ /CREATE UNIQUE INDEX random_foo_update /, 'Unique index definition translated.'); +ok($output =~ /\QCHECK (bar IN ('wibble', 'wo''bble'))\E/, 'Enum translated and escaped.'); done_testing; diff --git a/t/04file,fh,string.t b/t/04file,fh,string.t index 912141227..90b2f058f 100644 --- a/t/04file,fh,string.t +++ b/t/04file,fh,string.t @@ -22,22 +22,24 @@ my $fh = IO::File->new($datafile); my ($v1, $v2); { - my $tr = SQL::Translator->new; - # Pass filename: simplest way - $tr->translate($datafile); - $v1 = $tr->schema; + my $tr = SQL::Translator->new; + + # Pass filename: simplest way + $tr->translate($datafile); + $v1 = $tr->schema; } { - my $tr = SQL::Translator->new; - # Pass string reference - read($fh, $data, -s $datafile); - $tr->translate(\$data); - $v2 = $tr->schema; + my $tr = SQL::Translator->new; + + # Pass string reference + read($fh, $data, -s $datafile); + $tr->translate(\$data); + $v2 = $tr->schema; } # XXX- Hack to remove Graph hack! -$_->translator (undef) for ($v1, $v2); +$_->translator(undef) for ($v1, $v2); ok(length $v1, "passing string (filename) works"); ok(length $v2, "passing string as SCALAR reference"); diff --git a/t/05bgep-re.t b/t/05bgep-re.t index b2fc9188f..1a467f0b7 100644 --- a/t/05bgep-re.t +++ b/t/05bgep-re.t @@ -5,54 +5,52 @@ use strict; use File::Spec::Functions qw(catfile tmpdir); -use File::Temp qw(tempfile); -use FindBin qw($Bin); +use File::Temp qw(tempfile); +use FindBin qw($Bin); use SQL::Translator; use Test::More; use Test::SQL::Translator qw(maybe_plan); # This aggravates me; XML::Writer produces tons of warnings. local $SIG{__WARN__} = sub { - CORE::warn(@_) - unless $_[0] =~ m#XML/Writer#; + CORE::warn(@_) + unless $_[0] =~ m#XML/Writer#; }; BEGIN { - maybe_plan(2, - 'SQL::Translator::Parser::MySQL', - 'SQL::Translator::Producer::XML::SQLFairy'); + maybe_plan(2, 'SQL::Translator::Parser::MySQL', 'SQL::Translator::Producer::XML::SQLFairy'); } my @data = qw(data mysql BGEP-RE-create.sql); -my $test_data = (-d "t") +my $test_data + = (-d "t") ? catfile($Bin, @data) : catfile($Bin, "t", @data); -my $tr = SQL::Translator->new( - parser => 'MySQL', - producer => 'XML-SQLFairy', - filename => $test_data +my $tr = SQL::Translator->new( + parser => 'MySQL', + producer => 'XML-SQLFairy', + filename => $test_data ); my $data = $tr->translate; ok($data, "MySQL->XML-SQLFairy"); SKIP: { - eval { - require XML::Parser; - }; - if ($@) { - skip "Can't load XML::Parser" => 1; - } - - # Can't get XML::Parser::parsestring to do Useful Things - my ($fh, $fname) = tempfile('sqlfXXXX', - UNLINK => 1, - SUFFIX => '.xml', - DIR => tmpdir); - print $fh $data; - close $fh; - - ok(XML::Parser->new->parsefile($fname), - "Successfully parsed output"); + eval { require XML::Parser; }; + if ($@) { + skip "Can't load XML::Parser" => 1; + } + + # Can't get XML::Parser::parsestring to do Useful Things + my ($fh, $fname) = tempfile( + 'sqlfXXXX', + UNLINK => 1, + SUFFIX => '.xml', + DIR => tmpdir + ); + print $fh $data; + close $fh; + + ok(XML::Parser->new->parsefile($fname), "Successfully parsed output"); } diff --git a/t/06xsv.t b/t/06xsv.t index 125a1af6a..8f51339c2 100644 --- a/t/06xsv.t +++ b/t/06xsv.t @@ -12,63 +12,63 @@ use Test::More; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan(25, 'SQL::Translator::Parser::xSV'); - SQL::Translator::Parser::xSV->import('parse'); + maybe_plan(25, 'SQL::Translator::Parser::xSV'); + SQL::Translator::Parser::xSV->import('parse'); } -my $tr = SQL::Translator->new; -my $s = SQL::Translator::Schema->new; +my $tr = SQL::Translator->new; +my $s = SQL::Translator::Schema->new; my $data = q|One, Two, Three, Four, Five, Six, Seven I, Am, Some, Data, Yo, -10, .04 And, So, am, I, "you crazy, crazy bastard", 500982, 1.1 |; -$tr->parser_args( trim_fields => 1, scan_fields => 1 ); +$tr->parser_args(trim_fields => 1, scan_fields => 1); my $val = parse($tr, $data, $s); my $schema = $tr->schema; my @tables = $schema->get_tables; -is( scalar @tables, 1, 'Correct number of tables (1)' ); +is(scalar @tables, 1, 'Correct number of tables (1)'); my $table = shift @tables; -is( $table->name, 'table1', 'Table is named "table1"' ); +is($table->name, 'table1', 'Table is named "table1"'); my @fields = $table->get_fields; -is( scalar @fields, 7, 'Correct number of fields (7)' ); +is(scalar @fields, 7, 'Correct number of fields (7)'); my $f1 = $fields[0]; -is( $f1->name, 'One', 'First field name is "One"' ); -is( $f1->data_type, 'char', 'Data type is "char"' ); -is( $f1->size, '3', 'Size is "3"' ); -is( $f1->is_primary_key, 1, 'Field is PK' ); +is($f1->name, 'One', 'First field name is "One"'); +is($f1->data_type, 'char', 'Data type is "char"'); +is($f1->size, '3', 'Size is "3"'); +is($f1->is_primary_key, 1, 'Field is PK'); my $f2 = $fields[1]; -is( $f2->name, 'Two', 'First field name is "Two"' ); -is( $f2->data_type, 'char', 'Data type is "char"' ); -is( $f2->size, '2', 'Size is "2"' ); -is( $f2->is_primary_key, 0, 'Field is not PK' ); +is($f2->name, 'Two', 'First field name is "Two"'); +is($f2->data_type, 'char', 'Data type is "char"'); +is($f2->size, '2', 'Size is "2"'); +is($f2->is_primary_key, 0, 'Field is not PK'); my $f5 = $fields[4]; -is( $f5->name, 'Five', 'Fifth field name is "Five"' ); -is( $f5->data_type, 'char', 'Data type is "char"' ); -is( $f5->size, '26', 'Size is "26"' ); -is( $f5->is_primary_key, 0, 'Field is not PK' ); +is($f5->name, 'Five', 'Fifth field name is "Five"'); +is($f5->data_type, 'char', 'Data type is "char"'); +is($f5->size, '26', 'Size is "26"'); +is($f5->is_primary_key, 0, 'Field is not PK'); my $f6 = $fields[5]; -is( $f6->name, 'Six', 'Sixth field name is "Six"' ); -is( $f6->data_type, 'integer', 'Data type is "integer"' ); -is( $f6->size, '6', 'Size is "6"' ); +is($f6->name, 'Six', 'Sixth field name is "Six"'); +is($f6->data_type, 'integer', 'Data type is "integer"'); +is($f6->size, '6', 'Size is "6"'); my $f7 = $fields[6]; -is( $f7->name, 'Seven', 'Seventh field name is "Seven"' ); -is( $f7->data_type, 'float', 'Data type is "float"' ); -is( $f7->size, '3,2', 'Size is "3,2"' ); +is($f7->name, 'Seven', 'Seventh field name is "Seven"'); +is($f7->data_type, 'float', 'Data type is "float"'); +is($f7->size, '3,2', 'Size is "3,2"'); my @indices = $table->get_indices; -is( scalar @indices, 0, 'Correct number of indices (0)' ); +is(scalar @indices, 0, 'Correct number of indices (0)'); my @constraints = $table->get_constraints; -is( scalar @constraints, 1, 'Correct number of constraints (1)' ); +is(scalar @constraints, 1, 'Correct number of constraints (1)'); my $c = shift @constraints; -is( $c->type, PRIMARY_KEY, 'Constraint is a PK' ); -is( join(',', $c->fields), 'One', 'On field "One"' ); +is($c->type, PRIMARY_KEY, 'Constraint is a PK'); +is(join(',', $c->fields), 'One', 'On field "One"'); diff --git a/t/07p_args.t b/t/07p_args.t index 7aa2f064c..36ed1f734 100644 --- a/t/07p_args.t +++ b/t/07p_args.t @@ -9,18 +9,18 @@ use SQL::Translator; use Test::More tests => 9; sub silly_parser { - my ($tr, $data) = @_; - my $pargs = $tr->parser_args; + my ($tr, $data) = @_; + my $pargs = $tr->parser_args; - my @fields = split /$pargs->{'delimiter'}/, $data; + my @fields = split /$pargs->{'delimiter'}/, $data; - my $schema = $tr->schema; - my $table = $schema->add_table( name => 'foo') or die $schema->error; - for my $value ( @fields ) { - my $field = $table->add_field( name => $value ) or die $table->error; - } + my $schema = $tr->schema; + my $table = $schema->add_table(name => 'foo') or die $schema->error; + for my $value (@fields) { + my $field = $table->add_field(name => $value) or die $table->error; + } - return 1; + return 1; } # The "data" to be parsed @@ -32,14 +32,14 @@ my $tr = SQL::Translator->new; $tr->parser(\&silly_parser); $tr->parser_args(delimiter => '\|'); -my $pargs = $tr->parser_args; +my $pargs = $tr->parser_args; $tr->translate(\$data); my $schema = $tr->schema; is($pargs->{'delimiter'}, '\|', "parser_args works when called directly"); my @tables = $schema->get_tables; is(scalar @tables, 1, "right number of tables"); -my $table = shift @tables; +my $table = shift @tables; my @fields = $table->get_fields; is(scalar @fields, 4, "right number of fields"); @@ -55,27 +55,27 @@ $data =~ s/\|/\t/g; $pargs = $tr->parser_args; $tr->translate(\$data); -is($pargs->{'delimiter'}, "\t", - "parser_args works when called indirectly"); +is($pargs->{'delimiter'}, "\t", "parser_args works when called indirectly"); @tables = $schema->get_tables; is(scalar @tables, 1, "right number of tables"); -$table = shift @tables; +$table = shift @tables; @fields = $table->get_fields; is(scalar @fields, 4, "right number of fields"); undef $tr; -$tr = SQL::Translator->new(parser => \&silly_parser, - parser_args => { delimiter => ":" }); +$tr = SQL::Translator->new( + parser => \&silly_parser, + parser_args => { delimiter => ":" } +); $data =~ s/\t/:/g; $pargs = $tr->parser_args; $tr->translate(\$data); -is($pargs->{'delimiter'}, ":", - "parser_args works when called as constructor arg"); +is($pargs->{'delimiter'}, ":", "parser_args works when called as constructor arg"); @tables = $schema->get_tables; is(scalar @tables, 1, "right number of tables"); -$table = shift @tables; +$table = shift @tables; @fields = $table->get_fields; is(scalar @fields, 4, "right number of fields with new delimiter"); diff --git a/t/08postgres-to-mysql.t b/t/08postgres-to-mysql.t index ff365e1f2..9786ff232 100644 --- a/t/08postgres-to-mysql.t +++ b/t/08postgres-to-mysql.t @@ -8,10 +8,7 @@ use Data::Dumper; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan(1, - 'SQL::Translator::Parser::PostgreSQL', - 'SQL::Translator::Producer::MySQL', - ); + maybe_plan(1, 'SQL::Translator::Parser::PostgreSQL', 'SQL::Translator::Producer::MySQL',); } my $create = q| @@ -167,8 +164,8 @@ create table cvterm_geom ( |; my $tr = SQL::Translator->new( - parser => "PostgreSQL", - producer => "MySQL" + parser => "PostgreSQL", + producer => "MySQL" ); -ok( $tr->translate(\$create), 'Translate PG2My' ) or diag($tr->error); +ok($tr->translate(\$create), 'Translate PG2My') or diag($tr->error); diff --git a/t/09sqlt-diagram.t b/t/09sqlt-diagram.t index 0c6930b80..65c1c0792 100644 --- a/t/09sqlt-diagram.t +++ b/t/09sqlt-diagram.t @@ -2,32 +2,26 @@ use strict; use warnings; use File::Spec::Functions qw(catfile updir tmpdir); -use File::Temp qw(mktemp); -use FindBin qw($Bin); +use File::Temp qw(mktemp); +use FindBin qw($Bin); use Test::More; use Test::SQL::Translator qw(maybe_plan); -use Text::ParseWords qw(shellwords); +use Text::ParseWords qw(shellwords); BEGIN { - maybe_plan( - 3, - 'GD', - 'Graph::Directed', - 'SQL::Translator::Producer::Diagram', - 'SQL::Translator::Parser::MySQL', - ); + maybe_plan(3, 'GD', 'Graph::Directed', 'SQL::Translator::Producer::Diagram', 'SQL::Translator::Parser::MySQL',); } my @script = qw(script sqlt-diagram); -my @data = qw(data mysql create2.sql); +my @data = qw(data mysql create2.sql); my $sqlt_diagram = catfile($Bin, updir, @script); -my $test_data = catfile($Bin, @data); +my $test_data = catfile($Bin, @data); my $tmp = mktemp('sqlXXXXX'); ok(-e $sqlt_diagram); -my @cmd = ($^X, shellwords($ENV{HARNESS_PERL_SWITCHES}||''), $sqlt_diagram, "-d", "MySQL", "-o", $tmp, $test_data); +my @cmd = ($^X, shellwords($ENV{HARNESS_PERL_SWITCHES} || ''), $sqlt_diagram, "-d", "MySQL", "-o", $tmp, $test_data); eval { system(@cmd); }; ok(!$@ && ($? == 0)); ok(-e $tmp); diff --git a/t/10excel.t b/t/10excel.t index 5c2e1488e..80759ad22 100644 --- a/t/10excel.t +++ b/t/10excel.t @@ -7,8 +7,8 @@ use SQL::Translator::Schema::Constants; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan(31, 'SQL::Translator::Parser::Excel'); - SQL::Translator::Parser::Excel->import('parse'); + maybe_plan(31, 'SQL::Translator::Parser::Excel'); + SQL::Translator::Parser::Excel->import('parse'); } my $tr = SQL::Translator->new(parser => "Excel"); @@ -16,59 +16,60 @@ my $t = $tr->translate(filename => "t/data/Excel/t.xls"); my $schema = $tr->schema; my @tables = $schema->get_tables; -is( scalar @tables, 1, 'Parsed 1 table' ); +is(scalar @tables, 1, 'Parsed 1 table'); my $table = shift @tables; -is( $table->name, 'Sheet1', 'Table name is "Sheet1"' ); +is($table->name, 'Sheet1', 'Table name is "Sheet1"'); my @fields = $table->get_fields; -is( scalar @fields, 7, 'Table has 7 fields' ); +is(scalar @fields, 7, 'Table has 7 fields'); my $f1 = shift @fields; -is( $f1->name, 'ID', 'First field name is "ID"' ); -is( lc $f1->data_type, 'integer', 'Data type is "integer"' ); -is( $f1->size, 5, 'Size is "5"' ); -is( $f1->is_primary_key, 1, 'Field is PK' ); +is($f1->name, 'ID', 'First field name is "ID"'); +is(lc $f1->data_type, 'integer', 'Data type is "integer"'); +is($f1->size, 5, 'Size is "5"'); +is($f1->is_primary_key, 1, 'Field is PK'); my $f2 = shift @fields; -is( $f2->name, 'text', 'Second field name is "text"' ); -is( lc $f2->data_type, 'char', 'Data type is "char"' ); -is( $f2->size, 7, 'Size is "7"' ); -is( $f2->is_primary_key, 0, 'Field is not PK' ); +is($f2->name, 'text', 'Second field name is "text"'); +is(lc $f2->data_type, 'char', 'Data type is "char"'); +is($f2->size, 7, 'Size is "7"'); +is($f2->is_primary_key, 0, 'Field is not PK'); my $f3 = shift @fields; -is( $f3->name, 'number', 'Third field name is "number"' ); -is( lc $f3->data_type, 'integer', 'Data type is "integer"' ); -is( $f3->size, 1, 'Size is "1"' ); -is( $f3->is_primary_key, 0, 'Field is not PK' ); +is($f3->name, 'number', 'Third field name is "number"'); +is(lc $f3->data_type, 'integer', 'Data type is "integer"'); +is($f3->size, 1, 'Size is "1"'); +is($f3->is_primary_key, 0, 'Field is not PK'); my $f4 = shift @fields; TODO: { - eval { require Spreadsheet::ParseExcel }; - todo_skip "Bug in Spreadsheet::ParseExcel, http://rt.cpan.org/Public/Bug/Display.html?id=39892", 4 - if ( $Spreadsheet::ParseExcel::VERSION > 0.32 and $Spreadsheet::ParseExcel::VERSION < 0.41 ); + eval { require Spreadsheet::ParseExcel }; + todo_skip + "Bug in Spreadsheet::ParseExcel, http://rt.cpan.org/Public/Bug/Display.html?id=39892", 4 + if ( $Spreadsheet::ParseExcel::VERSION > 0.32 + and $Spreadsheet::ParseExcel::VERSION < 0.41); - is( $f4->name, 'math', 'Fourth field name is "math"' ); - is( lc $f4->data_type, 'float', 'Data type is "float"' ); - is( $f4->size, '3,1', 'Size is "3,1"' ); - is( $f4->is_primary_key, 0, 'Field is not PK' ); + is($f4->name, 'math', 'Fourth field name is "math"'); + is(lc $f4->data_type, 'float', 'Data type is "float"'); + is($f4->size, '3,1', 'Size is "3,1"'); + is($f4->is_primary_key, 0, 'Field is not PK'); } my $f5 = shift @fields; -is( $f5->name, 'bitmap', 'Fifth field name is "bitmap"' ); -is( lc $f5->data_type, 'char', 'Data type is "char"' ); -is( $f5->size, 1, 'Size is "1"' ); -is( $f5->is_primary_key, 0, 'Field is not PK' ); +is($f5->name, 'bitmap', 'Fifth field name is "bitmap"'); +is(lc $f5->data_type, 'char', 'Data type is "char"'); +is($f5->size, 1, 'Size is "1"'); +is($f5->is_primary_key, 0, 'Field is not PK'); my $f6 = shift @fields; -is( $f6->name, 'today', 'Sixth field name is "today"' ); -is( lc $f6->data_type, 'char', 'Data type is "CHAR"' ); -is( $f6->size, 10, 'Size is "10"' ); -is( $f6->is_primary_key, 0, 'Field is not PK' ); +is($f6->name, 'today', 'Sixth field name is "today"'); +is(lc $f6->data_type, 'char', 'Data type is "CHAR"'); +is($f6->size, 10, 'Size is "10"'); +is($f6->is_primary_key, 0, 'Field is not PK'); my $f7 = shift @fields; -is( $f7->name, 'silly_field_with_random_characters', - 'Seventh field name is "silly_field_with_random_characters"' ); -is( lc $f7->data_type, 'char', 'Data type is "CHAR"' ); -is( $f7->size, 11, 'Size is "11"' ); -is( $f7->is_primary_key, 0, 'Field is not PK' ); +is($f7->name, 'silly_field_with_random_characters', 'Seventh field name is "silly_field_with_random_characters"'); +is(lc $f7->data_type, 'char', 'Data type is "CHAR"'); +is($f7->size, 11, 'Size is "11"'); +is($f7->is_primary_key, 0, 'Field is not PK'); diff --git a/t/11normalize.t b/t/11normalize.t index 197b5319c..99811c7a8 100644 --- a/t/11normalize.t +++ b/t/11normalize.t @@ -6,10 +6,10 @@ use Test::More; use SQL::Translator::Utils qw(normalize_name); my %tests = ( - "silly field (with random characters)" => "silly_field_with_random_characters", - "444" => "_444", - "hello, world" => "hello_world", - "- 9s80 qwehjf 4r" => "_9s80_qwehjf_4r", + "silly field (with random characters)" => "silly_field_with_random_characters", + "444" => "_444", + "hello, world" => "hello_world", + "- 9s80 qwehjf 4r" => "_9s80_qwehjf_4r", ); plan tests => scalar(keys %tests) + 1; @@ -18,6 +18,8 @@ plan tests => scalar(keys %tests) + 1; use_ok("SQL::Translator::Utils"); for my $test (keys %tests) { - is(normalize_name($test) => $tests{$test}, - "normalize_name('$test') => '$tests{$test}'"); + is( + normalize_name($test) => $tests{$test}, + "normalize_name('$test') => '$tests{$test}'" + ); } diff --git a/t/12header_comment.t b/t/12header_comment.t index 84f585852..09ad1aded 100644 --- a/t/12header_comment.t +++ b/t/12header_comment.t @@ -11,8 +11,6 @@ use_ok("SQL::Translator::Utils"); is($DEFAULT_COMMENT, '--', 'default comment'); like(header_comment("foo"), qr/[-][-] Created by foo/, "Created by..."); -my $comm = header_comment("My::Producer", - $DEFAULT_COMMENT, - "Hi mom!"); +my $comm = header_comment("My::Producer", $DEFAULT_COMMENT, "Hi mom!"); like($comm, qr/[-][-] Created by My::Producer/, 'Multiline header comment...'); -like($comm, qr/[-][-] Hi mom!/, '...with additional junk'); +like($comm, qr/[-][-] Hi mom!/, '...with additional junk'); diff --git a/t/13schema.t b/t/13schema.t index 230a84d2e..6fd63af68 100644 --- a/t/13schema.t +++ b/t/13schema.t @@ -13,538 +13,425 @@ require_ok('SQL::Translator'); require_ok('SQL::Translator::Schema'); { - # - # Schema - # - my $schema = SQL::Translator::Schema->new( - name => 'foo', - database => 'MySQL', - ); - isa_ok( $schema, 'SQL::Translator::Schema' ); - - is( $schema->name, 'foo', 'Schema name is "foo"' ); - is( $schema->name('bar'), 'bar', 'Schema name changed to "bar"' ); - - is( $schema->database, 'MySQL', 'Schema database is "MySQL"' ); - is( $schema->database('PostgreSQL'), - 'PostgreSQL', 'Schema database changed to "PostgreSQL"' ); - - is( $schema->is_valid, undef, 'Schema not valid...' ); - like( $schema->error, qr/no tables/i, '...because there are no tables' ); - - # - # $schema->add_* - # - my $foo_table = $schema->add_table( name => 'foo' ) or warn $schema->error; - isa_ok( $foo_table, 'SQL::Translator::Schema::Table', 'Table "foo"' ); - - my $bar_table = SQL::Translator::Schema::Table->new( name => 'bar' ) + # + # Schema + # + my $schema = SQL::Translator::Schema->new( + name => 'foo', + database => 'MySQL', + ); + isa_ok($schema, 'SQL::Translator::Schema'); + + is($schema->name, 'foo', 'Schema name is "foo"'); + is($schema->name('bar'), 'bar', 'Schema name changed to "bar"'); + + is($schema->database, 'MySQL', 'Schema database is "MySQL"'); + is($schema->database('PostgreSQL'), 'PostgreSQL', 'Schema database changed to "PostgreSQL"'); + + is($schema->is_valid, undef, 'Schema not valid...'); + like($schema->error, qr/no tables/i, '...because there are no tables'); + + # + # $schema->add_* + # + my $foo_table = $schema->add_table(name => 'foo') or warn $schema->error; + isa_ok($foo_table, 'SQL::Translator::Schema::Table', 'Table "foo"'); + + my $bar_table = SQL::Translator::Schema::Table->new(name => 'bar') or warn SQL::Translator::Schema::Table->error; - $bar_table = $schema->add_table($bar_table); - isa_ok( $bar_table, 'SQL::Translator::Schema::Table', 'Table "bar"' ); - is( $bar_table->name, 'bar', 'Add table "bar"' ); - - $schema = $bar_table->schema($schema); - isa_ok( $schema, 'SQL::Translator::Schema', 'Schema' ); - - is( $bar_table->name('foo'), - undef, q[Can't change name of table "bar" to "foo"...] ); - like( - $bar_table->error, - qr/can't use table name/i, - q[...because "foo" exists] - ); - - my $redundant_table = $schema->add_table( name => 'foo' ); - is( $redundant_table, undef, qq[Can't create another "foo" table...] ); - like( - $schema->error, - qr/can't use table name/i, - '... because "foo" exists' - ); - - $redundant_table = $schema->add_table( name => '' ); - is( $redundant_table, undef, qq[Can't add an anonymous table...] ); - like( $schema->error, qr/No table name/i, '... because it has no name ' ); - - $redundant_table = SQL::Translator::Schema::Table->new( name => '' ); - is( $redundant_table, undef, qq[Can't create an anonymous table] ); - like( - SQL::Translator::Schema::Table->error, - qr/No table name/i, - '... because it has no name ' - ); - - # - # $schema-> drop_table - # - my $dropped_table = $schema->drop_table( $foo_table->name, cascade => 1 ); - isa_ok( - $dropped_table, - 'SQL::Translator::Schema::Table', - 'Dropped table "foo"' - ); - $schema->add_table($foo_table); - my $dropped_table2 = $schema->drop_table( $foo_table, cascade => 1 ); - isa_ok( - $dropped_table2, - 'SQL::Translator::Schema::Table', - 'Dropped table "foo" by object' - ); - my $dropped_table3 = $schema->drop_table( $foo_table->name, cascade => 1 ); - like( - $schema->error, - qr/doesn't exist/, - qq[Can't drop non-existant table "foo"] - ); - - $schema->add_table($foo_table); - # - # Table default new - # - is( $foo_table->name, 'foo', 'Table name is "foo"' ); - is( "$foo_table", 'foo', 'Table stringifies to "foo"' ); - is( $foo_table->is_valid, undef, 'Table "foo" is not yet valid' ); - - my $fields = $foo_table->get_fields; - is( scalar @{ $fields || [] }, 0, 'Table "foo" has no fields' ); - like( $foo_table->error, qr/no fields/i, 'Error for no fields' ); - - is( $foo_table->comments, undef, 'No comments' ); - - # - # New table with args - # - my $person_table = $schema->add_table( - name => 'person', - comments => 'foo', - ); - is( $person_table->name, 'person', 'Table name is "person"' ); - is( $person_table->is_valid, undef, 'Table is not yet valid' ); - is( $person_table->comments, 'foo', 'Comments = "foo"' ); - is( join( ',', $person_table->comments('bar') ), - 'foo,bar', 'Table comments = "foo,bar"' ); - is( $person_table->comments, "foo\nbar", 'Table comments = "foo,bar"' ); - - # - # Field default new - # - my $f1 = $person_table->add_field( name => 'foo' ) + $bar_table = $schema->add_table($bar_table); + isa_ok($bar_table, 'SQL::Translator::Schema::Table', 'Table "bar"'); + is($bar_table->name, 'bar', 'Add table "bar"'); + + $schema = $bar_table->schema($schema); + isa_ok($schema, 'SQL::Translator::Schema', 'Schema'); + + is($bar_table->name('foo'), undef, q[Can't change name of table "bar" to "foo"...]); + like($bar_table->error, qr/can't use table name/i, q[...because "foo" exists]); + + my $redundant_table = $schema->add_table(name => 'foo'); + is($redundant_table, undef, qq[Can't create another "foo" table...]); + like($schema->error, qr/can't use table name/i, '... because "foo" exists'); + + $redundant_table = $schema->add_table(name => ''); + is($redundant_table, undef, qq[Can't add an anonymous table...]); + like($schema->error, qr/No table name/i, '... because it has no name '); + + $redundant_table = SQL::Translator::Schema::Table->new(name => ''); + is($redundant_table, undef, qq[Can't create an anonymous table]); + like(SQL::Translator::Schema::Table->error, qr/No table name/i, '... because it has no name '); + + # + # $schema-> drop_table + # + my $dropped_table = $schema->drop_table($foo_table->name, cascade => 1); + isa_ok($dropped_table, 'SQL::Translator::Schema::Table', 'Dropped table "foo"'); + $schema->add_table($foo_table); + my $dropped_table2 = $schema->drop_table($foo_table, cascade => 1); + isa_ok($dropped_table2, 'SQL::Translator::Schema::Table', 'Dropped table "foo" by object'); + my $dropped_table3 = $schema->drop_table($foo_table->name, cascade => 1); + like($schema->error, qr/doesn't exist/, qq[Can't drop non-existant table "foo"]); + + $schema->add_table($foo_table); + # + # Table default new + # + is($foo_table->name, 'foo', 'Table name is "foo"'); + is("$foo_table", 'foo', 'Table stringifies to "foo"'); + is($foo_table->is_valid, undef, 'Table "foo" is not yet valid'); + + my $fields = $foo_table->get_fields; + is(scalar @{ $fields || [] }, 0, 'Table "foo" has no fields'); + like($foo_table->error, qr/no fields/i, 'Error for no fields'); + + is($foo_table->comments, undef, 'No comments'); + + # + # New table with args + # + my $person_table = $schema->add_table( + name => 'person', + comments => 'foo', + ); + is($person_table->name, 'person', 'Table name is "person"'); + is($person_table->is_valid, undef, 'Table is not yet valid'); + is($person_table->comments, 'foo', 'Comments = "foo"'); + is(join(',', $person_table->comments('bar')), 'foo,bar', 'Table comments = "foo,bar"'); + is($person_table->comments, "foo\nbar", 'Table comments = "foo,bar"'); + + # + # Field default new + # + my $f1 = $person_table->add_field(name => 'foo') or warn $person_table->error; - isa_ok( $f1, 'SQL::Translator::Schema::Field', 'Field' ); - is( $f1->name, 'foo', 'Field name is "foo"' ); - is( $f1->full_name, 'person.foo', 'Field full_name is "person.foo"' ); - is( "$f1", 'foo', 'Field stringifies to "foo"' ); - is( $f1->data_type, '', 'Field data type is blank' ); - is( $f1->size, 0, 'Field size is "0"' ); - is( $f1->is_primary_key, '0', 'Field is_primary_key is false' ); - is( $f1->is_nullable, 1, 'Field can be NULL' ); - is( $f1->default_value, undef, 'Field default is undefined' ); - is( $f1->comments, '', 'No comments' ); - is( $f1->table, 'person', 'Field table is person' ); - is( $f1->schema->database, 'PostgreSQL', 'Field schema shortcut works' ); - - my $f2 = SQL::Translator::Schema::Field->new( - name => 'f2', - comments => 'foo', - ) or warn SQL::Translator::Schema::Field->error; - $f2 = $person_table->add_field($f2); - isa_ok( $f1, 'SQL::Translator::Schema::Field', 'f2' ); - is( $f2->name, 'f2', 'Add field "f2"' ); - is( $f2->is_nullable(0), 0, 'Field cannot be NULL' ); - is( $f2->is_nullable(''), 0, 'Field cannot be NULL' ); - is( $f2->is_nullable('0'), 0, 'Field cannot be NULL' ); - is( $f2->default_value(''), '', 'Field default is empty string' ); - is( $f2->comments, 'foo', 'Field comment = "foo"' ); - is( join( ',', $f2->comments('bar') ), - 'foo,bar', 'Field comment = "foo,bar"' ); - is( $f2->comments, "foo\nbar", 'Field comment = "foo,bar"' ); - - $person_table = $f2->table($person_table); - isa_ok( $person_table, 'SQL::Translator::Schema::Table', 'person_table' ); - - is( $f2->name('foo'), undef, q[Can't set field name of "f2" to "foo"...] ); - like( $f2->error, qr/can't use field name/i, '...because name exists' ); - - my $redundant_field = $person_table->add_field( name => 'f2' ); - is( $redundant_field, undef, qq[Didn't create another "f2" field...] ); - like( $person_table->error, qr/can't use field/i, '... because it exists' ); - - $redundant_field = $person_table->add_field( name => '' ); - is( $redundant_field, undef, qq[Didn't add a "" field...] ); - like( - $person_table->error, - qr/No field name/i, - '... because it has no name' - ); - - $redundant_field = SQL::Translator::Schema::Field->new( name => '' ); - is( $redundant_field, undef, qq[Didn't create a "" field...] ); - like( - SQL::Translator::Schema::Field->error, - qr/No field name/i, - '... because it has no name' - ); - - my @fields = $person_table->get_fields; - is( scalar @fields, 2, 'Table "foo" has 2 fields' ); - - is( $fields[0]->name, 'foo', 'First field is "foo"' ); - is( $fields[1]->name, 'f2', 'Second field is "f2"' ); - is( join( ",", $person_table->field_names ), - 'foo,f2', 'field_names is "foo,f2"' ); - - my $ci_field = $person_table->get_field( 'FOO', 'case_insensitive' ); - is( $ci_field->name, 'foo', 'Got field case-insensitively' ); - # - # $table-> drop_field - # - my $dropped_field = $person_table->drop_field( $f2->name, cascade => 1 ); - isa_ok( - $dropped_field, - 'SQL::Translator::Schema::Field', - 'Dropped field "f2"' - ); - $person_table->add_field($f2); - my $dropped_field2 = $person_table->drop_field( $f2, cascade => 1 ); - isa_ok( - $dropped_field2, - 'SQL::Translator::Schema::Field', - 'Dropped field "f2" by object' - ); - my $dropped_field3 = $person_table->drop_field( $f2->name, cascade => 1 ); - like( - $person_table->error, - qr/doesn't exist/, - qq[Can't drop non-existant field "f2"] - ); - - $person_table->add_field($f2); - - # - # Field methods - # - is( $f1->name('person_name'), 'person_name', - 'Field name is "person_name"' ); - is( $f1->data_type('varchar'), 'varchar', 'Field data type is "varchar"' ); - is( $f1->size('30'), '30', 'Field size is "30"' ); - is( $f1->is_primary_key(0), '0', 'Field is_primary_key is negative' ); - - $f1->extra( foo => 'bar' ); - $f1->extra( { baz => 'quux' } ); - my %extra = $f1->extra; - is( $extra{'foo'}, 'bar', 'Field extra "foo" is "bar"' ); - is( $extra{'baz'}, 'quux', 'Field extra "baz" is "quux"' ); - - # - # New field with args - # - my $age = $person_table->add_field( - name => 'age', - data_type => 'float', - size => '10,2', - ); - is( $age->name, 'age', 'Field name is "age"' ); - is( $age->data_type, 'float', 'Field data type is "float"' ); - is( $age->size, '10,2', 'Field size is "10,2"' ); - is( $age->size( 10, 2 ), '10,2', 'Field size still "10,2"' ); - is( $age->size( [ 10, 2 ] ), '10,2', 'Field size still "10,2"' ); - is( $age->size(qw[ 10 2 ]), '10,2', 'Field size still "10,2"' ); - is( join( ':', $age->size ), '10:2', 'Field size returns array' ); - - # - # Index - # - my @indices = $person_table->get_indices; - is( scalar @indices, 0, 'No indices' ); - like( $person_table->error, qr/no indices/i, 'Error for no indices' ); - my $index1 = $person_table->add_index( name => "foo" ) + isa_ok($f1, 'SQL::Translator::Schema::Field', 'Field'); + is($f1->name, 'foo', 'Field name is "foo"'); + is($f1->full_name, 'person.foo', 'Field full_name is "person.foo"'); + is("$f1", 'foo', 'Field stringifies to "foo"'); + is($f1->data_type, '', 'Field data type is blank'); + is($f1->size, 0, 'Field size is "0"'); + is($f1->is_primary_key, '0', 'Field is_primary_key is false'); + is($f1->is_nullable, 1, 'Field can be NULL'); + is($f1->default_value, undef, 'Field default is undefined'); + is($f1->comments, '', 'No comments'); + is($f1->table, 'person', 'Field table is person'); + is($f1->schema->database, 'PostgreSQL', 'Field schema shortcut works'); + + my $f2 = SQL::Translator::Schema::Field->new( + name => 'f2', + comments => 'foo', + ) or warn SQL::Translator::Schema::Field->error; + $f2 = $person_table->add_field($f2); + isa_ok($f1, 'SQL::Translator::Schema::Field', 'f2'); + is($f2->name, 'f2', 'Add field "f2"'); + is($f2->is_nullable(0), 0, 'Field cannot be NULL'); + is($f2->is_nullable(''), 0, 'Field cannot be NULL'); + is($f2->is_nullable('0'), 0, 'Field cannot be NULL'); + is($f2->default_value(''), '', 'Field default is empty string'); + is($f2->comments, 'foo', 'Field comment = "foo"'); + is(join(',', $f2->comments('bar')), 'foo,bar', 'Field comment = "foo,bar"'); + is($f2->comments, "foo\nbar", 'Field comment = "foo,bar"'); + + $person_table = $f2->table($person_table); + isa_ok($person_table, 'SQL::Translator::Schema::Table', 'person_table'); + + is($f2->name('foo'), undef, q[Can't set field name of "f2" to "foo"...]); + like($f2->error, qr/can't use field name/i, '...because name exists'); + + my $redundant_field = $person_table->add_field(name => 'f2'); + is($redundant_field, undef, qq[Didn't create another "f2" field...]); + like($person_table->error, qr/can't use field/i, '... because it exists'); + + $redundant_field = $person_table->add_field(name => ''); + is($redundant_field, undef, qq[Didn't add a "" field...]); + like($person_table->error, qr/No field name/i, '... because it has no name'); + + $redundant_field = SQL::Translator::Schema::Field->new(name => ''); + is($redundant_field, undef, qq[Didn't create a "" field...]); + like(SQL::Translator::Schema::Field->error, qr/No field name/i, '... because it has no name'); + + my @fields = $person_table->get_fields; + is(scalar @fields, 2, 'Table "foo" has 2 fields'); + + is($fields[0]->name, 'foo', 'First field is "foo"'); + is($fields[1]->name, 'f2', 'Second field is "f2"'); + is(join(",", $person_table->field_names), 'foo,f2', 'field_names is "foo,f2"'); + + my $ci_field = $person_table->get_field('FOO', 'case_insensitive'); + is($ci_field->name, 'foo', 'Got field case-insensitively'); + # + # $table-> drop_field + # + my $dropped_field = $person_table->drop_field($f2->name, cascade => 1); + isa_ok($dropped_field, 'SQL::Translator::Schema::Field', 'Dropped field "f2"'); + $person_table->add_field($f2); + my $dropped_field2 = $person_table->drop_field($f2, cascade => 1); + isa_ok($dropped_field2, 'SQL::Translator::Schema::Field', 'Dropped field "f2" by object'); + my $dropped_field3 = $person_table->drop_field($f2->name, cascade => 1); + like($person_table->error, qr/doesn't exist/, qq[Can't drop non-existant field "f2"]); + + $person_table->add_field($f2); + + # + # Field methods + # + is($f1->name('person_name'), 'person_name', 'Field name is "person_name"'); + is($f1->data_type('varchar'), 'varchar', 'Field data type is "varchar"'); + is($f1->size('30'), '30', 'Field size is "30"'); + is($f1->is_primary_key(0), '0', 'Field is_primary_key is negative'); + + $f1->extra(foo => 'bar'); + $f1->extra({ baz => 'quux' }); + my %extra = $f1->extra; + is($extra{'foo'}, 'bar', 'Field extra "foo" is "bar"'); + is($extra{'baz'}, 'quux', 'Field extra "baz" is "quux"'); + + # + # New field with args + # + my $age = $person_table->add_field( + name => 'age', + data_type => 'float', + size => '10,2', + ); + is($age->name, 'age', 'Field name is "age"'); + is($age->data_type, 'float', 'Field data type is "float"'); + is($age->size, '10,2', 'Field size is "10,2"'); + is($age->size(10, 2), '10,2', 'Field size still "10,2"'); + is($age->size([ 10, 2 ]), '10,2', 'Field size still "10,2"'); + is($age->size(qw[ 10 2 ]), '10,2', 'Field size still "10,2"'); + is(join(':', $age->size), '10:2', 'Field size returns array'); + + # + # Index + # + my @indices = $person_table->get_indices; + is(scalar @indices, 0, 'No indices'); + like($person_table->error, qr/no indices/i, 'Error for no indices'); + my $index1 = $person_table->add_index(name => "foo") or warn $person_table->error; - isa_ok( $index1, 'SQL::Translator::Schema::Index', 'Index' ); - is( $index1->name, 'foo', 'Index name is "foo"' ); + isa_ok($index1, 'SQL::Translator::Schema::Index', 'Index'); + is($index1->name, 'foo', 'Index name is "foo"'); - is( $index1->is_valid, undef, 'Index name is not valid...' ); - like( $index1->error, qr/no fields/i, '...because it has no fields' ); + is($index1->is_valid, undef, 'Index name is not valid...'); + like($index1->error, qr/no fields/i, '...because it has no fields'); - is( join( ':', $index1->fields('foo,bar') ), - 'foo:bar', 'Index accepts fields' ); + is(join(':', $index1->fields('foo,bar')), 'foo:bar', 'Index accepts fields'); - is( $index1->is_valid, undef, 'Index name is not valid...' ); - like( - $index1->error, - qr/does not exist in table/i, - '...because it used fields not in the table' - ); + is($index1->is_valid, undef, 'Index name is not valid...'); + like($index1->error, qr/does not exist in table/i, '...because it used fields not in the table'); - is( join( ':', $index1->fields(qw[foo age]) ), - 'foo:age', 'Index accepts fields' ); - is( $index1->is_valid, 1, 'Index name is now valid' ); + is(join(':', $index1->fields(qw[foo age])), 'foo:age', 'Index accepts fields'); + is($index1->is_valid, 1, 'Index name is now valid'); - is( $index1->type, NORMAL, 'Index type is "normal"' ); + is($index1->type, NORMAL, 'Index type is "normal"'); - my $index2 = SQL::Translator::Schema::Index->new( name => "bar" ) + my $index2 = SQL::Translator::Schema::Index->new(name => "bar") or warn SQL::Translator::Schema::Index->error; - $index2 = $person_table->add_index($index2); - isa_ok( $index2, 'SQL::Translator::Schema::Index', 'Index' ); - is( $index2->name, 'bar', 'Index name is "bar"' ); - - my $index3 = $person_table->add_index( - name => "sized", - fields => [ { name => 'forename', prefix_length => 15 } ] - ) or warn $person_table->error; - isa_ok( $index3, 'SQL::Translator::Schema::Index', 'Index' ); - is( $index3->name, 'sized', 'Index name is "sized"' ); - - # Test index comparison function. - # 2 completely different indexes - ok( !$index3->equals($index2), - "2 different indexes return false on equals() function (simple)" ); - - # Same indexes with different lengths - my $index4 = SQL::Translator::Schema::Index->new( - name => "sized", - fields => [ { name => 'forename', prefix_length => 20 } ] - ); - ok( !$index3->equals($index4), -"2 different indexes return false on equals() function (index length different)" - ); - - # Identical indexes with lengths - my $index5 = SQL::Translator::Schema::Index->new( - name => "sized", - fields => [ { name => 'forename', prefix_length => 15 } ] - ); - ok( $index3->equals($index5), - "2 identical indexes return true on equals() (with index length)" ); - - # Identical indexes without lengths - my $index6 = SQL::Translator::Schema::Index->new( - name => "foo", - fields => [qw/foo age/] - ); - ok( $index6->equals($index1), - "2 identical indexes return true on equals() (without index length)" ); - - # Check comparison of index names - my $index7 = SQL::Translator::Schema::Index->new( name => "bar" ); - ok( $index7->equals($index2), "2 empty indexes return true on equals()" ); - - # Check that 2 indexes are equal, if one doesn't have a name, and the - # other has a name that is the same as the first field - my $index8 = SQL::Translator::Schema::Index->new( fields => [qw/foo age/] ); - ok( - $index8->equals( $index6, 0, 0, 1 ), - "Compare 2 indexes, one without name" - ); - - my $indices = $person_table->get_indices; - is( scalar @$indices, 3, 'Three indices' ); - is( $indices->[0]->name, 'foo', '"foo" index' ); - is( $indices->[1]->name, 'bar', '"bar" index' ); - is( $indices->[2]->name, 'sized', '"sized" index' ); - - # - # $table-> drop_index - # - my $dropped_index = $person_table->drop_index( $index1->name ); - isa_ok( - $dropped_index, - 'SQL::Translator::Schema::Index', - 'Dropped index "foo"' - ); - $person_table->add_index($index1); - my $dropped_index2 = $person_table->drop_index($index1); - isa_ok( - $dropped_index2, - 'SQL::Translator::Schema::Index', - 'Dropped index "foo" by object' - ); - is( $dropped_index2->name, $index1->name, 'Dropped correct index "foo"' ); - my $dropped_index3 = $person_table->drop_index( $index1->name ); - like( - $person_table->error, - qr/doesn't exist/, - qq[Can't drop non-existant index "foo"] - ); - - $person_table->add_index($index1); - - # - # Constraint - # - my @constraints = $person_table->get_constraints; - is( scalar @constraints, 0, 'No constraints' ); - like( - $person_table->error, - qr/no constraints/i, - 'Error for no constraints' - ); - my $constraint1 = $person_table->add_constraint( name => 'foo' ) + $index2 = $person_table->add_index($index2); + isa_ok($index2, 'SQL::Translator::Schema::Index', 'Index'); + is($index2->name, 'bar', 'Index name is "bar"'); + + my $index3 = $person_table->add_index( + name => "sized", + fields => [ { name => 'forename', prefix_length => 15 } ] + ) or warn $person_table->error; + isa_ok($index3, 'SQL::Translator::Schema::Index', 'Index'); + is($index3->name, 'sized', 'Index name is "sized"'); + + # Test index comparison function. + # 2 completely different indexes + ok(!$index3->equals($index2), "2 different indexes return false on equals() function (simple)"); + + # Same indexes with different lengths + my $index4 = SQL::Translator::Schema::Index->new( + name => "sized", + fields => [ { name => 'forename', prefix_length => 20 } ] + ); + ok(!$index3->equals($index4), "2 different indexes return false on equals() function (index length different)"); + + # Identical indexes with lengths + my $index5 = SQL::Translator::Schema::Index->new( + name => "sized", + fields => [ { name => 'forename', prefix_length => 15 } ] + ); + ok($index3->equals($index5), "2 identical indexes return true on equals() (with index length)"); + + # Identical indexes without lengths + my $index6 = SQL::Translator::Schema::Index->new( + name => "foo", + fields => [qw/foo age/] + ); + ok($index6->equals($index1), "2 identical indexes return true on equals() (without index length)"); + + # Check comparison of index names + my $index7 = SQL::Translator::Schema::Index->new(name => "bar"); + ok($index7->equals($index2), "2 empty indexes return true on equals()"); + + # Check that 2 indexes are equal, if one doesn't have a name, and the + # other has a name that is the same as the first field + my $index8 = SQL::Translator::Schema::Index->new(fields => [qw/foo age/]); + ok($index8->equals($index6, 0, 0, 1), "Compare 2 indexes, one without name"); + + my $indices = $person_table->get_indices; + is(scalar @$indices, 3, 'Three indices'); + is($indices->[0]->name, 'foo', '"foo" index'); + is($indices->[1]->name, 'bar', '"bar" index'); + is($indices->[2]->name, 'sized', '"sized" index'); + + # + # $table-> drop_index + # + my $dropped_index = $person_table->drop_index($index1->name); + isa_ok($dropped_index, 'SQL::Translator::Schema::Index', 'Dropped index "foo"'); + $person_table->add_index($index1); + my $dropped_index2 = $person_table->drop_index($index1); + isa_ok($dropped_index2, 'SQL::Translator::Schema::Index', 'Dropped index "foo" by object'); + is($dropped_index2->name, $index1->name, 'Dropped correct index "foo"'); + my $dropped_index3 = $person_table->drop_index($index1->name); + like($person_table->error, qr/doesn't exist/, qq[Can't drop non-existant index "foo"]); + + $person_table->add_index($index1); + + # + # Constraint + # + my @constraints = $person_table->get_constraints; + is(scalar @constraints, 0, 'No constraints'); + like($person_table->error, qr/no constraints/i, 'Error for no constraints'); + my $constraint1 = $person_table->add_constraint(name => 'foo') or warn $person_table->error; - isa_ok( $constraint1, 'SQL::Translator::Schema::Constraint', 'Constraint' ); - is( $constraint1->name, 'foo', 'Constraint name is "foo"' ); - - $fields = join( ',', $constraint1->fields('age') ); - is( $fields, 'age', 'Constraint field = "age"' ); - - $fields = $constraint1->fields; - ok( - ref $fields[0] && $fields[0]->isa("SQL::Translator::Schema::Field"), - 'Constraint fields returns a SQL::Translator::Schema::Field' - ); - - $fields = join( ',', $constraint1->fields('age,age') ); - is( $fields, 'age', 'Constraint field = "age"' ); - - $fields = join( ',', $constraint1->fields( 'age', 'name' ) ); - is( $fields, 'age,name', 'Constraint field = "age,name"' ); - - $fields = join( ',', $constraint1->fields('age,name,age') ); - is( $fields, 'age,name', 'Constraint field = "age,name"' ); - - $fields = join( ',', $constraint1->fields('age, name') ); - is( $fields, 'age,name', 'Constraint field = "age,name"' ); - - $fields = join( ',', $constraint1->fields( [ 'age', 'name' ] ) ); - is( $fields, 'age,name', 'Constraint field = "age,name"' ); - - $fields = join( ',', $constraint1->fields(qw[ age name ]) ); - is( $fields, 'age,name', 'Constraint field = "age,name"' ); - - $fields = join( ',', $constraint1->field_names ); - is( $fields, 'age,name', 'Constraint field_names = "age,name"' ); - - is( $constraint1->match_type, '', 'Constraint match type is empty' ); - is( $constraint1->match_type('foo'), - undef, 'Constraint match type rejects bad arg...' ); - like( - $constraint1->error, - qr/invalid match type/i, - '...because it is invalid' - ); - is( $constraint1->match_type('FULL'), - 'full', 'Constraint match type = "full"' ); - - my $constraint2 = SQL::Translator::Schema::Constraint->new( name => 'bar' ); - $constraint2 = $person_table->add_constraint($constraint2); - isa_ok( $constraint2, 'SQL::Translator::Schema::Constraint', 'Constraint' ); - is( $constraint2->name, 'bar', 'Constraint name is "bar"' ); - - my $constraint3 = $person_table->add_constraint( - type => 'check', - expression => 'foo bar', - ) or die $person_table->error; - isa_ok( $constraint3, 'SQL::Translator::Schema::Constraint', 'Constraint' ); - is( $constraint3->type, CHECK_C, 'Constraint type is "CHECK"' ); - is( $constraint3->expression, 'foo bar', - 'Constraint expression is "foo bar"' ); - - my $constraints = $person_table->get_constraints; - is( scalar @$constraints, 3, 'Three constraints' ); - is( $constraints->[0]->name, 'foo', '"foo" constraint' ); - is( $constraints->[1]->name, 'bar', '"bar" constraint' ); - - # - # $table-> drop_constraint - # - my $dropped_con = $person_table->drop_constraint( $constraint1->name ); - isa_ok( - $dropped_con, - 'SQL::Translator::Schema::Constraint', - 'Dropped constraint "foo"' - ); - $person_table->add_constraint($constraint1); - my $dropped_con2 = $person_table->drop_constraint($constraint1); - isa_ok( - $dropped_con2, - 'SQL::Translator::Schema::Constraint', - 'Dropped constraint "foo" by object' - ); - is( $dropped_con2->name, $constraint1->name, - 'Dropped correct constraint "foo"' ); - my $dropped_con3 = $person_table->drop_constraint( $constraint1->name ); - like( - $person_table->error, - qr/doesn't exist/, - qq[Can't drop non-existant constraint "foo"] - ); - - $person_table->add_constraint($constraint1); - - # - # View - # - my $view = $schema->add_view( name => 'view1' ) or warn $schema->error; - isa_ok( $view, 'SQL::Translator::Schema::View', 'View' ); - my $view_sql = 'select * from table'; - is( $view->sql($view_sql), $view_sql, 'View SQL is good' ); - - my $view2 = SQL::Translator::Schema::View->new( name => 'view2' ) + isa_ok($constraint1, 'SQL::Translator::Schema::Constraint', 'Constraint'); + is($constraint1->name, 'foo', 'Constraint name is "foo"'); + + $fields = join(',', $constraint1->fields('age')); + is($fields, 'age', 'Constraint field = "age"'); + + $fields = $constraint1->fields; + ok( + ref $fields[0] && $fields[0]->isa("SQL::Translator::Schema::Field"), + 'Constraint fields returns a SQL::Translator::Schema::Field' + ); + + $fields = join(',', $constraint1->fields('age,age')); + is($fields, 'age', 'Constraint field = "age"'); + + $fields = join(',', $constraint1->fields('age', 'name')); + is($fields, 'age,name', 'Constraint field = "age,name"'); + + $fields = join(',', $constraint1->fields('age,name,age')); + is($fields, 'age,name', 'Constraint field = "age,name"'); + + $fields = join(',', $constraint1->fields('age, name')); + is($fields, 'age,name', 'Constraint field = "age,name"'); + + $fields = join(',', $constraint1->fields([ 'age', 'name' ])); + is($fields, 'age,name', 'Constraint field = "age,name"'); + + $fields = join(',', $constraint1->fields(qw[ age name ])); + is($fields, 'age,name', 'Constraint field = "age,name"'); + + $fields = join(',', $constraint1->field_names); + is($fields, 'age,name', 'Constraint field_names = "age,name"'); + + is($constraint1->match_type, '', 'Constraint match type is empty'); + is($constraint1->match_type('foo'), undef, 'Constraint match type rejects bad arg...'); + like($constraint1->error, qr/invalid match type/i, '...because it is invalid'); + is($constraint1->match_type('FULL'), 'full', 'Constraint match type = "full"'); + + my $constraint2 = SQL::Translator::Schema::Constraint->new(name => 'bar'); + $constraint2 = $person_table->add_constraint($constraint2); + isa_ok($constraint2, 'SQL::Translator::Schema::Constraint', 'Constraint'); + is($constraint2->name, 'bar', 'Constraint name is "bar"'); + + my $constraint3 = $person_table->add_constraint( + type => 'check', + expression => 'foo bar', + ) or die $person_table->error; + isa_ok($constraint3, 'SQL::Translator::Schema::Constraint', 'Constraint'); + is($constraint3->type, CHECK_C, 'Constraint type is "CHECK"'); + is($constraint3->expression, 'foo bar', 'Constraint expression is "foo bar"'); + + my $constraints = $person_table->get_constraints; + is(scalar @$constraints, 3, 'Three constraints'); + is($constraints->[0]->name, 'foo', '"foo" constraint'); + is($constraints->[1]->name, 'bar', '"bar" constraint'); + + # + # $table-> drop_constraint + # + my $dropped_con = $person_table->drop_constraint($constraint1->name); + isa_ok($dropped_con, 'SQL::Translator::Schema::Constraint', 'Dropped constraint "foo"'); + $person_table->add_constraint($constraint1); + my $dropped_con2 = $person_table->drop_constraint($constraint1); + isa_ok($dropped_con2, 'SQL::Translator::Schema::Constraint', 'Dropped constraint "foo" by object'); + is($dropped_con2->name, $constraint1->name, 'Dropped correct constraint "foo"'); + my $dropped_con3 = $person_table->drop_constraint($constraint1->name); + like($person_table->error, qr/doesn't exist/, qq[Can't drop non-existant constraint "foo"]); + + $person_table->add_constraint($constraint1); + + # + # View + # + my $view = $schema->add_view(name => 'view1') or warn $schema->error; + isa_ok($view, 'SQL::Translator::Schema::View', 'View'); + my $view_sql = 'select * from table'; + is($view->sql($view_sql), $view_sql, 'View SQL is good'); + + my $view2 = SQL::Translator::Schema::View->new(name => 'view2') or warn SQL::Translator::Schema::View->error; - my $check_view = $schema->add_view($view2); - is( $check_view->name, 'view2', 'Add view "view2"' ); - - my $redundant_view = $schema->add_view( name => 'view2' ); - is( $redundant_view, undef, qq[Didn't create another "view2" view...] ); - like( $schema->error, qr/can't create view/i, '... because it exists' ); - - # - # $schema-> drop_view - # - my $dropped_view = $schema->drop_view( $view->name ); - isa_ok( - $dropped_view, - 'SQL::Translator::Schema::View', - 'Dropped view "view1"' - ); - $schema->add_view($view); - my $dropped_view2 = $schema->drop_view($view); - isa_ok( - $dropped_view2, - 'SQL::Translator::Schema::View', - 'Dropped view "view1" by object' - ); - is( $dropped_view2->name, $view->name, 'Dropped correct view "view1"' ); - my $dropped_view3 = $schema->drop_view( $view->name ); - like( - $schema->error, - qr/doesn't exist/, - qq[Can't drop non-existant view "view1"] - ); - - $schema->add_view($view); - - # - # $schema->get_* - # - my $bad_table = $schema->get_table; - like( $schema->error, qr/no table/i, 'Error on no arg to get_table' ); - - $bad_table = $schema->get_table('baz'); - like( $schema->error, qr/does not exist/i, - 'Error on bad arg to get_table' ); - - my $bad_view = $schema->get_view; - like( $schema->error, qr/no view/i, 'Error on no arg to get_view' ); - - $bad_view = $schema->get_view('bar'); - like( $schema->error, qr/does not exist/i, 'Error on bad arg to get_view' ); - - my $good_table = $schema->get_table('foo'); - isa_ok( $good_table, 'SQL::Translator::Schema::Table', 'Table "foo"' ); - - my $good_view = $schema->get_view('view1'); - isa_ok( $good_view, 'SQL::Translator::Schema::View', 'View "view1"' ); - is( $view->sql($view_sql), $view_sql, 'View SQL is good' ); - - # - # $schema->get_*s - # - my @tables = $schema->get_tables; - is( scalar @tables, 3, 'Found 2 tables' ); - - my @views = $schema->get_views; - is( scalar @views, 2, 'Found 1 view' ); + my $check_view = $schema->add_view($view2); + is($check_view->name, 'view2', 'Add view "view2"'); + + my $redundant_view = $schema->add_view(name => 'view2'); + is($redundant_view, undef, qq[Didn't create another "view2" view...]); + like($schema->error, qr/can't create view/i, '... because it exists'); + + # + # $schema-> drop_view + # + my $dropped_view = $schema->drop_view($view->name); + isa_ok($dropped_view, 'SQL::Translator::Schema::View', 'Dropped view "view1"'); + $schema->add_view($view); + my $dropped_view2 = $schema->drop_view($view); + isa_ok($dropped_view2, 'SQL::Translator::Schema::View', 'Dropped view "view1" by object'); + is($dropped_view2->name, $view->name, 'Dropped correct view "view1"'); + my $dropped_view3 = $schema->drop_view($view->name); + like($schema->error, qr/doesn't exist/, qq[Can't drop non-existant view "view1"]); + + $schema->add_view($view); + + # + # $schema->get_* + # + my $bad_table = $schema->get_table; + like($schema->error, qr/no table/i, 'Error on no arg to get_table'); + + $bad_table = $schema->get_table('baz'); + like($schema->error, qr/does not exist/i, 'Error on bad arg to get_table'); + + my $bad_view = $schema->get_view; + like($schema->error, qr/no view/i, 'Error on no arg to get_view'); + + $bad_view = $schema->get_view('bar'); + like($schema->error, qr/does not exist/i, 'Error on bad arg to get_view'); + + my $good_table = $schema->get_table('foo'); + isa_ok($good_table, 'SQL::Translator::Schema::Table', 'Table "foo"'); + + my $good_view = $schema->get_view('view1'); + isa_ok($good_view, 'SQL::Translator::Schema::View', 'View "view1"'); + is($view->sql($view_sql), $view_sql, 'View SQL is good'); + + # + # $schema->get_*s + # + my @tables = $schema->get_tables; + is(scalar @tables, 3, 'Found 2 tables'); + + my @views = $schema->get_views; + is(scalar @views, 2, 'Found 1 view'); } @@ -552,369 +439,314 @@ require_ok('SQL::Translator::Schema'); # Test ability to introspect some values # { - my $s = SQL::Translator::Schema->new( - name => 'foo', - database => 'PostgreSQL', - ); - my $t = $s->add_table( name => 'person' ) or warn $s->error; - my $f = $t->add_field( name => 'person_id' ) or warn $t->error; - $f->data_type('serial'); - - my $c = $t->add_constraint( - type => PRIMARY_KEY, - fields => 'person_id', - ) or warn $t->error; - - is( $f->is_primary_key, 1, 'Field is PK' ); - is( $f->is_auto_increment, 1, 'Field is auto inc' ); + my $s = SQL::Translator::Schema->new( + name => 'foo', + database => 'PostgreSQL', + ); + my $t = $s->add_table(name => 'person') or warn $s->error; + my $f = $t->add_field(name => 'person_id') or warn $t->error; + $f->data_type('serial'); + + my $c = $t->add_constraint( + type => PRIMARY_KEY, + fields => 'person_id', + ) or warn $t->error; + + is($f->is_primary_key, 1, 'Field is PK'); + is($f->is_auto_increment, 1, 'Field is auto inc'); } # # FK constraint validity # { - my $s = SQL::Translator::Schema->new; - my $t = $s->add_table( name => 'person' ) or warn $s->error; - my $c = $t->add_constraint or warn $t->error; - - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( $c->error, qr/no type/i, '...because it has no type' ); - - is( $c->type(FOREIGN_KEY), FOREIGN_KEY, 'Constraint type now a FK' ); - - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( $c->error, qr/no fields/i, '...because it has no fields' ); - - is( join( '', $c->fields('foo') ), 'foo', 'Fields now = "foo"' ); - - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( - $c->error, - qr/non-existent field/i, - q[...because field "foo" doesn't exist] - ); - - my $fk = $t->add_field( name => 'pet_id' ); - is( $fk->name, 'pet_id', 'Added field "pet_id"' ); - is( join( '', $c->fields('pet_id') ), 'pet_id', 'Fields now = "pet_id"' ); - - $t->add_field( name => 'f1' ); - $t->add_field( name => 'f2' ); - is( join( ',', $c->fields('f1,f2') ), 'f1,f2', 'Fields now = "f1,f2"' ); - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( $c->error, qr/only one field/i, - q[...because too many fields for FK] ); - - $c->fields('f1'); - - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( - $c->error, - qr/no reference table/i, - q[...because there's no reference table] - ); - - is( $c->reference_table('foo'), 'foo', 'Reference table now = "foo"' ); - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( - $c->error, - qr/no table named/i, - q[...because reference table "foo" doesn't exist] - ); - - my $t2 = $s->add_table( name => 'pet' ); - is( $t2->name, 'pet', 'Added "pet" table' ); - - is( $c->reference_table('pet'), 'pet', 'Reference table now = "pet"' ); - - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( - $c->error, - qr/no reference fields/i, - q[...because there're no reference fields] - ); - - is( join( '', $c->reference_fields('pet_id') ), - 'pet_id', 'Reference fields = "pet_id"' ); - - is( $c->is_valid, undef, 'Constraint on "person" not valid...' ); - like( - $c->error, - qr/non-existent field/i, - q[...because there's no "pet_id" field in "pet"] - ); - - my $pet_id = $t2->add_field( name => 'pet_id' ); - is( $pet_id->name, 'pet_id', 'Added field "pet_id"' ); - - is( $c->is_valid, 1, 'Constraint now valid' ); + my $s = SQL::Translator::Schema->new; + my $t = $s->add_table(name => 'person') or warn $s->error; + my $c = $t->add_constraint or warn $t->error; + + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/no type/i, '...because it has no type'); + + is($c->type(FOREIGN_KEY), FOREIGN_KEY, 'Constraint type now a FK'); + + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/no fields/i, '...because it has no fields'); + + is(join('', $c->fields('foo')), 'foo', 'Fields now = "foo"'); + + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/non-existent field/i, q[...because field "foo" doesn't exist]); + + my $fk = $t->add_field(name => 'pet_id'); + is($fk->name, 'pet_id', 'Added field "pet_id"'); + is(join('', $c->fields('pet_id')), 'pet_id', 'Fields now = "pet_id"'); + + $t->add_field(name => 'f1'); + $t->add_field(name => 'f2'); + is(join(',', $c->fields('f1,f2')), 'f1,f2', 'Fields now = "f1,f2"'); + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/only one field/i, q[...because too many fields for FK]); + + $c->fields('f1'); + + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/no reference table/i, q[...because there's no reference table]); + + is($c->reference_table('foo'), 'foo', 'Reference table now = "foo"'); + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/no table named/i, q[...because reference table "foo" doesn't exist]); + + my $t2 = $s->add_table(name => 'pet'); + is($t2->name, 'pet', 'Added "pet" table'); + + is($c->reference_table('pet'), 'pet', 'Reference table now = "pet"'); + + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/no reference fields/i, q[...because there're no reference fields]); + + is(join('', $c->reference_fields('pet_id')), 'pet_id', 'Reference fields = "pet_id"'); + + is($c->is_valid, undef, 'Constraint on "person" not valid...'); + like($c->error, qr/non-existent field/i, q[...because there's no "pet_id" field in "pet"]); + + my $pet_id = $t2->add_field(name => 'pet_id'); + is($pet_id->name, 'pet_id', 'Added field "pet_id"'); + + is($c->is_valid, 1, 'Constraint now valid'); } # # $table->primary_key test # { - my $s = SQL::Translator::Schema->new; - my $t = $s->add_table( name => 'person' ); + my $s = SQL::Translator::Schema->new; + my $t = $s->add_table(name => 'person'); - is( $t->primary_key, undef, 'No primary key' ); + is($t->primary_key, undef, 'No primary key'); - is( $t->primary_key('person_id'), - undef, q[Can't make PK on "person_id"...] ); - like( $t->error, qr/invalid field/i, "...because it doesn't exist" ); + is($t->primary_key('person_id'), undef, q[Can't make PK on "person_id"...]); + like($t->error, qr/invalid field/i, "...because it doesn't exist"); - $t->add_field( name => 'person_id' ); - my $c = $t->primary_key('person_id'); + $t->add_field(name => 'person_id'); + my $c = $t->primary_key('person_id'); - isa_ok( $c, 'SQL::Translator::Schema::Constraint', 'Constraint' ); + isa_ok($c, 'SQL::Translator::Schema::Constraint', 'Constraint'); - is( join( '', $c->fields ), 'person_id', 'Constraint now on "person_id"' ); + is(join('', $c->fields), 'person_id', 'Constraint now on "person_id"'); - $t->add_field( name => 'name' ); - $c = $t->primary_key('name'); - is( join( ',', $c->fields ), - 'person_id,name', 'Constraint now on "person_id" and "name"' ); + $t->add_field(name => 'name'); + $c = $t->primary_key('name'); + is(join(',', $c->fields), 'person_id,name', 'Constraint now on "person_id" and "name"'); - is( scalar @{ $t->get_constraints }, 1, 'Found 1 constraint' ); + is(scalar @{ $t->get_constraints }, 1, 'Found 1 constraint'); } # # FK finds PK # { - my $s = SQL::Translator::Schema->new; - my $t1 = $s->add_table( name => 'person' ); - my $t2 = $s->add_table( name => 'pet' ); - $t1->add_field( name => 'id' ); - my $c1 = $t1->primary_key('id') or warn $t1->error; - is( $c1->type, PRIMARY_KEY, 'Made "person_id" PK on "person"' ); - - $t2->add_field( name => 'person_id' ); - my $c2 = $t2->add_constraint( - type => PRIMARY_KEY, - fields => 'person_id', - reference_table => 'person', - ); - - is( join( '', $c2->reference_fields ), 'id', 'FK found PK "person.id"' ); + my $s = SQL::Translator::Schema->new; + my $t1 = $s->add_table(name => 'person'); + my $t2 = $s->add_table(name => 'pet'); + $t1->add_field(name => 'id'); + my $c1 = $t1->primary_key('id') or warn $t1->error; + is($c1->type, PRIMARY_KEY, 'Made "person_id" PK on "person"'); + + $t2->add_field(name => 'person_id'); + my $c2 = $t2->add_constraint( + type => PRIMARY_KEY, + fields => 'person_id', + reference_table => 'person', + ); + + is(join('', $c2->reference_fields), 'id', 'FK found PK "person.id"'); } # # View # { - my $s = SQL::Translator::Schema->new( name => 'ViewTest' ); - my $name = 'foo_view'; - my $sql = 'select name, age from person'; - my $fields = 'name, age'; - my $v = $s->add_view( - name => $name, - sql => $sql, - fields => $fields, - schema => $s, - ); - - isa_ok( $v, 'SQL::Translator::Schema::View', 'View' ); - isa_ok( $v->schema, 'SQL::Translator::Schema', 'Schema' ); - is( $v->schema->name, 'ViewTest', qq[Schema name is "'ViewTest'"] ); - is( $v->name, $name, qq[Name is "$name"] ); - is( $v->sql, $sql, qq[Name is "$sql"] ); - is( join( ':', $v->fields ), 'name:age', qq[Fields are "$fields"] ); - - my @views = $s->get_views; - is( scalar @views, 1, 'Number of views is 1' ); - - my $v1 = $s->get_view($name); - isa_ok( $v1, 'SQL::Translator::Schema::View', 'View' ); - is( $v1->name, $name, qq[Name is "$name"] ); + my $s = SQL::Translator::Schema->new(name => 'ViewTest'); + my $name = 'foo_view'; + my $sql = 'select name, age from person'; + my $fields = 'name, age'; + my $v = $s->add_view( + name => $name, + sql => $sql, + fields => $fields, + schema => $s, + ); + + isa_ok($v, 'SQL::Translator::Schema::View', 'View'); + isa_ok($v->schema, 'SQL::Translator::Schema', 'Schema'); + is($v->schema->name, 'ViewTest', qq[Schema name is "'ViewTest'"]); + is($v->name, $name, qq[Name is "$name"]); + is($v->sql, $sql, qq[Name is "$sql"]); + is(join(':', $v->fields), 'name:age', qq[Fields are "$fields"]); + + my @views = $s->get_views; + is(scalar @views, 1, 'Number of views is 1'); + + my $v1 = $s->get_view($name); + isa_ok($v1, 'SQL::Translator::Schema::View', 'View'); + is($v1->name, $name, qq[Name is "$name"]); } # # Trigger # { - my $s = SQL::Translator::Schema->new( name => 'TrigTest' ); - $s->add_table( name => 'foo' ) or die "Couldn't create table: ", $s->error; - my $name = 'foo_trigger'; - my $perform_action_when = 'after'; - my $database_events = 'insert'; - my $on_table = 'foo'; - my $action = 'update modified=timestamp();'; - my $t = $s->add_trigger( - name => $name, - perform_action_when => $perform_action_when, - database_events => $database_events, - on_table => $on_table, - action => $action, - ) or die $s->error; - - isa_ok( $t, 'SQL::Translator::Schema::Trigger', 'Trigger' ); - isa_ok( $t->schema, 'SQL::Translator::Schema', 'Schema' ); - is( $t->schema->name, 'TrigTest', qq[Schema name is "'TrigTest'"] ); - is( $t->name, $name, qq[Name is "$name"] ); - is( $t->perform_action_when, $perform_action_when, - qq[Perform action when is "$perform_action_when"] ); - is( join( ',', $t->database_events ), - $database_events, qq[Database event is "$database_events"] ); - isa_ok( $t->table, 'SQL::Translator::Schema::Table', - qq[table is a Table"] ); - is( $t->action, $action, qq[Action is "$action"] ); - - my @triggs = $s->get_triggers; - is( scalar @triggs, 1, 'Number of triggers is 1' ); - - my $t1 = $s->get_trigger($name); - isa_ok( $t1, 'SQL::Translator::Schema::Trigger', 'Trigger' ); - is( $t1->name, $name, qq[Name is "$name"] ); - - my $s2 = SQL::Translator::Schema->new( name => 'TrigTest2' ); - $s2->add_table( name => 'foo' ) + my $s = SQL::Translator::Schema->new(name => 'TrigTest'); + $s->add_table(name => 'foo') or die "Couldn't create table: ", $s->error; + my $name = 'foo_trigger'; + my $perform_action_when = 'after'; + my $database_events = 'insert'; + my $on_table = 'foo'; + my $action = 'update modified=timestamp();'; + my $t = $s->add_trigger( + name => $name, + perform_action_when => $perform_action_when, + database_events => $database_events, + on_table => $on_table, + action => $action, + ) or die $s->error; + + isa_ok($t, 'SQL::Translator::Schema::Trigger', 'Trigger'); + isa_ok($t->schema, 'SQL::Translator::Schema', 'Schema'); + is($t->schema->name, 'TrigTest', qq[Schema name is "'TrigTest'"]); + is($t->name, $name, qq[Name is "$name"]); + is($t->perform_action_when, $perform_action_when, qq[Perform action when is "$perform_action_when"]); + is(join(',', $t->database_events), $database_events, qq[Database event is "$database_events"]); + isa_ok($t->table, 'SQL::Translator::Schema::Table', qq[table is a Table"]); + is($t->action, $action, qq[Action is "$action"]); + + my @triggs = $s->get_triggers; + is(scalar @triggs, 1, 'Number of triggers is 1'); + + my $t1 = $s->get_trigger($name); + isa_ok($t1, 'SQL::Translator::Schema::Trigger', 'Trigger'); + is($t1->name, $name, qq[Name is "$name"]); + + my $s2 = SQL::Translator::Schema->new(name => 'TrigTest2'); + $s2->add_table(name => 'foo') or die "Couldn't create table: ", $s2->error; - my $t2 = $s2->add_trigger( - name => 'foo_trigger', - perform_action_when => 'after', - database_events => [qw/insert update/], - on_table => 'foo', - action => 'update modified=timestamp();', - ) or die $s2->error; - isa_ok( $t2, 'SQL::Translator::Schema::Trigger', 'Trigger' ); - isa_ok( $t2->schema, 'SQL::Translator::Schema', 'Schema' ); - is( $t2->schema->name, 'TrigTest2', qq[Schema name is "'TrigTest2'"] ); - is( $t2->name, 'foo_trigger', qq[Name is "foo_trigger"] ); - is_deeply( [ $t2->database_events ], - [qw/insert update/], "Database events are [qw/insert update/] " ); - isa_ok( $t2->database_events, 'ARRAY', 'Database events' ); - - # - # Trigger equal tests - # - isnt( $t1->equals($t2), 1, - 'Compare two Triggers with database_event and database_events' ); - - $t1->database_events($database_events); - $t2->database_events($database_events); - is( $t1->equals($t2), 1, 'Compare two Triggers with database_event' ); - - $t2->database_events(''); - $t1->database_events( [qw/update insert/] ); - $t2->database_events( [qw/insert update/] ); - is( $t1->equals($t2), 1, 'Compare two Triggers with database_events' ); - - # - # $schema-> drop_trigger - # - my $dropped_trig = $s->drop_trigger( $t->name ); - isa_ok( - $dropped_trig, - 'SQL::Translator::Schema::Trigger', - 'Dropped trigger "foo_trigger"' - ); - $s->add_trigger($t); - my $dropped_trig2 = $s->drop_trigger($t); - isa_ok( - $dropped_trig2, - 'SQL::Translator::Schema::Trigger', - 'Dropped trigger "foo_trigger" by object' - ); - is( $dropped_trig2->name, $t->name, - 'Dropped correct trigger "foo_trigger"' ); - my $dropped_trig3 = $s->drop_trigger( $t->name ); - like( - $s->error, - qr/doesn't exist/, - qq[Can't drop non-existant trigger "foo_trigger"] - ); - - $s->add_trigger($t); + my $t2 = $s2->add_trigger( + name => 'foo_trigger', + perform_action_when => 'after', + database_events => [qw/insert update/], + on_table => 'foo', + action => 'update modified=timestamp();', + ) or die $s2->error; + isa_ok($t2, 'SQL::Translator::Schema::Trigger', 'Trigger'); + isa_ok($t2->schema, 'SQL::Translator::Schema', 'Schema'); + is($t2->schema->name, 'TrigTest2', qq[Schema name is "'TrigTest2'"]); + is($t2->name, 'foo_trigger', qq[Name is "foo_trigger"]); + is_deeply([ $t2->database_events ], [qw/insert update/], "Database events are [qw/insert update/] "); + isa_ok($t2->database_events, 'ARRAY', 'Database events'); + + # + # Trigger equal tests + # + isnt($t1->equals($t2), 1, 'Compare two Triggers with database_event and database_events'); + + $t1->database_events($database_events); + $t2->database_events($database_events); + is($t1->equals($t2), 1, 'Compare two Triggers with database_event'); + + $t2->database_events(''); + $t1->database_events([qw/update insert/]); + $t2->database_events([qw/insert update/]); + is($t1->equals($t2), 1, 'Compare two Triggers with database_events'); + + # + # $schema-> drop_trigger + # + my $dropped_trig = $s->drop_trigger($t->name); + isa_ok($dropped_trig, 'SQL::Translator::Schema::Trigger', 'Dropped trigger "foo_trigger"'); + $s->add_trigger($t); + my $dropped_trig2 = $s->drop_trigger($t); + isa_ok($dropped_trig2, 'SQL::Translator::Schema::Trigger', 'Dropped trigger "foo_trigger" by object'); + is($dropped_trig2->name, $t->name, 'Dropped correct trigger "foo_trigger"'); + my $dropped_trig3 = $s->drop_trigger($t->name); + like($s->error, qr/doesn't exist/, qq[Can't drop non-existant trigger "foo_trigger"]); + + $s->add_trigger($t); } # # Procedure # { - my $s = SQL::Translator::Schema->new( name => 'ProcTest' ); - my $name = 'foo_proc'; - my $sql = 'select foo from bar'; - my $parameters = 'foo, bar'; - my $owner = 'Nomar'; - my $comments = 'Go Sox!'; - my $p = $s->add_procedure( - name => $name, - sql => $sql, - parameters => $parameters, - owner => $owner, - comments => $comments, - ) or die $s->error; - - isa_ok( $p, 'SQL::Translator::Schema::Procedure', 'Procedure' ); - isa_ok( $p->schema, 'SQL::Translator::Schema', 'Schema' ); - is( $p->schema->name, 'ProcTest', qq[Schema name is "'ProcTest'"] ); - is( $p->name, $name, qq[Name is "$name"] ); - is( $p->sql, $sql, qq[SQL is "$sql"] ); - is( join( ',', $p->parameters ), 'foo,bar', qq[Params = 'foo,bar'] ); - is( $p->comments, $comments, qq[Comments = "$comments"] ); - - my @procs = $s->get_procedures; - is( scalar @procs, 1, 'Number of procedures is 1' ); - - my $p1 = $s->get_procedure($name); - isa_ok( $p1, 'SQL::Translator::Schema::Procedure', 'Procedure' ); - is( $p1->name, $name, qq[Name is "$name"] ); - - # - # $schema-> drop_procedure - # - my $dropped_proc = $s->drop_procedure( $p->name ); - isa_ok( - $dropped_proc, - 'SQL::Translator::Schema::Procedure', - 'Dropped procedure "foo_proc"' - ); - $s->add_procedure($p); - my $dropped_proc2 = $s->drop_procedure($p); - isa_ok( - $dropped_proc2, - 'SQL::Translator::Schema::Procedure', - 'Dropped procedure "foo_proc" by object' - ); - is( $dropped_proc2->name, $p->name, - 'Dropped correct procedure "foo_proc"' ); - my $dropped_proc3 = $s->drop_procedure( $p->name ); - like( - $s->error, - qr/doesn't exist/, - qq[Can't drop non-existant procedure "foo_proc"] - ); - - $s->add_procedure($p); + my $s = SQL::Translator::Schema->new(name => 'ProcTest'); + my $name = 'foo_proc'; + my $sql = 'select foo from bar'; + my $parameters = 'foo, bar'; + my $owner = 'Nomar'; + my $comments = 'Go Sox!'; + my $p = $s->add_procedure( + name => $name, + sql => $sql, + parameters => $parameters, + owner => $owner, + comments => $comments, + ) or die $s->error; + + isa_ok($p, 'SQL::Translator::Schema::Procedure', 'Procedure'); + isa_ok($p->schema, 'SQL::Translator::Schema', 'Schema'); + is($p->schema->name, 'ProcTest', qq[Schema name is "'ProcTest'"]); + is($p->name, $name, qq[Name is "$name"]); + is($p->sql, $sql, qq[SQL is "$sql"]); + is(join(',', $p->parameters), 'foo,bar', qq[Params = 'foo,bar']); + is($p->comments, $comments, qq[Comments = "$comments"]); + + my @procs = $s->get_procedures; + is(scalar @procs, 1, 'Number of procedures is 1'); + + my $p1 = $s->get_procedure($name); + isa_ok($p1, 'SQL::Translator::Schema::Procedure', 'Procedure'); + is($p1->name, $name, qq[Name is "$name"]); + + # + # $schema-> drop_procedure + # + my $dropped_proc = $s->drop_procedure($p->name); + isa_ok($dropped_proc, 'SQL::Translator::Schema::Procedure', 'Dropped procedure "foo_proc"'); + $s->add_procedure($p); + my $dropped_proc2 = $s->drop_procedure($p); + isa_ok($dropped_proc2, 'SQL::Translator::Schema::Procedure', 'Dropped procedure "foo_proc" by object'); + is($dropped_proc2->name, $p->name, 'Dropped correct procedure "foo_proc"'); + my $dropped_proc3 = $s->drop_procedure($p->name); + like($s->error, qr/doesn't exist/, qq[Can't drop non-existant procedure "foo_proc"]); + + $s->add_procedure($p); } # # Test field order # { - my $s = SQL::Translator::Schema->new; - my $t = $s->add_table( name => 'person' ); - my $f3 = $t->add_field( name => 'age', order => 3 ); - my $f1 = $t->add_field( name => 'person_id', order => 1 ); - my $f2 = $t->add_field( name => 'name', order => 2 ); - my $f4 = $t->add_field( name => 'gender' ); - my $f5 = $t->add_field( name => 'alias' ); - - is( $f1->order, 1, 'Field order is passed, order is 1' ); - is( $f2->order, 2, 'Field order is passed, order is 2' ); - is( $f3->order, 3, 'Field order is passed, order is 3' ); - is( $f4->order, 4, 'Field order is not passed, order is 4' ); - is( $f5->order, 5, 'Field order is not passed, order is 5' ); - - my $t2 = $s->add_table( name => 'place' ); - $f2 = $t2->add_field( name => 'name', order => 2 ); - - throws_ok { my $f22 = $t2->add_field( name => 'name2', order => 2 ) } -qr/\QRequested order '2' for column 'name2' conflicts with already existing column 'name'/; - - throws_ok { $f1 = $t2->add_field( name => 'location' ) } - qr/field order incomplete/; + my $s = SQL::Translator::Schema->new; + my $t = $s->add_table(name => 'person'); + my $f3 = $t->add_field(name => 'age', order => 3); + my $f1 = $t->add_field(name => 'person_id', order => 1); + my $f2 = $t->add_field(name => 'name', order => 2); + my $f4 = $t->add_field(name => 'gender'); + my $f5 = $t->add_field(name => 'alias'); + + is($f1->order, 1, 'Field order is passed, order is 1'); + is($f2->order, 2, 'Field order is passed, order is 2'); + is($f3->order, 3, 'Field order is passed, order is 3'); + is($f4->order, 4, 'Field order is not passed, order is 4'); + is($f5->order, 5, 'Field order is not passed, order is 5'); + + my $t2 = $s->add_table(name => 'place'); + $f2 = $t2->add_field(name => 'name', order => 2); + + throws_ok { my $f22 = $t2->add_field(name => 'name2', order => 2) } + qr/\QRequested order '2' for column 'name2' conflicts with already existing column 'name'/; + + throws_ok { $f1 = $t2->add_field(name => 'location') } + qr/field order incomplete/; } # @@ -922,75 +754,74 @@ qr/\QRequested order '2' for column 'name2' conflicts with already existing colu # { - my $s = SQL::Translator::Schema->new; - my $t1 = $s->add_table( name => 'person' ); - $t1->add_field( name => 'id' ); - $t1->primary_key('id'); - $t1->add_field( name => 'name' ); - - ok( $t1->is_data, 'Person table has data' ); - ok( !$t1->is_trivial_link, 'Person table is not trivial' ); - - my $t2 = $s->add_table( name => 'pet' ); - $t2->add_field( name => 'id' ); - $t2->primary_key('id'); - $t2->add_field( name => 'name' ); - - ok( $t2->is_data, 'Pet table has data' ); - ok( !$t1->is_trivial_link, 'Pet table is trivial' ); - - my $t3 = $s->add_table( name => 'person_pet' ); - $t3->add_field( name => 'id' ); - my $f1 = $t3->add_field( name => 'person_id' ); - my $f2 = $t3->add_field( name => 'pet_id' ); - $t3->primary_key('id'); - - $t3->add_constraint( - type => FOREIGN_KEY, - fields => 'person_id', - reference_table => $t1, - ); - - $t3->add_constraint( - type => FOREIGN_KEY, - fields => 'pet_id', - reference_table => $t2, - ); - - ok( $f1->is_foreign_key, "person_id is foreign key" ); - ok( $f2->is_foreign_key, "pet_id is foreign key" ); - - ok( !$t3->is_data, 'Link table has no data' ); - ok( $t3->is_trivial_link, 'Link table is trivial' ); - is( $t3->can_link( $t1, $t2 )->[0], 'one2one', 'Link table can link' ); - - my $t4 = $s->add_table( name => 'fans' ); - my $f3 = $t4->add_field( name => 'fan_id' ); - my $f4 = $t4->add_field( name => 'idol_id' ); - $t4->primary_key( 'fan_id', 'idol_id' ); - - $t4->add_constraint( - type => FOREIGN_KEY, - name => 'fan_fan_fk', - fields => 'fan_id', - reference_table => $t1, - ); - - $t4->add_constraint( - type => FOREIGN_KEY, - name => 'fan_idol_fk', - fields => 'idol_id', - reference_table => $t1, - ); - - ok( $f3->is_foreign_key, "fan_id is foreign key" ); - ok( $f4->is_foreign_key, "idol_id is foreign key" ); - - ok( !$t4->is_data, 'Self-link table has no data' ); - ok( !$t4->is_trivial_link, 'Self-link table is not trivial' ); - is( $t4->can_link( $t1, $t1 )->[0], - 'many2many', 'Self-link table can link' ); - ok( !$t4->can_link( $t1, $t2 )->[0], 'Self-link table can\'t link other' ); + my $s = SQL::Translator::Schema->new; + my $t1 = $s->add_table(name => 'person'); + $t1->add_field(name => 'id'); + $t1->primary_key('id'); + $t1->add_field(name => 'name'); + + ok($t1->is_data, 'Person table has data'); + ok(!$t1->is_trivial_link, 'Person table is not trivial'); + + my $t2 = $s->add_table(name => 'pet'); + $t2->add_field(name => 'id'); + $t2->primary_key('id'); + $t2->add_field(name => 'name'); + + ok($t2->is_data, 'Pet table has data'); + ok(!$t1->is_trivial_link, 'Pet table is trivial'); + + my $t3 = $s->add_table(name => 'person_pet'); + $t3->add_field(name => 'id'); + my $f1 = $t3->add_field(name => 'person_id'); + my $f2 = $t3->add_field(name => 'pet_id'); + $t3->primary_key('id'); + + $t3->add_constraint( + type => FOREIGN_KEY, + fields => 'person_id', + reference_table => $t1, + ); + + $t3->add_constraint( + type => FOREIGN_KEY, + fields => 'pet_id', + reference_table => $t2, + ); + + ok($f1->is_foreign_key, "person_id is foreign key"); + ok($f2->is_foreign_key, "pet_id is foreign key"); + + ok(!$t3->is_data, 'Link table has no data'); + ok($t3->is_trivial_link, 'Link table is trivial'); + is($t3->can_link($t1, $t2)->[0], 'one2one', 'Link table can link'); + + my $t4 = $s->add_table(name => 'fans'); + my $f3 = $t4->add_field(name => 'fan_id'); + my $f4 = $t4->add_field(name => 'idol_id'); + $t4->primary_key('fan_id', 'idol_id'); + + $t4->add_constraint( + type => FOREIGN_KEY, + name => 'fan_fan_fk', + fields => 'fan_id', + reference_table => $t1, + ); + + $t4->add_constraint( + type => FOREIGN_KEY, + name => 'fan_idol_fk', + fields => 'idol_id', + reference_table => $t1, + ); + + ok($f3->is_foreign_key, "fan_id is foreign key"); + ok($f4->is_foreign_key, "idol_id is foreign key"); + + ok(!$t4->is_data, 'Self-link table has no data'); + ok(!$t4->is_trivial_link, 'Self-link table is not trivial'); + is($t4->can_link($t1, $t1)->[0], 'many2many', 'Self-link table can link'); + ok(!$t4->can_link($t1, $t2)->[0], 'Self-link table can\'t link other'); } done_testing; diff --git a/t/14postgres-parser.t b/t/14postgres-parser.t index b4bae2089..b27b4d26f 100644 --- a/t/14postgres-parser.t +++ b/t/14postgres-parser.t @@ -8,11 +8,11 @@ use SQL::Translator::Schema::Constants; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan( undef, 'SQL::Translator::Parser::PostgreSQL' ); - SQL::Translator::Parser::PostgreSQL->import('parse'); + maybe_plan(undef, 'SQL::Translator::Parser::PostgreSQL'); + SQL::Translator::Parser::PostgreSQL->import('parse'); } -my $t = SQL::Translator->new( trace => 0 ); +my $t = SQL::Translator->new(trace => 0); my $sql = q{ -- comment on t_test1 create table t_test1 ( @@ -126,369 +126,327 @@ baz $foo$, $| = 1; -my $data = parse( $t, $sql ); +my $data = parse($t, $sql); my $schema = $t->schema; -isa_ok( $schema, 'SQL::Translator::Schema', 'Schema object' ); +isa_ok($schema, 'SQL::Translator::Schema', 'Schema object'); my @tables = $schema->get_tables; -is( scalar @tables, 5, 'Five tables' ); +is(scalar @tables, 5, 'Five tables'); my $t1 = shift @tables; -is( $t1->name, 't_test1', 'Table t_test1 exists' ); +is($t1->name, 't_test1', 'Table t_test1 exists'); -is( $t1->comments, 'comment on t_test1', 'Table comment exists' ); +is($t1->comments, 'comment on t_test1', 'Table comment exists'); my @t1_fields = $t1->get_fields; -is( scalar @t1_fields, 21, '21 fields in t_test1' ); +is(scalar @t1_fields, 21, '21 fields in t_test1'); my $f1 = shift @t1_fields; -is( $f1->name, 'f_serial', 'First field is "f_serial"' ); -is( $f1->data_type, 'integer', 'Field is an integer' ); -is( $f1->is_nullable, 0, 'Field cannot be null' ); -is( $f1->size, 11, 'Size is "11"' ); -is( $f1->default_value, '0', 'Default value is "0"' ); -is( $f1->is_primary_key, 1, 'Field is PK' ); -is( $f1->comments, 'this is the primary key', 'Comment' ); -is( $f1->is_auto_increment, 1, 'Field is auto increment' ); +is($f1->name, 'f_serial', 'First field is "f_serial"'); +is($f1->data_type, 'integer', 'Field is an integer'); +is($f1->is_nullable, 0, 'Field cannot be null'); +is($f1->size, 11, 'Size is "11"'); +is($f1->default_value, '0', 'Default value is "0"'); +is($f1->is_primary_key, 1, 'Field is PK'); +is($f1->comments, 'this is the primary key', 'Comment'); +is($f1->is_auto_increment, 1, 'Field is auto increment'); my $f2 = shift @t1_fields; -is( $f2->name, 'f_varchar', 'Second field is "f_varchar"' ); -is( $f2->data_type, 'varchar', 'Field is a varchar' ); -is( $f2->is_nullable, 1, 'Field can be null' ); -is( $f2->size, 255, 'Size is "255"' ); -is( $f2->default_value, undef, 'Default value is undefined' ); -is( $f2->is_primary_key, 0, 'Field is not PK' ); -is( $f2->is_auto_increment, 0, 'Field is not auto increment' ); +is($f2->name, 'f_varchar', 'Second field is "f_varchar"'); +is($f2->data_type, 'varchar', 'Field is a varchar'); +is($f2->is_nullable, 1, 'Field can be null'); +is($f2->size, 255, 'Size is "255"'); +is($f2->default_value, undef, 'Default value is undefined'); +is($f2->is_primary_key, 0, 'Field is not PK'); +is($f2->is_auto_increment, 0, 'Field is not auto increment'); my $f3 = shift @t1_fields; -is( $f3->name, 'f_double', 'Third field is "f_double"' ); -is( $f3->data_type, 'float', 'Field is a float' ); -is( $f3->is_nullable, 1, 'Field can be null' ); -is( $f3->size, 20, 'Size is "20"' ); -is( $f3->default_value, undef, 'Default value is undefined' ); -is( $f3->is_primary_key, 0, 'Field is not PK' ); +is($f3->name, 'f_double', 'Third field is "f_double"'); +is($f3->data_type, 'float', 'Field is a float'); +is($f3->is_nullable, 1, 'Field can be null'); +is($f3->size, 20, 'Size is "20"'); +is($f3->default_value, undef, 'Default value is undefined'); +is($f3->is_primary_key, 0, 'Field is not PK'); my $f4 = shift @t1_fields; -is( $f4->name, 'f_bigint', 'Fourth field is "f_bigint"' ); -is( $f4->data_type, 'integer', 'Field is an integer' ); -is( $f4->is_nullable, 0, 'Field cannot be null' ); -is( $f4->size, 20, 'Size is "20"' ); -is( $f4->default_value, undef, 'Default value is undefined' ); -is( $f4->is_primary_key, 0, 'Field is not PK' ); +is($f4->name, 'f_bigint', 'Fourth field is "f_bigint"'); +is($f4->data_type, 'integer', 'Field is an integer'); +is($f4->is_nullable, 0, 'Field cannot be null'); +is($f4->size, 20, 'Size is "20"'); +is($f4->default_value, undef, 'Default value is undefined'); +is($f4->is_primary_key, 0, 'Field is not PK'); my $f5 = shift @t1_fields; -is( $f5->name, 'f_char', 'Fifth field is "f_char"' ); -is( $f5->data_type, 'char', 'Field is char' ); -is( $f5->is_nullable, 1, 'Field can be null' ); -is( $f5->size, 10, 'Size is "10"' ); -is( $f5->default_value, undef, 'Default value is undefined' ); -is( $f5->is_primary_key, 0, 'Field is not PK' ); +is($f5->name, 'f_char', 'Fifth field is "f_char"'); +is($f5->data_type, 'char', 'Field is char'); +is($f5->is_nullable, 1, 'Field can be null'); +is($f5->size, 10, 'Size is "10"'); +is($f5->default_value, undef, 'Default value is undefined'); +is($f5->is_primary_key, 0, 'Field is not PK'); my $f6 = shift @t1_fields; -is( $f6->name, 'f_bool', 'Sixth field is "f_bool"' ); -is( $f6->data_type, 'boolean', 'Field is a boolean' ); -is( $f6->is_nullable, 1, 'Field can be null' ); -is( $f6->size, 0, 'Size is "0"' ); -is( $f6->default_value, undef, 'Default value is undefined' ); -is( $f6->is_primary_key, 0, 'Field is not PK' ); +is($f6->name, 'f_bool', 'Sixth field is "f_bool"'); +is($f6->data_type, 'boolean', 'Field is a boolean'); +is($f6->is_nullable, 1, 'Field can be null'); +is($f6->size, 0, 'Size is "0"'); +is($f6->default_value, undef, 'Default value is undefined'); +is($f6->is_primary_key, 0, 'Field is not PK'); my $f7 = shift @t1_fields; -is( $f7->name, 'f_bin', 'Seventh field is "f_bin"' ); -is( $f7->data_type, 'bytea', 'Field is bytea' ); -is( $f7->is_nullable, 1, 'Field can be null' ); -is( $f7->size, 0, 'Size is "0"' ); -is( $f7->default_value, undef, 'Default value is undefined' ); -is( $f7->is_primary_key, 0, 'Field is not PK' ); +is($f7->name, 'f_bin', 'Seventh field is "f_bin"'); +is($f7->data_type, 'bytea', 'Field is bytea'); +is($f7->is_nullable, 1, 'Field can be null'); +is($f7->size, 0, 'Size is "0"'); +is($f7->default_value, undef, 'Default value is undefined'); +is($f7->is_primary_key, 0, 'Field is not PK'); my $f8 = shift @t1_fields; -is( $f8->name, 'f_tz', 'Eighth field is "f_tz"' ); -is( $f8->data_type, 'timestamp', 'Field is a timestamp' ); -is( $f8->is_nullable, 1, 'Field can be null' ); -is( $f8->size, 0, 'Size is "0"' ); -is( - $f8->default_value, - '1970-01-01 00:00:00', - 'Default value is 1970-01-01 00:00:00' -); -is( $f8->is_primary_key, 0, 'Field is not PK' ); +is($f8->name, 'f_tz', 'Eighth field is "f_tz"'); +is($f8->data_type, 'timestamp', 'Field is a timestamp'); +is($f8->is_nullable, 1, 'Field can be null'); +is($f8->size, 0, 'Size is "0"'); +is($f8->default_value, '1970-01-01 00:00:00', 'Default value is 1970-01-01 00:00:00'); +is($f8->is_primary_key, 0, 'Field is not PK'); my $f9 = shift @t1_fields; -is( $f9->name, 'f_text', 'Ninth field is "f_text"' ); -is( $f9->data_type, 'text', 'Field is text' ); -is( $f9->is_nullable, 1, 'Field can be null' ); -is( $f9->size, 64000, 'Size is "64,000"' ); -is( - $f9->default_value, - " foo\n\$bar\$\nbaz ", - 'Dollar-quoted default value is " foo\n$bar$\nbaz "' -); -is( $f9->is_primary_key, 0, 'Field is not PK' ); +is($f9->name, 'f_text', 'Ninth field is "f_text"'); +is($f9->data_type, 'text', 'Field is text'); +is($f9->is_nullable, 1, 'Field can be null'); +is($f9->size, 64000, 'Size is "64,000"'); +is($f9->default_value, " foo\n\$bar\$\nbaz ", 'Dollar-quoted default value is " foo\n$bar$\nbaz "'); +is($f9->is_primary_key, 0, 'Field is not PK'); my $f10 = shift @t1_fields; -is( $f10->name, 'f_fk1', 'Tenth field is "f_fk1"' ); -is( $f10->data_type, 'integer', 'Field is an integer' ); -is( $f10->is_nullable, 0, 'Field cannot be null' ); -is( $f10->size, 10, 'Size is "10"' ); -is( $f10->default_value, undef, 'Default value is undefined' ); -is( $f10->is_primary_key, 0, 'Field is not PK' ); -is( $f10->is_foreign_key, 1, 'Field is a FK' ); +is($f10->name, 'f_fk1', 'Tenth field is "f_fk1"'); +is($f10->data_type, 'integer', 'Field is an integer'); +is($f10->is_nullable, 0, 'Field cannot be null'); +is($f10->size, 10, 'Size is "10"'); +is($f10->default_value, undef, 'Default value is undefined'); +is($f10->is_primary_key, 0, 'Field is not PK'); +is($f10->is_foreign_key, 1, 'Field is a FK'); my $fk_ref1 = $f10->foreign_key_reference; -isa_ok( $fk_ref1, 'SQL::Translator::Schema::Constraint', 'FK' ); -is( $fk_ref1->reference_table, 't_test2', 'FK is to "t_test2" table' ); +isa_ok($fk_ref1, 'SQL::Translator::Schema::Constraint', 'FK'); +is($fk_ref1->reference_table, 't_test2', 'FK is to "t_test2" table'); my $f11 = shift @t1_fields; -is( $f11->name, 'f_timestamp', 'Eleventh field is "f_timestamp"' ); -is( - $f11->data_type, - 'timestamp with time zone', - 'Field is a timestamp with time zone' -); -is( $f11->is_nullable, 1, 'Field can be null' ); -is( $f11->size, 0, 'Size is "0"' ); -is( $f11->default_value, undef, 'Default value is "undef"' ); -is( $f11->is_primary_key, 0, 'Field is not PK' ); -is( $f11->is_foreign_key, 0, 'Field is not FK' ); +is($f11->name, 'f_timestamp', 'Eleventh field is "f_timestamp"'); +is($f11->data_type, 'timestamp with time zone', 'Field is a timestamp with time zone'); +is($f11->is_nullable, 1, 'Field can be null'); +is($f11->size, 0, 'Size is "0"'); +is($f11->default_value, undef, 'Default value is "undef"'); +is($f11->is_primary_key, 0, 'Field is not PK'); +is($f11->is_foreign_key, 0, 'Field is not FK'); my $f12 = shift @t1_fields; -is( $f12->name, 'f_timestamp2', '12th field is "f_timestamp2"' ); -is( - $f12->data_type, - 'timestamp without time zone', - 'Field is a timestamp without time zone' -); -is( $f12->is_nullable, 1, 'Field can be null' ); -is( $f12->size, 0, 'Size is "0"' ); -is( $f12->default_value, undef, 'Default value is "undef"' ); -is( $f12->is_primary_key, 0, 'Field is not PK' ); -is( $f12->is_foreign_key, 0, 'Field is not FK' ); +is($f12->name, 'f_timestamp2', '12th field is "f_timestamp2"'); +is($f12->data_type, 'timestamp without time zone', 'Field is a timestamp without time zone'); +is($f12->is_nullable, 1, 'Field can be null'); +is($f12->size, 0, 'Size is "0"'); +is($f12->default_value, undef, 'Default value is "undef"'); +is($f12->is_primary_key, 0, 'Field is not PK'); +is($f12->is_foreign_key, 0, 'Field is not FK'); my $f13 = shift @t1_fields; -is( $f13->name, 'f_json', '13th field is "f_json"' ); -is( $f13->data_type, 'json', 'Field is Json' ); -is( $f13->is_nullable, 1, 'Field can be null' ); -is( $f13->size, 0, 'Size is "0"' ); -is( $f13->default_value, undef, 'Default value is "undef"' ); -is( $f13->is_primary_key, 0, 'Field is not PK' ); -is( $f13->is_foreign_key, 0, 'Field is not FK' ); +is($f13->name, 'f_json', '13th field is "f_json"'); +is($f13->data_type, 'json', 'Field is Json'); +is($f13->is_nullable, 1, 'Field can be null'); +is($f13->size, 0, 'Size is "0"'); +is($f13->default_value, undef, 'Default value is "undef"'); +is($f13->is_primary_key, 0, 'Field is not PK'); +is($f13->is_foreign_key, 0, 'Field is not FK'); my $f14 = shift @t1_fields; -is( $f14->name, 'f_hstore', '14th field is "f_hstore"' ); -is( $f14->data_type, 'hstore', 'Field is hstore' ); -is( $f14->is_nullable, 1, 'Field can be null' ); -is( $f14->size, 0, 'Size is "0"' ); -is( $f14->default_value, undef, 'Default value is "undef"' ); -is( $f14->is_primary_key, 0, 'Field is not PK' ); -is( $f14->is_foreign_key, 0, 'Field is not FK' ); +is($f14->name, 'f_hstore', '14th field is "f_hstore"'); +is($f14->data_type, 'hstore', 'Field is hstore'); +is($f14->is_nullable, 1, 'Field can be null'); +is($f14->size, 0, 'Size is "0"'); +is($f14->default_value, undef, 'Default value is "undef"'); +is($f14->is_primary_key, 0, 'Field is not PK'); +is($f14->is_foreign_key, 0, 'Field is not FK'); my $f15 = shift @t1_fields; -is( $f15->name, 'f_numarray', '15th field is "f_numarray"' ); -is( $f15->data_type, 'numeric[]', 'Field is numeric[]' ); -is( $f15->is_nullable, 1, 'Field can be null' ); -is_deeply( [ $f15->size ], [ 7, 2 ], 'Size is "7,2"' ); -is( $f15->default_value, undef, 'Default value is "undef"' ); -is( $f15->is_primary_key, 0, 'Field is not PK' ); -is( $f15->is_foreign_key, 0, 'Field is not FK' ); +is($f15->name, 'f_numarray', '15th field is "f_numarray"'); +is($f15->data_type, 'numeric[]', 'Field is numeric[]'); +is($f15->is_nullable, 1, 'Field can be null'); +is_deeply([ $f15->size ], [ 7, 2 ], 'Size is "7,2"'); +is($f15->default_value, undef, 'Default value is "undef"'); +is($f15->is_primary_key, 0, 'Field is not PK'); +is($f15->is_foreign_key, 0, 'Field is not FK'); my $f16 = shift @t1_fields; -is( $f16->name, 'f_uuid', '16th field is "f_uuid"' ); -is( $f16->data_type, 'uuid', 'Field is a UUID' ); -is( $f16->is_nullable, 1, 'Field can be null' ); -is( $f16->size, 0, 'Size is "0"' ); -is( $f16->default_value, undef, 'Default value is "undef"' ); -is( $f16->is_primary_key, 0, 'Field is not PK' ); -is( $f16->is_foreign_key, 0, 'Field is not FK' ); +is($f16->name, 'f_uuid', '16th field is "f_uuid"'); +is($f16->data_type, 'uuid', 'Field is a UUID'); +is($f16->is_nullable, 1, 'Field can be null'); +is($f16->size, 0, 'Size is "0"'); +is($f16->default_value, undef, 'Default value is "undef"'); +is($f16->is_primary_key, 0, 'Field is not PK'); +is($f16->is_foreign_key, 0, 'Field is not FK'); my $f17 = shift @t1_fields; -is( $f17->name, 'f_time', '17th field is "f_time"' ); -is( $f17->data_type, 'time with time zone', 'Field is a time with time zone' ); -is( $f17->is_nullable, 1, 'Field can be null' ); -is( $f17->size, 0, 'Size is "0"' ); -is( $f17->default_value, undef, 'Default value is "undef"' ); -is( $f17->is_primary_key, 0, 'Field is not PK' ); -is( $f17->is_foreign_key, 0, 'Field is not FK' ); +is($f17->name, 'f_time', '17th field is "f_time"'); +is($f17->data_type, 'time with time zone', 'Field is a time with time zone'); +is($f17->is_nullable, 1, 'Field can be null'); +is($f17->size, 0, 'Size is "0"'); +is($f17->default_value, undef, 'Default value is "undef"'); +is($f17->is_primary_key, 0, 'Field is not PK'); +is($f17->is_foreign_key, 0, 'Field is not FK'); my $f18 = shift @t1_fields; -is( $f18->name, 'f_time2', '18th field is "f_time2"' ); -is( - $f18->data_type, - 'time without time zone', - 'Field is a time without time zone' -); -is( $f18->is_nullable, 1, 'Field can be null' ); -is( $f18->size, 0, 'Size is "0"' ); -is( $f18->default_value, undef, 'Default value is "undef"' ); -is( $f18->is_primary_key, 0, 'Field is not PK' ); -is( $f18->is_foreign_key, 0, 'Field is not FK' ); +is($f18->name, 'f_time2', '18th field is "f_time2"'); +is($f18->data_type, 'time without time zone', 'Field is a time without time zone'); +is($f18->is_nullable, 1, 'Field can be null'); +is($f18->size, 0, 'Size is "0"'); +is($f18->default_value, undef, 'Default value is "undef"'); +is($f18->is_primary_key, 0, 'Field is not PK'); +is($f18->is_foreign_key, 0, 'Field is not FK'); my $f19 = shift @t1_fields; -is( $f19->name, 'f_text2', '19th field is "f_text2"' ); -is( $f19->data_type, 'text', 'Field is text' ); -is( $f19->is_nullable, 1, 'Field can be null' ); -is( $f19->size, 64000, 'Size is "64,000"' ); -is( $f19->default_value, '', 'Dollar-quoted default value is empty' ); -is( $f19->is_primary_key, 0, 'Field is not PK' ); +is($f19->name, 'f_text2', '19th field is "f_text2"'); +is($f19->data_type, 'text', 'Field is text'); +is($f19->is_nullable, 1, 'Field can be null'); +is($f19->size, 64000, 'Size is "64,000"'); +is($f19->default_value, '', 'Dollar-quoted default value is empty'); +is($f19->is_primary_key, 0, 'Field is not PK'); my $f20 = shift @t1_fields; -is( $f20->name, 'f_text3', '20th field is "f_text3"' ); -is( $f20->data_type, 'text', 'Field is text' ); -is( $f20->is_nullable, 1, 'Field can be null' ); -is( $f20->size, 64000, 'Size is "64,000"' ); -is( $f20->default_value, '$ ', 'Dollar-quoted default value is "$ "' ); -is( $f20->is_primary_key, 0, 'Field is not PK' ); +is($f20->name, 'f_text3', '20th field is "f_text3"'); +is($f20->data_type, 'text', 'Field is text'); +is($f20->is_nullable, 1, 'Field can be null'); +is($f20->size, 64000, 'Size is "64,000"'); +is($f20->default_value, '$ ', 'Dollar-quoted default value is "$ "'); +is($f20->is_primary_key, 0, 'Field is not PK'); # my $fk_ref2 = $f11->foreign_key_reference; # isa_ok( $fk_ref2, 'SQL::Translator::Schema::Constraint', 'FK' ); # is( $fk_ref2->reference_table, 't_test2', 'FK is to "t_test2" table' ); my @t1_constraints = $t1->get_constraints; -is( scalar @t1_constraints, 8, '8 constraints on t_test1' ); +is(scalar @t1_constraints, 8, '8 constraints on t_test1'); my $c1 = $t1_constraints[0]; -is( $c1->type, PRIMARY_KEY, 'First constraint is PK' ); -is( join( ',', $c1->fields ), 'f_serial', 'Constraint is on field "f_serial"' ); +is($c1->type, PRIMARY_KEY, 'First constraint is PK'); +is(join(',', $c1->fields), 'f_serial', 'Constraint is on field "f_serial"'); my $c2 = $t1_constraints[4]; -is( $c2->type, FOREIGN_KEY, 'Second constraint is foreign key' ); -is( join( ',', $c2->fields ), 'f_fk1', 'Constraint is on field "f_fk1"' ); -is( $c2->reference_table, 't_test2', 'Constraint is to table "t_test2"' ); -is( join( ',', $c2->reference_fields ), - 'f_id', 'Constraint is to field "f_id"' ); +is($c2->type, FOREIGN_KEY, 'Second constraint is foreign key'); +is(join(',', $c2->fields), 'f_fk1', 'Constraint is on field "f_fk1"'); +is($c2->reference_table, 't_test2', 'Constraint is to table "t_test2"'); +is(join(',', $c2->reference_fields), 'f_id', 'Constraint is to field "f_id"'); my $c3 = $t1_constraints[5]; -is( $c3->type, UNIQUE, 'Third constraint is unique' ); -is( join( ',', $c3->fields ), - 'f_varchar', 'Constraint is on field "f_varchar"' ); +is($c3->type, UNIQUE, 'Third constraint is unique'); +is(join(',', $c3->fields), 'f_varchar', 'Constraint is on field "f_varchar"'); my $c4 = $t1_constraints[6]; -is( $c4->type, FOREIGN_KEY, 'Fourth constraint is foreign key' ); -is( join( ',', $c4->fields ), 'f_fk2', 'Constraint is on field "f_fk2"' ); -is( $c4->reference_table, 't_test2', 'Constraint is to table "t_test2"' ); -is( join( ',', $c4->reference_fields ), - 'f_id', 'Constraint is to field "f_id"' ); -is( $c4->on_delete, 'cascade', 'On delete: cascade' ); -is( $c4->on_update, 'no_action', 'On delete: no action' ); -is( $c4->match_type, 'simple', 'Match type: simple' ); -is( $c4->deferrable, 1, 'Deferrable detected' ); +is($c4->type, FOREIGN_KEY, 'Fourth constraint is foreign key'); +is(join(',', $c4->fields), 'f_fk2', 'Constraint is on field "f_fk2"'); +is($c4->reference_table, 't_test2', 'Constraint is to table "t_test2"'); +is(join(',', $c4->reference_fields), 'f_id', 'Constraint is to field "f_id"'); +is($c4->on_delete, 'cascade', 'On delete: cascade'); +is($c4->on_update, 'no_action', 'On delete: no action'); +is($c4->match_type, 'simple', 'Match type: simple'); +is($c4->deferrable, 1, 'Deferrable detected'); my $t2 = shift @tables; -is( $t2->name, 't_test2', 'Table t_test2 exists' ); +is($t2->name, 't_test2', 'Table t_test2 exists'); my @t2_fields = $t2->get_fields; -is( scalar @t2_fields, 4, '4 fields in t_test2' ); +is(scalar @t2_fields, 4, '4 fields in t_test2'); my $t2_f1 = shift @t2_fields; -is( $t2_f1->name, 'f_id', 'First field is "f_id"' ); -is( $t2_f1->data_type, 'integer', 'Field is an integer' ); -is( $t2_f1->is_nullable, 0, 'Field cannot be null' ); -is( $t2_f1->size, 10, 'Size is "10"' ); -is( $t2_f1->default_value, undef, 'Default value is undefined' ); -is( $t2_f1->is_primary_key, 1, 'Field is PK' ); +is($t2_f1->name, 'f_id', 'First field is "f_id"'); +is($t2_f1->data_type, 'integer', 'Field is an integer'); +is($t2_f1->is_nullable, 0, 'Field cannot be null'); +is($t2_f1->size, 10, 'Size is "10"'); +is($t2_f1->default_value, undef, 'Default value is undefined'); +is($t2_f1->is_primary_key, 1, 'Field is PK'); my $t2_f2 = shift @t2_fields; -is( $t2_f2->name, 'f_varchar', 'Second field is "f_varchar"' ); -is( $t2_f2->data_type, 'varchar', 'Field is an varchar' ); -is( $t2_f2->is_nullable, 1, 'Field can be null' ); -is( $t2_f2->size, 25, 'Size is "25"' ); -is( $t2_f2->default_value, undef, 'Default value is undefined' ); -is( $t2_f2->is_primary_key, 0, 'Field is not PK' ); +is($t2_f2->name, 'f_varchar', 'Second field is "f_varchar"'); +is($t2_f2->data_type, 'varchar', 'Field is an varchar'); +is($t2_f2->is_nullable, 1, 'Field can be null'); +is($t2_f2->size, 25, 'Size is "25"'); +is($t2_f2->default_value, undef, 'Default value is undefined'); +is($t2_f2->is_primary_key, 0, 'Field is not PK'); my $t2_f3 = shift @t2_fields; -is( $t2_f3->name, 'f_int', 'Third field is "f_int"' ); -is( $t2_f3->data_type, 'integer', 'Field is an integer' ); -is( $t2_f3->is_nullable, 1, 'Field can be null' ); -is( $t2_f3->size, 5, 'Size is "5"' ); -is( $t2_f3->default_value, undef, 'Default value is undefined' ); -is( $t2_f3->is_primary_key, 0, 'Field is not PK' ); +is($t2_f3->name, 'f_int', 'Third field is "f_int"'); +is($t2_f3->data_type, 'integer', 'Field is an integer'); +is($t2_f3->is_nullable, 1, 'Field can be null'); +is($t2_f3->size, 5, 'Size is "5"'); +is($t2_f3->default_value, undef, 'Default value is undefined'); +is($t2_f3->is_primary_key, 0, 'Field is not PK'); my $t2_f4 = shift @t2_fields; -is( $t2_f4->name, 'f_smallint', 'Fourth field is "f_smallint"' ); -is( $t2_f4->data_type, 'integer', 'Field is an integer' ); -is( $t2_f4->is_nullable, 1, 'Field can be null' ); -is( $t2_f4->size, 5, 'Size is "5"' ); -is( $t2_f4->default_value, 0, 'Default value is 0' ); -is( $t2_f4->is_primary_key, 0, 'Field is not PK' ); +is($t2_f4->name, 'f_smallint', 'Fourth field is "f_smallint"'); +is($t2_f4->data_type, 'integer', 'Field is an integer'); +is($t2_f4->is_nullable, 1, 'Field can be null'); +is($t2_f4->size, 5, 'Size is "5"'); +is($t2_f4->default_value, 0, 'Default value is 0'); +is($t2_f4->is_primary_key, 0, 'Field is not PK'); my @t2_constraints = $t2->get_constraints; -is( scalar @t2_constraints, 4, "Three constraints on table" ); +is(scalar @t2_constraints, 4, "Three constraints on table"); my $t2_c1 = shift @t2_constraints; -is( $t2_c1->type, NOT_NULL, "Constraint is NOT NULL" ); +is($t2_c1->type, NOT_NULL, "Constraint is NOT NULL"); my $t2_c2 = shift @t2_constraints; -is( $t2_c2->type, PRIMARY_KEY, "Constraint is a PK" ); +is($t2_c2->type, PRIMARY_KEY, "Constraint is a PK"); my $t2_c3 = shift @t2_constraints; -is( $t2_c3->type, CHECK_C, "Constraint is a 'CHECK'" ); -is $t2_c3->expression, 'f_int between 1 and 5', - 'expression is parsed for check constraint'; +is($t2_c3->type, CHECK_C, "Constraint is a 'CHECK'"); +is $t2_c3->expression, 'f_int between 1 and 5', 'expression is parsed for check constraint'; my $t2_c4 = shift @t2_constraints; -is( $t2_c4->type, EXCLUDE, "Constraint is an 'EXCLUDE'" ); -is $t2_c4->expression, 'f_int with =', - 'expression is parsed for exclude constraint'; -is_deeply [$t2_c4->options], [ { using => 'gist' } ], 'got the options right!'; +is($t2_c4->type, EXCLUDE, "Constraint is an 'EXCLUDE'"); +is $t2_c4->expression, 'f_int with =', 'expression is parsed for exclude constraint'; +is_deeply [ $t2_c4->options ], [ { using => 'gist' } ], 'got the options right!'; # test temporary tables -is( exists $schema->get_table('products_1')->extra()->{'temporary'}, - "", "Table is NOT temporary" ); -is( $schema->get_table('products_2')->extra('temporary'), 1, "Table is TEMP" ); -is( $schema->get_table('products_3')->extra('temporary'), - 1, "Table is TEMPORARY" ); +is(exists $schema->get_table('products_1')->extra()->{'temporary'}, "", "Table is NOT temporary"); +is($schema->get_table('products_2')->extra('temporary'), 1, "Table is TEMP"); +is($schema->get_table('products_3')->extra('temporary'), 1, "Table is TEMPORARY"); # test trigger my $trigger = $schema->get_trigger('test_trigger'); -is( $trigger->on_table, 'products_1', "Trigger is on correct table" ); -is_deeply( - scalar $trigger->database_events, - [qw(insert update delete)], - "Correct events for trigger" -); +is($trigger->on_table, 'products_1', "Trigger is on correct table"); +is_deeply(scalar $trigger->database_events, [qw(insert update delete)], "Correct events for trigger"); -is( $trigger->perform_action_when, 'before', "Correct time for trigger" ); -is( $trigger->scope, 'row', "Correct scope for trigger" ); -is( $trigger->action, 'EXECUTE PROCEDURE foo()', "Correct action for trigger" ); +is($trigger->perform_action_when, 'before', "Correct time for trigger"); +is($trigger->scope, 'row', "Correct scope for trigger"); +is($trigger->action, 'EXECUTE PROCEDURE foo()', "Correct action for trigger"); # test index my @indices = $t1->get_indices; -is( scalar @indices, 4, 'got three indexes' ); +is(scalar @indices, 4, 'got three indexes'); my $t1_i1 = $indices[0]; -is( $t1_i1->name, 'test_index1', 'First index is "test_index1"' ); -is( join( ',', $t1_i1->fields ), 'f_varchar', 'Index is on field "f_varchar"' ); -is_deeply( [ $t1_i1->options ], [], 'Index is has no options' ); +is($t1_i1->name, 'test_index1', 'First index is "test_index1"'); +is(join(',', $t1_i1->fields), 'f_varchar', 'Index is on field "f_varchar"'); +is_deeply([ $t1_i1->options ], [], 'Index is has no options'); my $t1_i2 = $indices[1]; -is( $t1_i2->name, 'test_index2', 'Second index is "test_index2"' ); -is( join( ',', $t1_i2->fields ), - 'f_char,f_bool', 'Index is on fields "f_char, f_bool"' ); -is_deeply( - [ $t1_i2->options ], - [ { using => 'hash' } ], - 'Index is using hash method' -); +is($t1_i2->name, 'test_index2', 'Second index is "test_index2"'); +is(join(',', $t1_i2->fields), 'f_char,f_bool', 'Index is on fields "f_char, f_bool"'); +is_deeply([ $t1_i2->options ], [ { using => 'hash' } ], 'Index is using hash method'); my $t1_i3 = $indices[2]; -is( $t1_i3->name, 'test_index3', 'Third index is "test_index3"' ); -is( join( ',', $t1_i3->fields ), - 'f_bigint,f_tz', 'Index is on fields "f_bigint, f_tz"' ); +is($t1_i3->name, 'test_index3', 'Third index is "test_index3"'); +is(join(',', $t1_i3->fields), 'f_bigint,f_tz', 'Index is on fields "f_bigint, f_tz"'); is_deeply( - [ $t1_i3->options ], - [ { using => 'hash' }, { where => "f_bigint = '1' AND f_tz IS NULL" } ], - 'Index is using hash method and has predicate right' + [ $t1_i3->options ], + [ { using => 'hash' }, { where => "f_bigint = '1' AND f_tz IS NULL" } ], + 'Index is using hash method and has predicate right' ); my $t1_i4 = $indices[3]; -is( $t1_i4->name, 'test_index4', 'Fourth index is "test_index4"' ); -is( join( ',', $t1_i4->fields ), - 'f_bigint,f_tz', 'Index is on fields "f_bigint, f_tz"' ); +is($t1_i4->name, 'test_index4', 'Fourth index is "test_index4"'); +is(join(',', $t1_i4->fields), 'f_bigint,f_tz', 'Index is on fields "f_bigint, f_tz"'); is_deeply( - [ $t1_i4->options ], - [ - { using => 'hash' }, - { where => "f_bigint = '1' AND f_tz IS NULL" }, - { include => ['f_bool'] } - ], - 'Index is using hash method and has predicate right and include INCLUDE' + [ $t1_i4->options ], + [ { using => 'hash' }, { where => "f_bigint = '1' AND f_tz IS NULL" }, { include => ['f_bool'] } ], + 'Index is using hash method and has predicate right and include INCLUDE' ); done_testing; diff --git a/t/15oracle-parser.t b/t/15oracle-parser.t index ee610fb32..5f8a752b6 100644 --- a/t/15oracle-parser.t +++ b/t/15oracle-parser.t @@ -10,7 +10,7 @@ use Test::SQL::Translator qw(maybe_plan); maybe_plan(103, 'SQL::Translator::Parser::Oracle'); SQL::Translator::Parser::Oracle->import('parse'); -my $t = SQL::Translator->new( trace => 0 ); +my $t = SQL::Translator->new(trace => 0); my $sql = q[ CREATE TABLE qtl_trait_category ( @@ -111,218 +111,197 @@ my $sql = q[ $| = 1; -my $data = parse( $t, $sql ); +my $data = parse($t, $sql); my $schema = $t->schema; -isa_ok( $schema, 'SQL::Translator::Schema', 'Schema object' ); +isa_ok($schema, 'SQL::Translator::Schema', 'Schema object'); my @tables = $schema->get_tables; -is( scalar @tables, 4, 'Found four tables' ); +is(scalar @tables, 4, 'Found four tables'); # # qtl_trait_category # my $t1 = shift @tables; -is( $t1->name, 'qtl_trait_category', 'First table is "qtl_trait_category"' ); -is( $t1->comments, 'hey, hey, hey, hey', 'Comment = "hey, hey, hey, hey"' ); +is($t1->name, 'qtl_trait_category', 'First table is "qtl_trait_category"'); +is($t1->comments, 'hey, hey, hey, hey', 'Comment = "hey, hey, hey, hey"'); my @t1_fields = $t1->get_fields; -is( scalar @t1_fields, 2, '2 fields in table' ); +is(scalar @t1_fields, 2, '2 fields in table'); my $f1 = shift @t1_fields; -is( $f1->name, 'qtl_trait_category_id', - 'First field is "qtl_trait_category_id"' ); -is( $f1->data_type, 'number', 'Field is a number' ); -is( $f1->size, 11, 'Size is "11"' ); -is( $f1->is_nullable, 0, 'Field cannot be null' ); -is( $f1->default_value, undef, 'Default value is undefined' ); -is( $f1->is_primary_key, 1, 'Field is PK' ); -is( join(',', $f1->comments), 'the primary key!', 'Comment = "the primary key!"' ); +is($f1->name, 'qtl_trait_category_id', 'First field is "qtl_trait_category_id"'); +is($f1->data_type, 'number', 'Field is a number'); +is($f1->size, 11, 'Size is "11"'); +is($f1->is_nullable, 0, 'Field cannot be null'); +is($f1->default_value, undef, 'Default value is undefined'); +is($f1->is_primary_key, 1, 'Field is PK'); +is(join(',', $f1->comments), 'the primary key!', 'Comment = "the primary key!"'); my $f2 = shift @t1_fields; -is( $f2->name, 'trait_category', 'Second field is "trait_category"' ); -is( $f2->data_type, 'varchar2', 'Field is a varchar2' ); -is( $f2->size, 100, 'Size is "100"' ); -is( $f2->is_nullable, 0, 'Field cannot be null' ); -is( $f2->default_value, undef, 'Default value is undefined' ); -is( $f2->is_primary_key, 0, 'Field is not PK' ); +is($f2->name, 'trait_category', 'Second field is "trait_category"'); +is($f2->data_type, 'varchar2', 'Field is a varchar2'); +is($f2->size, 100, 'Size is "100"'); +is($f2->is_nullable, 0, 'Field cannot be null'); +is($f2->default_value, undef, 'Default value is undefined'); +is($f2->is_primary_key, 0, 'Field is not PK'); my @t1_indices = $t1->get_indices; -is( scalar @t1_indices, 0, '0 indices on table' ); +is(scalar @t1_indices, 0, '0 indices on table'); my @t1_constraints = $t1->get_constraints; + #use Data::Dumper; #print STDERR Dumper(\@t1_constraints), "\n"; -is( scalar @t1_constraints, 3, '3 constraints on table' ); +is(scalar @t1_constraints, 3, '3 constraints on table'); my $c1 = $t1_constraints[0]; -is( $c1->name, 'pk_qtl_trait_category', - 'Constraint name is "pk_qtl_trait_category"' ); -is( $c1->type, PRIMARY_KEY, 'First constraint is PK' ); -is( join(',', $c1->fields), 'qtl_trait_category_id', - 'Constraint is on field "qtl_trait_category_id"' ); +is($c1->name, 'pk_qtl_trait_category', 'Constraint name is "pk_qtl_trait_category"'); +is($c1->type, PRIMARY_KEY, 'First constraint is PK'); +is(join(',', $c1->fields), 'qtl_trait_category_id', 'Constraint is on field "qtl_trait_category_id"'); my $c2 = $t1_constraints[1]; -is( $c2->type, CHECK_C, 'Second constraint is a check' ); -is( $c2->expression, - "( trait_category IN ('S', 'A', 'E') ) ENABLE", - 'Constraint is on field "trait_category"' ); +is($c2->type, CHECK_C, 'Second constraint is a check'); +is($c2->expression, "( trait_category IN ('S', 'A', 'E') ) ENABLE", 'Constraint is on field "trait_category"'); my $c3 = $t1_constraints[2]; -is( $c3->type, UNIQUE, 'Third constraint is unique' ); -is( join(',', $c3->fields), 'trait_category', - 'Constraint is on field "trait_category"' ); +is($c3->type, UNIQUE, 'Third constraint is unique'); +is(join(',', $c3->fields), 'trait_category', 'Constraint is on field "trait_category"'); # # qtl_trait # my $t2 = shift @tables; -is( $t2->name, 'qtl_trait', 'Table "qtl_trait" exists' ); -is( $t2->comments, 'foo bar comment', 'Comment "foo bar" exists' ); +is($t2->name, 'qtl_trait', 'Table "qtl_trait" exists'); +is($t2->comments, 'foo bar comment', 'Comment "foo bar" exists'); my @t2_fields = $t2->get_fields; -is( scalar @t2_fields, 5, '5 fields in table' ); +is(scalar @t2_fields, 5, '5 fields in table'); my $t2_f1 = shift @t2_fields; -is( $t2_f1->name, 'qtl_trait_id', 'First field is "qtl_trait_id"' ); -is( $t2_f1->data_type, 'number', 'Field is a number' ); -is( $t2_f1->size, 11, 'Size is "11"' ); -is( $t2_f1->is_nullable, 0, 'Field cannot be null' ); -is( $t2_f1->default_value, undef, 'Default value is undefined' ); -is( $t2_f1->is_primary_key, 1, 'Field is PK' ); +is($t2_f1->name, 'qtl_trait_id', 'First field is "qtl_trait_id"'); +is($t2_f1->data_type, 'number', 'Field is a number'); +is($t2_f1->size, 11, 'Size is "11"'); +is($t2_f1->is_nullable, 0, 'Field cannot be null'); +is($t2_f1->default_value, undef, 'Default value is undefined'); +is($t2_f1->is_primary_key, 1, 'Field is PK'); my $t2_f2 = shift @t2_fields; -is( $t2_f2->name, 'trait_symbol', 'Second field is "trait_symbol"' ); -is( $t2_f2->data_type, 'varchar2', 'Field is a varchar2' ); -is( $t2_f2->size, 100, 'Size is "100"' ); -is( $t2_f2->is_nullable, 0, 'Field cannot be null' ); -is( $t2_f2->is_foreign_key, 0, 'Field is not a FK' ); +is($t2_f2->name, 'trait_symbol', 'Second field is "trait_symbol"'); +is($t2_f2->data_type, 'varchar2', 'Field is a varchar2'); +is($t2_f2->size, 100, 'Size is "100"'); +is($t2_f2->is_nullable, 0, 'Field cannot be null'); +is($t2_f2->is_foreign_key, 0, 'Field is not a FK'); my $t2_f3 = shift @t2_fields; -is( $t2_f3->name, 'trait_name', 'Third field is "trait_name"' ); -is( $t2_f3->data_type, 'varchar2', 'Field is a varchar2' ); -is( $t2_f3->size, 200, 'Size is "200"' ); -is( $t2_f3->is_nullable, 0, 'Field cannot be null' ); -is( $t2_f3->is_foreign_key, 0, 'Field is not a FK' ); +is($t2_f3->name, 'trait_name', 'Third field is "trait_name"'); +is($t2_f3->data_type, 'varchar2', 'Field is a varchar2'); +is($t2_f3->size, 200, 'Size is "200"'); +is($t2_f3->is_nullable, 0, 'Field cannot be null'); +is($t2_f3->is_foreign_key, 0, 'Field is not a FK'); my $t2_f4 = shift @t2_fields; -is( $t2_f4->name, 'qtl_trait_category_id', - 'Fourth field is "qtl_trait_category_id"' ); -is( $t2_f4->data_type, 'number', 'Field is a number' ); -is( $t2_f4->size, 11, 'Size is "11"' ); -is( $t2_f4->is_nullable, 0, 'Field cannot be null' ); -is( $t2_f4->is_foreign_key, 1, 'Field is a FK' ); +is($t2_f4->name, 'qtl_trait_category_id', 'Fourth field is "qtl_trait_category_id"'); +is($t2_f4->data_type, 'number', 'Field is a number'); +is($t2_f4->size, 11, 'Size is "11"'); +is($t2_f4->is_nullable, 0, 'Field cannot be null'); +is($t2_f4->is_foreign_key, 1, 'Field is a FK'); my $f4_fk = $t2_f4->foreign_key_reference; -isa_ok( $f4_fk, 'SQL::Translator::Schema::Constraint', 'FK' ); -is( $f4_fk->reference_table, 'qtl_trait_category', - 'FK references table "qtl_trait_category"' ); -is( join(',', $f4_fk->reference_fields), 'qtl_trait_category_id', - 'FK references field "qtl_trait_category_id"' ); +isa_ok($f4_fk, 'SQL::Translator::Schema::Constraint', 'FK'); +is($f4_fk->reference_table, 'qtl_trait_category', 'FK references table "qtl_trait_category"'); +is(join(',', $f4_fk->reference_fields), 'qtl_trait_category_id', 'FK references field "qtl_trait_category_id"'); my $t2_f5 = shift @t2_fields; -is( $t2_f5->name, 'trait_date', 'Fifth field is "trait_date"'); -is( $t2_f5->data_type, 'DATE', 'Field is a timestamp' ); -is( $t2_f5->is_nullable, 0, 'Field cannot be null' ); -is_deeply( - $t2_f5->default_value, - \'CURRENT_TIMESTAMP', - 'Field has correct default value' -); +is($t2_f5->name, 'trait_date', 'Fifth field is "trait_date"'); +is($t2_f5->data_type, 'DATE', 'Field is a timestamp'); +is($t2_f5->is_nullable, 0, 'Field cannot be null'); +is_deeply($t2_f5->default_value, \'CURRENT_TIMESTAMP', 'Field has correct default value'); my @t2_constraints = $t2->get_constraints; -is( scalar @t2_constraints, 4, '4 constraints on table' ); +is(scalar @t2_constraints, 4, '4 constraints on table'); my $t2_c1 = shift @t2_constraints; -is( $t2_c1->type, PRIMARY_KEY, 'First constraint is PK' ); -is( $t2_c1->name, 'pk_qtl_trait', 'Name is "pk_qtl_trait"' ); -is( join(',', $t2_c1->fields), 'qtl_trait_id', 'Fields = "qtl_trait_id"' ); +is($t2_c1->type, PRIMARY_KEY, 'First constraint is PK'); +is($t2_c1->name, 'pk_qtl_trait', 'Name is "pk_qtl_trait"'); +is(join(',', $t2_c1->fields), 'qtl_trait_id', 'Fields = "qtl_trait_id"'); my $t2_c2 = shift @t2_constraints; -is( $t2_c2->type, UNIQUE, 'Second constraint is unique' ); -is( $t2_c2->name, '', 'No name' ); -is( join(',', $t2_c2->fields), 'trait_symbol', 'Fields = "trait_symbol"' ); +is($t2_c2->type, UNIQUE, 'Second constraint is unique'); +is($t2_c2->name, '', 'No name'); +is(join(',', $t2_c2->fields), 'trait_symbol', 'Fields = "trait_symbol"'); my $t2_c3 = shift @t2_constraints; -is( $t2_c3->type, UNIQUE, 'Third constraint is unique' ); -is( $t2_c3->name, '', 'No name' ); -is( join(',', $t2_c3->fields), 'trait_name', 'Fields = "trait_name"' ); +is($t2_c3->type, UNIQUE, 'Third constraint is unique'); +is($t2_c3->name, '', 'No name'); +is(join(',', $t2_c3->fields), 'trait_name', 'Fields = "trait_name"'); my $t2_c4 = shift @t2_constraints; -is( $t2_c4->type, FOREIGN_KEY, 'Fourth constraint is FK' ); -is( $t2_c4->name, '', 'No name' ); -is( join(',', $t2_c4->fields), 'qtl_trait_category_id', - 'Fields = "qtl_trait_category_id"' ); -is( $t2_c4->reference_table, 'qtl_trait_category', - 'Reference table = "qtl_trait_category"' ); -is( join(',', $t2_c4->reference_fields), 'qtl_trait_category_id', - 'Reference fields = "qtl_trait_category_id"' ); - +is($t2_c4->type, FOREIGN_KEY, 'Fourth constraint is FK'); +is($t2_c4->name, '', 'No name'); +is(join(',', $t2_c4->fields), 'qtl_trait_category_id', 'Fields = "qtl_trait_category_id"'); +is($t2_c4->reference_table, 'qtl_trait_category', 'Reference table = "qtl_trait_category"'); +is(join(',', $t2_c4->reference_fields), 'qtl_trait_category_id', 'Reference fields = "qtl_trait_category_id"'); # # qtl # my $t3 = shift @tables; -is( $t3->name, 'qtl', 'Table "qtl" exists' ); +is($t3->name, 'qtl', 'Table "qtl" exists'); my @t3_fields = $t3->get_fields; -is( scalar @t3_fields, 8, '8 fields in table' ); +is(scalar @t3_fields, 8, '8 fields in table'); my @t3_constraints = $t3->get_constraints; -is( scalar @t3_constraints, 4, '4 constraints on table' ); +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_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' ); +is($t3->comments, 'qtl table comment', 'Comment "qtl table comment" exists'); -my $t3_f1 = shift @t3_fields; -is( $t3_f1->comments, 'qtl_id comment', 'Comment "qtl_id comment" exists' ); +my $t3_f1 = shift @t3_fields; +is($t3_f1->comments, 'qtl_id comment', 'Comment "qtl_id comment" exists'); -my $t3_f2 = shift @t3_fields; -is( $t3_f2->comments, 'accession comment', - 'Comment "accession comment" exists' ); +my $t3_f2 = shift @t3_fields; +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' ); +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"' ); +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 # my $t4 = shift @tables; -is( $t4->name, 'qtl_trait_synonym', 'Table "qtl_trait_synonym" exists' ); +is($t4->name, 'qtl_trait_synonym', 'Table "qtl_trait_synonym" exists'); my @t4_fields = $t4->get_fields; -is( scalar @t4_fields, 3, '3 fields in table' ); +is(scalar @t4_fields, 3, '3 fields in table'); my @t4_constraints = $t4->get_constraints; -is( scalar @t4_constraints, 3, '3 constraints on table' ); +is(scalar @t4_constraints, 3, '3 constraints on table'); my $t4_c3 = $t4_constraints[2]; -is( $t4_c3->type, FOREIGN_KEY, 'Third constraint is FK' ); -is( $t4_c3->name, '', 'No name' ); -is( join(',', $t4_c3->fields), 'qtl_trait_id', - 'Fields = "qtl_trait_id"' ); -is( $t4_c3->reference_table, 'qtl_trait', - 'Reference table = "qtl_trait"' ); -is( join(',', $t4_c3->reference_fields), 'qtl_trait_id', - 'Reference fields = "qtl_trait_id"' ); -is( $t4_c3->on_delete, 'SET NULL', - 'on_delete = "SET NULL"' ); +is($t4_c3->type, FOREIGN_KEY, 'Third constraint is FK'); +is($t4_c3->name, '', 'No name'); +is(join(',', $t4_c3->fields), 'qtl_trait_id', 'Fields = "qtl_trait_id"'); +is($t4_c3->reference_table, 'qtl_trait', 'Reference table = "qtl_trait"'); +is(join(',', $t4_c3->reference_fields), 'qtl_trait_id', 'Reference fields = "qtl_trait_id"'); +is($t4_c3->on_delete, 'SET NULL', 'on_delete = "SET NULL"'); my @views = $schema->get_views; -is( scalar @views, 1, 'Right number of views (1)' ); +is(scalar @views, 1, 'Right number of views (1)'); my $view1 = shift @views; -is( $view1->name, 'VS_ASSET', 'Found "VS_ASSET" view' ); +is($view1->name, 'VS_ASSET', 'Found "VS_ASSET" view'); like($view1->sql, qr/VS_ASSET/, "Detected view VS_ASSET"); unlike($view1->sql, qr/CMDOMAIN_MIG/, "Did not detect CMDOMAIN_MIG"); my @procs = $schema->get_procedures; -is( scalar @procs, 1, 'Right number of procedures (1)' ); +is(scalar @procs, 1, 'Right number of procedures (1)'); my $proc1 = shift @procs; -is( $proc1->name, 'P_24_HOUR_EVENT_SUMMARY', 'Found "P_24_HOUR_EVENT_SUMMARY" procedure' ); +is($proc1->name, 'P_24_HOUR_EVENT_SUMMARY', 'Found "P_24_HOUR_EVENT_SUMMARY" procedure'); like($proc1->sql, qr/P_24_HOUR_EVENT_SUMMARY/, "Detected procedure P_24_HOUR_EVENT_SUMMARY"); unlike($proc1->sql, qr/CMDOMAIN_MIG/, "Did not detect CMDOMAIN_MIG"); diff --git a/t/16xml-parser.t b/t/16xml-parser.t index 165d11fb2..def3937e7 100644 --- a/t/16xml-parser.t +++ b/t/16xml-parser.t @@ -19,31 +19,36 @@ use SQL::Translator::Schema::Constants; # Simple options. -d for debug my %opt; -BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; } -use constant DEBUG => (exists $opt{d} ? 1 : 0); +BEGIN { + map { $opt{$_} = 1 if s/^-// } @ARGV; +} +use constant DEBUG => (exists $opt{d} ? 1 : 0); # Testing 1,2,3,4... #============================================================================= BEGIN { - maybe_plan(undef, 'SQL::Translator::Parser::XML::SQLFairy'); + maybe_plan(undef, 'SQL::Translator::Parser::XML::SQLFairy'); } my $testschema = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - debug => DEBUG, - show_warnings => 1, - add_drop_table => 1, + debug => DEBUG, + show_warnings => 1, + add_drop_table => 1, ); die "Can't find test schema $testschema" unless -e $testschema; my $sql; { my @w; - local $SIG{__WARN__} = sub { push @w, $_[0] if $_[0] =~ /The database_event tag is deprecated - please use database_events/ }; + local $SIG{__WARN__} = sub { + push @w, $_[0] + if $_[0] =~ /The database_event tag is deprecated - please use database_events/; + }; $sql = $sqlt->translate( from => 'XML-SQLFairy', @@ -52,7 +57,7 @@ my $sql; ) or die $sqlt->error; print $sql if DEBUG; - ok (@w, 'database_event deprecation warning issued'); + ok(@w, 'database_event deprecation warning issued'); } # Test the schema objs generted from the XML @@ -62,214 +67,217 @@ my $scma = $sqlt->schema; # Hmmm, when using schema_ok the field test data gets a bit too nested and # fiddly to work with. (See 28xml-xmi-parser-sqlfairy.t for more a split out # version) -schema_ok( $scma, { +schema_ok( + $scma, + { tables => [ - { - name => "Basic", - options => [ { ENGINE => 'InnoDB' } ], - extra => { - foo => "bar", - hello => "world", - bar => "baz", + { + name => "Basic", + options => [ { ENGINE => 'InnoDB' } ], + extra => { + foo => "bar", + hello => "world", + bar => "baz", + }, + fields => [ + { + name => "id", + data_type => "int", + default_value => undef, + is_nullable => 0, + size => 10, + is_primary_key => 1, + is_auto_increment => 1, + extra => { ZEROFILL => 1 }, + }, + { + name => "title", + data_type => "varchar", + is_nullable => 0, + default_value => "hello", + size => 100, + is_unique => 1, + }, + { + name => "description", + data_type => "text", + is_nullable => 1, + default_value => "", + }, + { + name => "email", + data_type => "varchar", + size => 500, + is_unique => 1, + default_value => undef, + is_nullable => 1, + extra => { + foo => "bar", + hello => "world", + bar => "baz", + } + }, + { + name => "explicitnulldef", + data_type => "varchar", + default_value => undef, + is_nullable => 1, + size => 255, + }, + { + name => "explicitemptystring", + data_type => "varchar", + default_value => "", + is_nullable => 1, + size => 255, + }, + { + name => "emptytagdef", + data_type => "varchar", + default_value => "", + is_nullable => 1, + comments => "Hello emptytagdef", + size => 255, + }, + { + name => "another_id", + data_type => "int", + size => "10", + default_value => 2, + is_nullable => 1, + is_foreign_key => 1, + }, + { + name => "timest", + data_type => "timestamp", + size => "0", + is_nullable => 1, + }, + ], + constraints => [ + { + type => PRIMARY_KEY, + fields => ["id"], + extra => { + foo => "bar", + hello => "world", + bar => "baz", }, - fields => [ - { - name => "id", - data_type => "int", - default_value => undef, - is_nullable => 0, - size => 10, - is_primary_key => 1, - is_auto_increment => 1, - extra => { ZEROFILL => 1 }, - }, - { - name => "title", - data_type => "varchar", - is_nullable => 0, - default_value => "hello", - size => 100, - is_unique => 1, - }, - { - name => "description", - data_type => "text", - is_nullable => 1, - default_value => "", - }, - { - name => "email", - data_type => "varchar", - size => 500, - is_unique => 1, - default_value => undef, - is_nullable => 1, - extra => { - foo => "bar", - hello => "world", - bar => "baz", - } - }, - { - name => "explicitnulldef", - data_type => "varchar", - default_value => undef, - is_nullable => 1, - size => 255, - }, - { - name => "explicitemptystring", - data_type => "varchar", - default_value => "", - is_nullable => 1, - size => 255, - }, - { - name => "emptytagdef", - data_type => "varchar", - default_value => "", - is_nullable => 1, - comments => "Hello emptytagdef", - size => 255, - }, - { - name => "another_id", - data_type => "int", - size => "10", - default_value => 2, - is_nullable => 1, - is_foreign_key => 1, - }, - { - name => "timest", - data_type => "timestamp", - size => "0", - is_nullable => 1, - }, - ], - constraints => [ - { - type => PRIMARY_KEY, - fields => ["id"], - extra => { - foo => "bar", - hello => "world", - bar => "baz", - }, - }, - { - name => 'emailuniqueindex', - type => UNIQUE, - fields => ["email"], - }, - { - name => 'very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms', - type => UNIQUE, - fields => ["title"], - }, - { - type => FOREIGN_KEY, - fields => ["another_id"], - reference_table => "Another", - reference_fields => ["id"], - name => 'Basic_fk' - }, - ], - indices => [ - { - name => "titleindex", - fields => ["title"], - extra => { - foo => "bar", - hello => "world", - bar => "baz", - }, - }, - ], - }, # end table Basic - { - name => "Another", - extra => { - foo => "bar", - hello => "world", - bar => "baz", + }, + { + name => 'emailuniqueindex', + type => UNIQUE, + fields => ["email"], + }, + { + name => 'very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms', + type => UNIQUE, + fields => ["title"], + }, + { + type => FOREIGN_KEY, + fields => ["another_id"], + reference_table => "Another", + reference_fields => ["id"], + name => 'Basic_fk' + }, + ], + indices => [ + { + name => "titleindex", + fields => ["title"], + extra => { + foo => "bar", + hello => "world", + bar => "baz", }, - options => [ { ENGINE => 'InnoDB' } ], - fields => [ - { - name => "id", - data_type => "int", - default_value => undef, - is_nullable => 0, - size => 10, - is_primary_key => 1, - is_auto_increment => 1, - }, - { - name => "num", - data_type => "numeric", - default_value => undef, - size => '10,2', - }, - ], - }, # end table Another - ], # end tables + }, + ], + }, # end table Basic + { + name => "Another", + extra => { + foo => "bar", + hello => "world", + bar => "baz", + }, + options => [ { ENGINE => 'InnoDB' } ], + fields => [ + { + name => "id", + data_type => "int", + default_value => undef, + is_nullable => 0, + size => 10, + is_primary_key => 1, + is_auto_increment => 1, + }, + { + name => "num", + data_type => "numeric", + default_value => undef, + size => '10,2', + }, + ], + }, # end table Another + ], # end tables views => [ - { - name => 'email_list', - sql => "SELECT email FROM Basic WHERE (email IS NOT NULL)", - fields => ['email'], - extra => { - foo => "bar", - hello => "world", - bar => "baz", - }, + { + name => 'email_list', + sql => "SELECT email FROM Basic WHERE (email IS NOT NULL)", + fields => ['email'], + extra => { + foo => "bar", + hello => "world", + bar => "baz", }, + }, ], triggers => [ - { - name => 'foo_trigger', - perform_action_when => 'after', - database_events => 'insert', - on_table => 'Basic', - action => 'update modified=timestamp();', - scope => 'row', - extra => { - foo => "bar", - hello => "world", - bar => "baz", - }, + { + name => 'foo_trigger', + perform_action_when => 'after', + database_events => 'insert', + on_table => 'Basic', + action => 'update modified=timestamp();', + scope => 'row', + extra => { + foo => "bar", + hello => "world", + bar => "baz", }, - { - name => 'bar_trigger', - perform_action_when => 'before', - database_events => 'insert,update', - on_table => 'Basic', - action => 'update modified2=timestamp();', - scope => 'row', - extra => { - hello => "aliens", - }, + }, + { + name => 'bar_trigger', + perform_action_when => 'before', + database_events => 'insert,update', + on_table => 'Basic', + action => 'update modified2=timestamp();', + scope => 'row', + extra => { + hello => "aliens", }, + }, ], procedures => [ - { - name => 'foo_proc', - sql => 'select foo from bar', - parameters => ['foo', 'bar'], - owner => 'Nomar', - comments => 'Go Sox!', - extra => { - foo => "bar", - hello => "world", - bar => "baz", - }, + { + name => 'foo_proc', + sql => 'select foo from bar', + parameters => [ 'foo', 'bar' ], + owner => 'Nomar', + comments => 'Go Sox!', + extra => { + foo => "bar", + hello => "world", + bar => "baz", }, + }, ], -}); # end schema + } +); # end schema done_testing; diff --git a/t/17sqlfxml-producer.t b/t/17sqlfxml-producer.t index 85042ce97..09e78ada1 100644 --- a/t/17sqlfxml-producer.t +++ b/t/17sqlfxml-producer.t @@ -13,7 +13,10 @@ use Test::SQL::Translator qw(maybe_plan); use Data::Dumper; my %opt; -BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; } + +BEGIN { + map { $opt{$_} = 1 if s/^-// } @ARGV; +} use constant DEBUG => (exists $opt{d} ? 1 : 0); use constant TRACE => (exists $opt{t} ? 1 : 0); @@ -22,18 +25,15 @@ use FindBin qw/$Bin/; my $file = "$Bin/data/mysql/sqlfxml-producer-basic.sql"; local $SIG{__WARN__} = sub { - CORE::warn(@_) - unless $_[0] =~ m!XML/Writer!; + CORE::warn(@_) + unless $_[0] =~ m!XML/Writer!; }; # Testing 1,2,3,4... #============================================================================= BEGIN { - maybe_plan(14, - 'XML::Writer', - 'Test::Differences', - 'SQL::Translator::Producer::XML::SQLFairy'); + maybe_plan(14, 'XML::Writer', 'Test::Differences', 'SQL::Translator::Producer::XML::SQLFairy'); } use Test::Differences; @@ -43,21 +43,20 @@ use SQL::Translator::Producer::XML::SQLFairy; # Due to formatters being able to change style, e.g. by entries in .rc files # in $HOME, the layout and or indent might differ slightly. As leading white # is not important in XML, strip it when comparing -sub xml_equals -{ - my ($got, $expect, $msg) = (@_, "XML looks right"); - $got =~ s/^ +//gm; - $expect =~ s/^ +//gm; - eq_or_diff $got, $expect, $msg, { context => 1 }; +sub xml_equals { + my ($got, $expect, $msg) = (@_, "XML looks right"); + $got =~ s/^ +//gm; + $expect =~ s/^ +//gm; + eq_or_diff $got, $expect, $msg, { context => 1 }; } # # basic stuff # { -my ($obj,$ans,$xml); + my ($obj, $ans, $xml); -$ans = < @@ -103,31 +102,32 @@ $ans = < EOXML -$obj = SQL::Translator->new( + $obj = SQL::Translator->new( debug => DEBUG, trace => TRACE, show_warnings => 1, add_drop_table => 1, from => "MySQL", to => "XML-SQLFairy", -); -$xml = $obj->translate($file) or die $obj->error; -ok("$xml" ne "" ,"Produced something!"); -print "XML:\n$xml" if DEBUG; -# Strip sqlf header with its variable date so we diff safely -$xml =~ s/^([^\n]*\n){7}//m; -xml_equals $xml, $ans; + ); + $xml = $obj->translate($file) or die $obj->error; + ok("$xml" ne "", "Produced something!"); + print "XML:\n$xml" if DEBUG; -} # end basic stuff + # Strip sqlf header with its variable date so we diff safely + $xml =~ s/^([^\n]*\n){7}//m; + xml_equals $xml, $ans; + +} # end basic stuff # # View # # Thanks to Ken for the schema setup lifted from 13schema.t { -my ($obj,$ans,$xml); + my ($obj, $ans, $xml); -$ans = < @@ -142,44 +142,45 @@ $ans = < EOXML - $obj = SQL::Translator->new( - debug => DEBUG, - trace => TRACE, - show_warnings => 1, - add_drop_table => 1, - from => "MySQL", - to => "XML-SQLFairy", - ); - my $s = $obj->schema; - my $name = 'foo_view'; - my $sql = 'select name, age from person'; - my $fields = 'name, age'; - my $v = $s->add_view( - name => $name, - sql => $sql, - fields => $fields, - extra => { hello => "world" }, - schema => $s, - ) or die $s->error; - - # As we have created a Schema we give translate a dummy string so that - # it will run the produce. - lives_ok {$xml =$obj->translate("FOO");} "Translate (View) ran"; - ok("$xml" ne "" ,"Produced something!"); - print "XML attrib_values=>1:\n$xml" if DEBUG; - # Strip sqlf header with its variable date so we diff safely - $xml =~ s/^([^\n]*\n){7}//m; - xml_equals $xml, $ans; -} # end View + $obj = SQL::Translator->new( + debug => DEBUG, + trace => TRACE, + show_warnings => 1, + add_drop_table => 1, + from => "MySQL", + to => "XML-SQLFairy", + ); + my $s = $obj->schema; + my $name = 'foo_view'; + my $sql = 'select name, age from person'; + my $fields = 'name, age'; + my $v = $s->add_view( + name => $name, + sql => $sql, + fields => $fields, + extra => { hello => "world" }, + schema => $s, + ) or die $s->error; + + # As we have created a Schema we give translate a dummy string so that + # it will run the produce. + lives_ok { $xml = $obj->translate("FOO"); } "Translate (View) ran"; + ok("$xml" ne "", "Produced something!"); + print "XML attrib_values=>1:\n$xml" if DEBUG; + + # Strip sqlf header with its variable date so we diff safely + $xml =~ s/^([^\n]*\n){7}//m; + xml_equals $xml, $ans; +} # end View # # Trigger # # Thanks to Ken for the schema setup lifted from 13schema.t { -my ($obj,$ans,$xml); + my ($obj, $ans, $xml); -$ans = < @@ -202,48 +203,49 @@ $ans = < EOXML - $obj = SQL::Translator->new( - debug => DEBUG, - trace => TRACE, - show_warnings => 1, - add_drop_table => 1, - from => "MySQL", - to => "XML-SQLFairy", - ); - my $s = $obj->schema; - my $name = 'foo_trigger'; - my $perform_action_when = 'after'; - my $database_event = 'insert'; - my $action = 'update modified=timestamp();'; - my $table = $s->add_table( name => "Basic" ) or die $s->error; - my $t = $s->add_trigger( - name => $name, - perform_action_when => $perform_action_when, - database_events => [$database_event], - table => $table, - action => $action, - scope => 'row', - extra => { hello => "world" }, - ) or die $s->error; - - # As we have created a Schema we give translate a dummy string so that - # it will run the produce. - lives_ok {$xml =$obj->translate("FOO");} "Translate (Trigger) ran"; - ok("$xml" ne "" ,"Produced something!"); - print "XML attrib_values=>1:\n$xml" if DEBUG; - # Strip sqlf header with its variable date so we diff safely - $xml =~ s/^([^\n]*\n){7}//m; - xml_equals $xml, $ans; -} # end Trigger + $obj = SQL::Translator->new( + debug => DEBUG, + trace => TRACE, + show_warnings => 1, + add_drop_table => 1, + from => "MySQL", + to => "XML-SQLFairy", + ); + my $s = $obj->schema; + my $name = 'foo_trigger'; + my $perform_action_when = 'after'; + my $database_event = 'insert'; + my $action = 'update modified=timestamp();'; + my $table = $s->add_table(name => "Basic") or die $s->error; + my $t = $s->add_trigger( + name => $name, + perform_action_when => $perform_action_when, + database_events => [$database_event], + table => $table, + action => $action, + scope => 'row', + extra => { hello => "world" }, + ) or die $s->error; + + # As we have created a Schema we give translate a dummy string so that + # it will run the produce. + lives_ok { $xml = $obj->translate("FOO"); } "Translate (Trigger) ran"; + ok("$xml" ne "", "Produced something!"); + print "XML attrib_values=>1:\n$xml" if DEBUG; + + # Strip sqlf header with its variable date so we diff safely + $xml =~ s/^([^\n]*\n){7}//m; + xml_equals $xml, $ans; +} # end Trigger # # Procedure # # Thanks to Ken for the schema setup lifted from 13schema.t { -my ($obj,$ans,$xml); + my ($obj, $ans, $xml); -$ans = < @@ -259,46 +261,47 @@ $ans = < EOXML - $obj = SQL::Translator->new( - debug => DEBUG, - trace => TRACE, - show_warnings => 1, - add_drop_table => 1, - from => "MySQL", - to => "XML-SQLFairy", - ); - my $s = $obj->schema; - my $name = 'foo_proc'; - my $sql = 'select foo from bar'; - my $parameters = 'foo, bar'; - my $owner = 'Nomar'; - my $comments = 'Go Sox!'; - my $p = $s->add_procedure( - name => $name, - sql => $sql, - parameters => $parameters, - owner => $owner, - comments => $comments, - extra => { hello => "world" }, - ) or die $s->error; - - # As we have created a Schema we give translate a dummy string so that - # it will run the produce. - lives_ok {$xml =$obj->translate("FOO");} "Translate (Procedure) ran"; - ok("$xml" ne "" ,"Produced something!"); - print "XML attrib_values=>1:\n$xml" if DEBUG; - # Strip sqlf header with its variable date so we diff safely - $xml =~ s/^([^\n]*\n){7}//m; - xml_equals $xml, $ans; -} # end Procedure + $obj = SQL::Translator->new( + debug => DEBUG, + trace => TRACE, + show_warnings => 1, + add_drop_table => 1, + from => "MySQL", + to => "XML-SQLFairy", + ); + my $s = $obj->schema; + my $name = 'foo_proc'; + my $sql = 'select foo from bar'; + my $parameters = 'foo, bar'; + my $owner = 'Nomar'; + my $comments = 'Go Sox!'; + my $p = $s->add_procedure( + name => $name, + sql => $sql, + parameters => $parameters, + owner => $owner, + comments => $comments, + extra => { hello => "world" }, + ) or die $s->error; + + # As we have created a Schema we give translate a dummy string so that + # it will run the produce. + lives_ok { $xml = $obj->translate("FOO"); } "Translate (Procedure) ran"; + ok("$xml" ne "", "Produced something!"); + print "XML attrib_values=>1:\n$xml" if DEBUG; + + # Strip sqlf header with its variable date so we diff safely + $xml =~ s/^([^\n]*\n){7}//m; + xml_equals $xml, $ans; +} # end Procedure # # Field.extra # { -my ($obj,$ans,$xml); + my ($obj, $ans, $xml); -$ans = < @@ -329,41 +332,41 @@ $ans = < EOXML - $obj = SQL::Translator->new( - debug => DEBUG, - trace => TRACE, - show_warnings => 1, - add_drop_table => 1, - from => "MySQL", - to => "XML-SQLFairy", - ); - my $s = $obj->schema; - my $t = $s->add_table( name => "Basic" ) or die $s->error; - my $f = $t->add_field( - name => "foo", - data_type => "integer", - size => "10", - ) or die $t->error; - $f->extra(ZEROFILL => "1"); - - $t->add_field( - name => "bar", - data_type => "numeric", - size => "10,2", - ) or die $t->error; - $t->add_field( - name => "baz", - data_type => "decimal", - size => [8,3], - ) or die $t->error; - - - # As we have created a Schema we give translate a dummy string so that - # it will run the produce. - lives_ok {$xml =$obj->translate("FOO");} "Translate (Field.extra) ran"; - ok("$xml" ne "" ,"Produced something!"); - print "XML:\n$xml" if DEBUG; - # Strip sqlf header with its variable date so we diff safely - $xml =~ s/^([^\n]*\n){7}//m; - xml_equals $xml, $ans; -} # end extra + $obj = SQL::Translator->new( + debug => DEBUG, + trace => TRACE, + show_warnings => 1, + add_drop_table => 1, + from => "MySQL", + to => "XML-SQLFairy", + ); + my $s = $obj->schema; + my $t = $s->add_table(name => "Basic") or die $s->error; + my $f = $t->add_field( + name => "foo", + data_type => "integer", + size => "10", + ) or die $t->error; + $f->extra(ZEROFILL => "1"); + + $t->add_field( + name => "bar", + data_type => "numeric", + size => "10,2", + ) or die $t->error; + $t->add_field( + name => "baz", + data_type => "decimal", + size => [ 8, 3 ], + ) or die $t->error; + + # As we have created a Schema we give translate a dummy string so that + # it will run the produce. + lives_ok { $xml = $obj->translate("FOO"); } "Translate (Field.extra) ran"; + ok("$xml" ne "", "Produced something!"); + print "XML:\n$xml" if DEBUG; + + # Strip sqlf header with its variable date so we diff safely + $xml =~ s/^([^\n]*\n){7}//m; + xml_equals $xml, $ans; +} # end extra diff --git a/t/18ttschema-producer.t b/t/18ttschema-producer.t index 3118da815..bf79ad37b 100644 --- a/t/18ttschema-producer.t +++ b/t/18ttschema-producer.t @@ -16,11 +16,7 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(6, - 'SQL::Translator::Parser::XML::SQLFairy', - 'Template 2.20', - 'Test::Differences' - ); + maybe_plan(6, 'SQL::Translator::Parser::XML::SQLFairy', 'Template 2.20', 'Test::Differences'); } use Test::Differences; @@ -29,59 +25,55 @@ use SQL::Translator::Producer::TTSchema; # Main test. Template whole schema and test tt_vars { - my $obj; - $obj = SQL::Translator->new( - show_warnings => 0, - from => "XML-SQLFairy", - filename => "$Bin/data/xml/schema.xml", - to => "TTSchema", - producer_args => { - ttfile => "$Bin/data/template/basic.tt", - tt_vars => { - foo => 'bar', - hello => 'world', - }, - }, - ); - my $out; - lives_ok { $out = $obj->translate; } "Translate ran"; - ok $out ne "" ,"Produced something!"; - eq_or_diff - $out, - do { local (@ARGV, $/) = "$Bin/data/template/testresult_basic.txt"; <> }, - "Output looks right" - ; + my $obj; + $obj = SQL::Translator->new( + show_warnings => 0, + from => "XML-SQLFairy", + filename => "$Bin/data/xml/schema.xml", + to => "TTSchema", + producer_args => { + ttfile => "$Bin/data/template/basic.tt", + tt_vars => { + foo => 'bar', + hello => 'world', + }, + }, + ); + my $out; + lives_ok { $out = $obj->translate; } "Translate ran"; + ok $out ne "", "Produced something!"; + eq_or_diff $out, do { local (@ARGV, $/) = "$Bin/data/template/testresult_basic.txt"; <> }, "Output looks right"; } # Test passing of Template config { - my $tmpl = q{ + my $tmpl = q{ [%- FOREACH table = schema.get_tables %] Table: $table [%- END %]}; - my $obj; - $obj = SQL::Translator->new( - show_warnings => 0, - from => "XML-SQLFairy", - filename => "$Bin/data/xml/schema.xml", - to => "TTSchema", - producer_args => { - ttfile => \$tmpl, - tt_conf => { - INTERPOLATE => 1, - }, - tt_vars => { - foo => 'bar', - hello => 'world', - }, - }, - ); - my $out; - lives_ok { $out = $obj->translate; } "Translate ran"; - ok $out ne "" ,"Produced something!"; - local $/ = undef; # slurp - eq_or_diff $out, q{ + my $obj; + $obj = SQL::Translator->new( + show_warnings => 0, + from => "XML-SQLFairy", + filename => "$Bin/data/xml/schema.xml", + to => "TTSchema", + producer_args => { + ttfile => \$tmpl, + tt_conf => { + INTERPOLATE => 1, + }, + tt_vars => { + foo => 'bar', + hello => 'world', + }, + }, + ); + my $out; + lives_ok { $out = $obj->translate; } "Translate ran"; + ok $out ne "", "Produced something!"; + local $/ = undef; # slurp + eq_or_diff $out, q{ Table: Basic Table: Another} - ,"Output looks right"; + , "Output looks right"; } diff --git a/t/19sybase-parser.t b/t/19sybase-parser.t index fc9d23928..4ba611a50 100644 --- a/t/19sybase-parser.t +++ b/t/19sybase-parser.t @@ -11,101 +11,100 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(41, 'SQL::Translator::Parser::Sybase'); - SQL::Translator::Parser::Sybase->import('parse'); + maybe_plan(41, 'SQL::Translator::Parser::Sybase'); + SQL::Translator::Parser::Sybase->import('parse'); } my $file = "$Bin/data/sybase/create.sql"; -ok( -e $file, "File exists" ); +ok(-e $file, "File exists"); my $data; { - local $/; - open my $fh, "<$file" or die "Can't read file '$file': $!\n"; - $data = <$fh>; - close $fh; + local $/; + open my $fh, "<$file" or die "Can't read file '$file': $!\n"; + $data = <$fh>; + close $fh; } -ok( $data, 'Data' ); +ok($data, 'Data'); my $t = SQL::Translator->new; my $val = parse($t, $data); -is( $val, 1, 'Parse' ); +is($val, 1, 'Parse'); my $schema = $t->schema; -isa_ok( $schema, 'SQL::Translator::Schema', 'Schema' ); +isa_ok($schema, 'SQL::Translator::Schema', 'Schema'); -is( $schema->is_valid, 1, 'Schema is valid' ); +is($schema->is_valid, 1, 'Schema is valid'); my @tables = $schema->get_tables; -is( scalar @tables, 9, 'Nine tables' ); +is(scalar @tables, 9, 'Nine tables'); { - my $t = $schema->get_table( 'jdbc_function_escapes' ); - isa_ok( $t, 'SQL::Translator::Schema::Table', 'Table' ); - is( $t->name, 'jdbc_function_escapes', "Name = 'jdbc_function_escapes'" ); - - my @fields = $t->get_fields; - is( scalar @fields, 2, 'Two fields' ); - - is( $fields[0]->name, 'escape_name', "First field name is 'escape_name'" ); - is( $fields[0]->data_type, 'varchar', "First field is 'varchar'" ); - is( $fields[0]->size, 40, "First field size is '40'" ); - is( $fields[0]->is_nullable, 0, "First field cannot be null" ); - - is( $fields[1]->name, 'map_string', "Second field name is 'map_string'" ); - is( $fields[1]->data_type, 'varchar', "Second field is 'varchar'" ); - is( $fields[1]->size, 40, "Second field size is '40'" ); - is( $fields[1]->is_nullable, 0, "Second field cannot be null" ); + my $t = $schema->get_table('jdbc_function_escapes'); + isa_ok($t, 'SQL::Translator::Schema::Table', 'Table'); + is($t->name, 'jdbc_function_escapes', "Name = 'jdbc_function_escapes'"); + + my @fields = $t->get_fields; + is(scalar @fields, 2, 'Two fields'); + + is($fields[0]->name, 'escape_name', "First field name is 'escape_name'"); + is($fields[0]->data_type, 'varchar', "First field is 'varchar'"); + is($fields[0]->size, 40, "First field size is '40'"); + is($fields[0]->is_nullable, 0, "First field cannot be null"); + + is($fields[1]->name, 'map_string', "Second field name is 'map_string'"); + is($fields[1]->data_type, 'varchar', "Second field is 'varchar'"); + is($fields[1]->size, 40, "Second field size is '40'"); + is($fields[1]->is_nullable, 0, "Second field cannot be null"); } { - my $t = $schema->get_table( 'spt_jtext' ); - isa_ok( $t, 'SQL::Translator::Schema::Table', 'Table' ); - is( $t->name, 'spt_jtext', "Name = 'spt_jtext'" ); + my $t = $schema->get_table('spt_jtext'); + isa_ok($t, 'SQL::Translator::Schema::Table', 'Table'); + is($t->name, 'spt_jtext', "Name = 'spt_jtext'"); - my @fields = $t->get_fields; - is( scalar @fields, 2, 'Two fields' ); + my @fields = $t->get_fields; + is(scalar @fields, 2, 'Two fields'); - is( $fields[0]->name, 'mdinfo', "First field name is 'mdinfo'" ); - is( $fields[0]->data_type, 'varchar', "First field is 'varchar'" ); - is( $fields[0]->size, 30, "First field size is '30'" ); - is( $fields[0]->is_nullable, 0, "First field cannot be null" ); + is($fields[0]->name, 'mdinfo', "First field name is 'mdinfo'"); + is($fields[0]->data_type, 'varchar', "First field is 'varchar'"); + is($fields[0]->size, 30, "First field size is '30'"); + is($fields[0]->is_nullable, 0, "First field cannot be null"); - is( $fields[1]->name, 'value', "Second field name is 'value'" ); - is( $fields[1]->data_type, 'text', "Second field is 'text'" ); - is( $fields[1]->size, 0, "Second field size is '0'" ); - is( $fields[1]->is_nullable, 0, "Second field cannot be null" ); + is($fields[1]->name, 'value', "Second field name is 'value'"); + is($fields[1]->data_type, 'text', "Second field is 'text'"); + is($fields[1]->size, 0, "Second field size is '0'"); + is($fields[1]->is_nullable, 0, "Second field cannot be null"); - my @constraints = $t->get_constraints; - is( scalar @constraints, 1, 'One constraint' ); + my @constraints = $t->get_constraints; + is(scalar @constraints, 1, 'One constraint'); - is( $constraints[0]->type, UNIQUE, 'Constraint is UNIQUE' ); - is( join(',', $constraints[0]->fields), 'mdinfo', 'On "mdinfo"' ); + is($constraints[0]->type, UNIQUE, 'Constraint is UNIQUE'); + is(join(',', $constraints[0]->fields), 'mdinfo', 'On "mdinfo"'); } { - my $t = $schema->get_table( 'spt_mda' ); - isa_ok( $t, 'SQL::Translator::Schema::Table', 'Table' ); - is( $t->name, 'spt_mda', "Name = 'spt_mda'" ); + my $t = $schema->get_table('spt_mda'); + isa_ok($t, 'SQL::Translator::Schema::Table', 'Table'); + is($t->name, 'spt_mda', "Name = 'spt_mda'"); - my @fields = $t->get_fields; - is( scalar @fields, 7, 'Seven fields' ); + my @fields = $t->get_fields; + is(scalar @fields, 7, 'Seven fields'); - is( $fields[0]->name, 'mdinfo', "First field name is 'mdinfo'" ); - is( $fields[0]->data_type, 'varchar', "First field is 'varchar'" ); - is( $fields[0]->size, 30, "First field size is '30'" ); - is( $fields[0]->is_nullable, 0, "First field cannot be null" ); + is($fields[0]->name, 'mdinfo', "First field name is 'mdinfo'"); + is($fields[0]->data_type, 'varchar', "First field is 'varchar'"); + is($fields[0]->size, 30, "First field size is '30'"); + is($fields[0]->is_nullable, 0, "First field cannot be null"); - my @constraints = $t->get_constraints; - is( scalar @constraints, 1, 'One constraint' ); + my @constraints = $t->get_constraints; + is(scalar @constraints, 1, 'One constraint'); - is( $constraints[0]->type, UNIQUE, 'Constraint is UNIQUE' ); - is( join(',', $constraints[0]->fields), - 'mdinfo,mdaver_end,srvver_end', 'On "mdinfo,mdaver_end,srvver_end"' ); + is($constraints[0]->type, UNIQUE, 'Constraint is UNIQUE'); + is(join(',', $constraints[0]->fields), 'mdinfo,mdaver_end,srvver_end', 'On "mdinfo,mdaver_end,srvver_end"'); } diff --git a/t/20format_X_name.t b/t/20format_X_name.t index 06af54cd4..2a29c7462 100644 --- a/t/20format_X_name.t +++ b/t/20format_X_name.t @@ -9,72 +9,51 @@ use Test::More tests => 25; my ($tr, $ret); my %format_X_name = ( - format_table_name => sub { "table_$_[0]" }, - format_package_name => sub { "package_$_[0]" }, - format_fk_name => sub { "fk_$_[0]" }, - format_pk_name => sub { "pk_$_[0]" }, + format_table_name => sub {"table_$_[0]"}, + format_package_name => sub {"package_$_[0]"}, + format_fk_name => sub {"fk_$_[0]"}, + format_pk_name => sub {"pk_$_[0]"}, ); ok($tr = SQL::Translator->new); -is(($ret = $tr->format_table_name("foo")), "foo", - '$tr->format_table_name("foo") == "foo"'); -is(($ret = $tr->format_package_name("foo")), "foo", - '$tr->format_package_name("foo") == "foo"'); -is(($ret = $tr->format_fk_name("foo")), "foo", - '$tr->format_fk_name("foo") == "foo"'); -is(($ret = $tr->format_pk_name("foo")), "foo", - '$tr->format_pk_name("foo") == "foo"'); - -ok($tr->format_table_name($format_X_name{format_table_name}), - '$tr->format_table_name(sub { "table_$_[0]" })'); -is(($ret = $tr->format_table_name("foo")), "table_foo", - '$tr->format_table_name("foo") == "table_foo"'); - -ok($tr->format_package_name($format_X_name{format_package_name}), - '$tr->format_package_name(sub { "package_$_[0]" })'); -is(($ret = $tr->format_package_name("foo")), "package_foo", - '$tr->format_package_name("foo") == "package_foo"'); - -ok($tr->format_fk_name($format_X_name{format_fk_name}), - '$tr->format_fk_name(sub { "fk_$_[0]" })'); -is(($ret = $tr->format_fk_name("foo")), "fk_foo", - '$tr->format_fk_name("foo") == "fk_foo"'); - -ok($tr->format_pk_name($format_X_name{format_pk_name}), - '$tr->format_pk_name(sub { "pk_$_[0]" })'); -is(($ret = $tr->format_pk_name("foo")), "pk_foo", - '$tr->format_pk_name("foo") == "pk_foo"'); - - -ok($tr->format_table_name($format_X_name{format_table_name}), - '$tr->format_table_name(sub { "table_$_[0]" })'); -is(($ret = $tr->format_table_name("foo")), "table_foo", - '$tr->format_table_name("foo") == "table_foo"'); - -ok($tr->format_package_name($format_X_name{format_package_name}), - '$tr->format_package_name(sub { "package_$_[0]" })'); -is(($ret = $tr->format_package_name("foo")), "package_foo", - '$tr->format_package_name("foo") == "package_foo"'); - -ok($tr->format_fk_name($format_X_name{format_fk_name}), - '$tr->format_fk_name(sub { "fk_$_[0]" })'); -is(($ret = $tr->format_fk_name("foo")), "fk_foo", - '$tr->format_fk_name("foo") == "fk_foo"'); - -ok($tr->format_pk_name($format_X_name{format_pk_name}), - '$tr->format_pk_name(sub { "pk_$_[0]" })'); -is(($ret = $tr->format_pk_name("foo")), "pk_foo", - '$tr->format_pk_name("foo") == "pk_foo"'); - -is(($ret = $tr->format_table_name($format_X_name{format_table_name}, "foo")), "table_foo", - '$tr->format_table_name(sub { "table_$_[0]" }, "foo") == "table_foo"'); - -is(($ret = $tr->format_package_name($format_X_name{format_package_name}, "foo")), "package_foo", - '$tr->format_package_name(sub { "package_$_[0]" }, "foo") == "package_foo"'); - -is(($ret = $tr->format_fk_name($format_X_name{format_fk_name}, "foo")), "fk_foo", - '$tr->format_fk_name(sub { "fk_$_[0]" }, "foo") == "fk_foo"'); - -is(($ret = $tr->format_pk_name($format_X_name{format_pk_name}, "foo")), "pk_foo", - '$tr->format_pk_name(sub { "pk_$_[0]" }, "foo") == "pk_foo"'); +is(($ret = $tr->format_table_name("foo")), "foo", '$tr->format_table_name("foo") == "foo"'); +is(($ret = $tr->format_package_name("foo")), "foo", '$tr->format_package_name("foo") == "foo"'); +is(($ret = $tr->format_fk_name("foo")), "foo", '$tr->format_fk_name("foo") == "foo"'); +is(($ret = $tr->format_pk_name("foo")), "foo", '$tr->format_pk_name("foo") == "foo"'); + +ok($tr->format_table_name($format_X_name{format_table_name}), '$tr->format_table_name(sub { "table_$_[0]" })'); +is(($ret = $tr->format_table_name("foo")), "table_foo", '$tr->format_table_name("foo") == "table_foo"'); + +ok($tr->format_package_name($format_X_name{format_package_name}), '$tr->format_package_name(sub { "package_$_[0]" })'); +is(($ret = $tr->format_package_name("foo")), "package_foo", '$tr->format_package_name("foo") == "package_foo"'); + +ok($tr->format_fk_name($format_X_name{format_fk_name}), '$tr->format_fk_name(sub { "fk_$_[0]" })'); +is(($ret = $tr->format_fk_name("foo")), "fk_foo", '$tr->format_fk_name("foo") == "fk_foo"'); + +ok($tr->format_pk_name($format_X_name{format_pk_name}), '$tr->format_pk_name(sub { "pk_$_[0]" })'); +is(($ret = $tr->format_pk_name("foo")), "pk_foo", '$tr->format_pk_name("foo") == "pk_foo"'); + +ok($tr->format_table_name($format_X_name{format_table_name}), '$tr->format_table_name(sub { "table_$_[0]" })'); +is(($ret = $tr->format_table_name("foo")), "table_foo", '$tr->format_table_name("foo") == "table_foo"'); + +ok($tr->format_package_name($format_X_name{format_package_name}), '$tr->format_package_name(sub { "package_$_[0]" })'); +is(($ret = $tr->format_package_name("foo")), "package_foo", '$tr->format_package_name("foo") == "package_foo"'); + +ok($tr->format_fk_name($format_X_name{format_fk_name}), '$tr->format_fk_name(sub { "fk_$_[0]" })'); +is(($ret = $tr->format_fk_name("foo")), "fk_foo", '$tr->format_fk_name("foo") == "fk_foo"'); + +ok($tr->format_pk_name($format_X_name{format_pk_name}), '$tr->format_pk_name(sub { "pk_$_[0]" })'); +is(($ret = $tr->format_pk_name("foo")), "pk_foo", '$tr->format_pk_name("foo") == "pk_foo"'); + +is(($ret = $tr->format_table_name($format_X_name{format_table_name}, "foo")), + "table_foo", '$tr->format_table_name(sub { "table_$_[0]" }, "foo") == "table_foo"'); + +is(($ret = $tr->format_package_name($format_X_name{format_package_name}, "foo")), + "package_foo", '$tr->format_package_name(sub { "package_$_[0]" }, "foo") == "package_foo"'); + +is(($ret = $tr->format_fk_name($format_X_name{format_fk_name}, "foo")), + "fk_foo", '$tr->format_fk_name(sub { "fk_$_[0]" }, "foo") == "fk_foo"'); + +is(($ret = $tr->format_pk_name($format_X_name{format_pk_name}, "foo")), + "pk_foo", '$tr->format_pk_name(sub { "pk_$_[0]" }, "foo") == "pk_foo"'); diff --git a/t/23json.t b/t/23json.t index c1773a375..559a7598b 100644 --- a/t/23json.t +++ b/t/23json.t @@ -7,11 +7,7 @@ use SQL::Translator; use FindBin '$Bin'; BEGIN { - maybe_plan( - 2, - 'SQL::Translator::Parser::SQLite', - 'SQL::Translator::Producer::JSON', - ); + maybe_plan(2, 'SQL::Translator::Parser::SQLite', 'SQL::Translator::Producer::JSON',); } my $sqlt_version = $SQL::Translator::VERSION; @@ -305,16 +301,16 @@ open my $fh, '<', $file or die "Can't read '$file': $!\n"; local $/; my $data = <$fh>; my $tr = SQL::Translator->new( - parser => 'SQLite', - producer => 'JSON', - producer_args => { - canonical => 1, - pretty => 1, - totally_bogus_arg_to_test_arg_filtering_to_json => 1, - }, - data => $data, + parser => 'SQLite', + producer => 'JSON', + producer_args => { + canonical => 1, + pretty => 1, + totally_bogus_arg_to_test_arg_filtering_to_json => 1, + }, + data => $data, ); my $out; -lives_ok { $out = from_json( $tr->translate ) } 'Translate SQLite to JSON'; -is_deeply( $out, $json, 'JSON matches expected' ); +lives_ok { $out = from_json($tr->translate) } 'Translate SQLite to JSON'; +is_deeply($out, $json, 'JSON matches expected'); diff --git a/t/24yaml.t b/t/24yaml.t index 7ad702ce7..db401890e 100644 --- a/t/24yaml.t +++ b/t/24yaml.t @@ -7,9 +7,7 @@ use SQL::Translator; use FindBin '$Bin'; BEGIN { - maybe_plan(2, - 'SQL::Translator::Parser::SQLite', - 'SQL::Translator::Producer::YAML'); + maybe_plan(2, 'SQL::Translator::Parser::SQLite', 'SQL::Translator::Producer::YAML'); } my $sqlt_version = $SQL::Translator::VERSION; @@ -247,11 +245,11 @@ open FH, "<$file" or die "Can't read '$file': $!\n"; local $/; my $data = ; my $tr = SQL::Translator->new( - parser => 'SQLite', - producer => 'YAML', - data => $data, + parser => 'SQLite', + producer => 'YAML', + data => $data, ); my $out; lives_ok { $out = Load($tr->translate) } 'Translate SQLite to YAML'; -is_deeply( $out, $yaml, 'YAML matches expected' ); +is_deeply($out, $yaml, 'YAML matches expected'); diff --git a/t/26sybase.t b/t/26sybase.t index b9f0a5d32..ea2e2f4e1 100644 --- a/t/26sybase.t +++ b/t/26sybase.t @@ -3,9 +3,7 @@ use Test::More; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan(3, - 'SQL::Translator::Parser::DBI::Sybase', - ); + maybe_plan(3, 'SQL::Translator::Parser::DBI::Sybase',); } use_ok('SQL::Translator::Parser::DBI::Sybase'); diff --git a/t/27sqlite-parser.t b/t/27sqlite-parser.t index 043829f31..f9aa78ff9 100644 --- a/t/27sqlite-parser.t +++ b/t/27sqlite-parser.t @@ -4,98 +4,91 @@ use strict; use Test::More; use Test::SQL::Translator qw(maybe_plan); -use FindBin qw/$Bin/; +use FindBin qw/$Bin/; use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(26, - 'SQL::Translator::Parser::SQLite'); + maybe_plan(26, 'SQL::Translator::Parser::SQLite'); } SQL::Translator::Parser::SQLite->import('parse'); my $file = "$Bin/data/sqlite/create.sql"; { - local $/; - open my $fh, "<$file" or die "Can't read file '$file': $!\n"; - my $data = <$fh>; - my $t = SQL::Translator->new; - parse($t, $data); - - my $schema = $t->schema; - - my @tables = $schema->get_tables; - is( scalar @tables, 2, 'Parsed two tables' ); - - my $t1 = shift @tables; - is( $t1->name, 'person', "'Person' table" ); - is_deeply( [ $t1->comments ], - [ q(table comment 1), - q(table comment 2), - q(table comment 3) - ], 'person table comments' ); - - my @fields = $t1->get_fields; - is( scalar @fields, 6, 'Six fields in "person" table'); - my $fld1 = shift @fields; - is( $fld1->name, 'person_id', 'First field is "person_id"'); - is( $fld1->is_auto_increment, 1, 'Is an autoincrement field'); - - my $t2 = shift @tables; - is( $t2->name, 'pet', "'Pet' table" ); - - my @constraints = $t2->get_constraints; - is( scalar @constraints, 3, '3 constraints on pet' ); - - my $c1 = pop @constraints; - is( $c1->type, 'FOREIGN KEY', 'FK constraint' ); - is( $c1->reference_table, 'person', 'References person table' ); - is( join(',', $c1->reference_fields), 'person_id', - 'References person_id field' ); - - my @views = $schema->get_views; - is( scalar @views, 1, 'Parsed one views' ); - - my @triggers = $schema->get_triggers; - is( scalar @triggers, 1, 'Parsed one triggers' ); + local $/; + open my $fh, "<$file" or die "Can't read file '$file': $!\n"; + my $data = <$fh>; + my $t = SQL::Translator->new; + parse($t, $data); + + my $schema = $t->schema; + + my @tables = $schema->get_tables; + is(scalar @tables, 2, 'Parsed two tables'); + + my $t1 = shift @tables; + is($t1->name, 'person', "'Person' table"); + is_deeply([ $t1->comments ], [ q(table comment 1), q(table comment 2), q(table comment 3) ], 'person table comments'); + + my @fields = $t1->get_fields; + is(scalar @fields, 6, 'Six fields in "person" table'); + my $fld1 = shift @fields; + is($fld1->name, 'person_id', 'First field is "person_id"'); + is($fld1->is_auto_increment, 1, 'Is an autoincrement field'); + + my $t2 = shift @tables; + is($t2->name, 'pet', "'Pet' table"); + + my @constraints = $t2->get_constraints; + is(scalar @constraints, 3, '3 constraints on pet'); + + my $c1 = pop @constraints; + is($c1->type, 'FOREIGN KEY', 'FK constraint'); + is($c1->reference_table, 'person', 'References person table'); + is(join(',', $c1->reference_fields), 'person_id', 'References person_id field'); + + my @views = $schema->get_views; + is(scalar @views, 1, 'Parsed one views'); + + my @triggers = $schema->get_triggers; + is(scalar @triggers, 1, 'Parsed one triggers'); } $file = "$Bin/data/sqlite/named.sql"; { - local $/; - open my $fh, "<$file" or die "Can't read file '$file': $!\n"; - my $data = <$fh>; - my $t = SQL::Translator->new; - parse($t, $data); - - my $schema = $t->schema; - - my @tables = $schema->get_tables; - is( scalar @tables, 1, 'Parsed one table' ); - - my $t1 = shift @tables; - is( $t1->name, 'pet', "'Pet' table" ); - - my @constraints = $t1->get_constraints; - is( scalar @constraints, 5, '5 constraints on pet' ); - - my $c1 = $constraints[2]; - is( $c1->type, 'FOREIGN KEY', 'FK constraint' ); - is( $c1->reference_table, 'person', 'References person table' ); - is( $c1->name, 'fk_person_id', 'Constraint name fk_person_id' ); - is( $c1->on_delete, 'RESTRICT', 'On delete restrict' ); - is( $c1->on_update, 'CASCADE', 'On update cascade' ); - is( join(',', $c1->reference_fields), 'person_id', - 'References person_id field' ); - - my $c2 = $constraints[3]; - is( $c2->on_delete, 'SET DEFAULT', 'On delete set default' ); - is( $c2->on_update, 'SET NULL', 'On update set null' ); - - my $c3 = $constraints[4]; - is( $c3->on_update, 'NO ACTION', 'On update no action' ); - is( $c3->on_delete, '', 'On delete not defined' ); + local $/; + open my $fh, "<$file" or die "Can't read file '$file': $!\n"; + my $data = <$fh>; + my $t = SQL::Translator->new; + parse($t, $data); + + my $schema = $t->schema; + + my @tables = $schema->get_tables; + is(scalar @tables, 1, 'Parsed one table'); + + my $t1 = shift @tables; + is($t1->name, 'pet', "'Pet' table"); + + my @constraints = $t1->get_constraints; + is(scalar @constraints, 5, '5 constraints on pet'); + + my $c1 = $constraints[2]; + is($c1->type, 'FOREIGN KEY', 'FK constraint'); + is($c1->reference_table, 'person', 'References person table'); + is($c1->name, 'fk_person_id', 'Constraint name fk_person_id'); + is($c1->on_delete, 'RESTRICT', 'On delete restrict'); + is($c1->on_update, 'CASCADE', 'On update cascade'); + is(join(',', $c1->reference_fields), 'person_id', 'References person_id field'); + + my $c2 = $constraints[3]; + is($c2->on_delete, 'SET DEFAULT', 'On delete set default'); + is($c2->on_update, 'SET NULL', 'On update set null'); + + my $c3 = $constraints[4]; + is($c3->on_update, 'NO ACTION', 'On update no action'); + is($c3->on_delete, '', 'On delete not defined'); } diff --git a/t/29html.t b/t/29html.t index 04fb30c71..4786be74a 100644 --- a/t/29html.t +++ b/t/29html.t @@ -13,11 +13,7 @@ use Test::SQL::Translator qw(maybe_plan); use SQL::Translator; BEGIN { - maybe_plan(5, - 'CGI', - 'HTML::Parser', - 'SQL::Translator::Parser::MySQL', - 'SQL::Translator::Producer::HTML'); + maybe_plan(5, 'CGI', 'HTML::Parser', 'SQL::Translator::Parser::MySQL', 'SQL::Translator::Producer::HTML'); } my ($p, $tables, $classes); @@ -31,35 +27,33 @@ CREATE TABLE foo ( ); |; -my $tr = SQL::Translator->new(parser => 'MySQL', producer => 'HTML'); +my $tr = SQL::Translator->new(parser => 'MySQL', producer => 'HTML'); my $parsed = $tr->translate(data => $create) or die $tr->error; my $status; -eval { - $status = $p->parse($parsed); -}; +eval { $status = $p->parse($parsed); }; if ($@) { - daig $@; - fail("Unable to parse the output!"); + daig $@; + fail("Unable to parse the output!"); } # General ok($parsed, "Parsed table OK"); ok($status, "Parsed HTML OK"); -$p->handler(start => @{$HANDLERS{count_tables}}); +$p->handler(start => @{ $HANDLERS{count_tables} }); $p->parse($parsed); is($tables, 3, "One table in the SQL produces 3 tags"); $tables = $classes = 0; -$p->handler(start => @{$HANDLERS{count_classes}}); +$p->handler(start => @{ $HANDLERS{count_classes} }); $p->parse($parsed); is($classes, 1, "One 'LinkTable' class"); $tables = $classes = 0; -$p->handler(start => @{$HANDLERS{sqlfairy}}); +$p->handler(start => @{ $HANDLERS{sqlfairy} }); $p->parse($parsed); is($classes, 1, "SQLfairy plug is alive and well "); @@ -67,34 +61,37 @@ $tables = $classes = 0; # Handler functions for the parser BEGIN { - %HANDLERS = ( - count_tables => [ - sub { - my $tagname = shift; - $tables++ if ($tagname eq 'table'); - }, 'tagname', - ], - - count_classes => [ - sub { - my ($tagname, $attr) = @_; - if ($tagname eq 'table' && - $attr->{'class'} && - $attr->{'class'} eq 'LinkTable') { - $classes++; - } - }, 'tagname,attr', - ], - - sqlfairy => [ - sub { - my ($tagname, $attr) = @_; - if ($tagname eq 'a' && - $attr->{'href'} && - $attr->{'href'} =~ /sqlfairy/i) { - $classes++; - } - }, 'tagname,attr', - ], - ); + %HANDLERS = ( + count_tables => [ + sub { + my $tagname = shift; + $tables++ if ($tagname eq 'table'); + }, + 'tagname', + ], + + count_classes => [ + sub { + my ($tagname, $attr) = @_; + if ( $tagname eq 'table' + && $attr->{'class'} + && $attr->{'class'} eq 'LinkTable') { + $classes++; + } + }, + 'tagname,attr', + ], + + sqlfairy => [ + sub { + my ($tagname, $attr) = @_; + if ( $tagname eq 'a' + && $attr->{'href'} + && $attr->{'href'} =~ /sqlfairy/i) { + $classes++; + } + }, + 'tagname,attr', + ], + ); } diff --git a/t/30sqlt-new-diff-mysql.t b/t/30sqlt-new-diff-mysql.t index 8e2bfb1d8..9151a84d9 100644 --- a/t/30sqlt-new-diff-mysql.t +++ b/t/30sqlt-new-diff-mysql.t @@ -6,7 +6,7 @@ use warnings; use SQL::Translator; use File::Spec::Functions qw(catfile updir tmpdir); -use FindBin qw($Bin); +use FindBin qw($Bin); use Test::More; use Test::Differences; use Test::SQL::Translator qw(maybe_plan); @@ -19,31 +19,33 @@ use_ok('SQL::Translator::Diff') or die "Cannot continue\n"; my $tr = SQL::Translator->new; -my ( $source_schema, $target_schema ) = map { - my $t = SQL::Translator->new; - $t->parser( 'YAML' ) +my ($source_schema, $target_schema) = map { + my $t = SQL::Translator->new; + $t->parser('YAML') or die $tr->error; - my $out = $t->translate( catfile($Bin, qw/data diff/, $_ ) ) + my $out = $t->translate(catfile($Bin, qw/data diff/, $_)) or die $tr->error; - my $schema = $t->schema; - unless ( $schema->name ) { - $schema->name( $_ ); - } - ($schema); + my $schema = $t->schema; + unless ($schema->name) { + $schema->name($_); + } + ($schema); } (qw( create1.yml create2.yml )); # Test for differences my @out = SQL::Translator::Diff::schema_diff( - $source_schema, 'MySQL', - $target_schema, 'MySQL', - { - no_batch_alters => 1, - sqlt_args => { quote_identifiers => 0 } - } + $source_schema, + 'MySQL', + $target_schema, + 'MySQL', + { + no_batch_alters => 1, + sqlt_args => { quote_identifiers => 0 } + } ); -ok( @out, 'Got a list' ); +ok(@out, 'Got a list'); my $out = join('', @out); @@ -103,11 +105,17 @@ COMMIT; ## END OF DIFF -$out = SQL::Translator::Diff::schema_diff($source_schema, 'MySQL', $target_schema, 'MySQL', - { ignore_index_names => 1, - ignore_constraint_names => 1, - sqlt_args => { quote_identifiers => 0 }, - }); +$out = SQL::Translator::Diff::schema_diff( + $source_schema, + 'MySQL', + $target_schema, + 'MySQL', + { + ignore_index_names => 1, + ignore_constraint_names => 1, + sqlt_args => { quote_identifiers => 0 }, + } +); eq_or_diff($out, <<'## END OF DIFF', "Diff as expected", { context => 1 }); -- Convert schema 'create1.yml' to 'create2.yml':; @@ -147,9 +155,8 @@ COMMIT; ## END OF DIFF - # Test for sameness -$out = SQL::Translator::Diff::schema_diff($source_schema, 'MySQL', $source_schema, 'MySQL' ); +$out = SQL::Translator::Diff::schema_diff($source_schema, 'MySQL', $source_schema, 'MySQL'); eq_or_diff($out, <<'## END OF DIFF', "No differences found", { context => 1 }); -- Convert schema 'create1.yml' to 'create1.yml':; @@ -160,17 +167,17 @@ eq_or_diff($out, <<'## END OF DIFF', "No differences found", { context => 1 }); { my $t = SQL::Translator->new; - $t->parser( 'MySQL' ) - or die $tr->error; - my $out = $t->translate( catfile($Bin, qw/data mysql create.sql/ ) ) - or die $tr->error; + $t->parser('MySQL') + or die $tr->error; + my $out = $t->translate(catfile($Bin, qw/data mysql create.sql/)) + or die $tr->error; - # Lets remove the renamed table so we dont have to change the SQL or other tests +# Lets remove the renamed table so we dont have to change the SQL or other tests $target_schema->drop_table('new_name'); my $schema = $t->schema; - unless ( $schema->name ) { - $schema->name( 'create.sql' ); + unless ($schema->name) { + $schema->name('create.sql'); } # Now lets change the type of one of the 'integer' columns so that it @@ -178,7 +185,8 @@ eq_or_diff($out, <<'## END OF DIFF', "No differences found", { context => 1 }); my $field = $target_schema->get_table('employee')->get_field('employee_id'); $field->data_type('integer'); $field->size(0); - $out = SQL::Translator::Diff::schema_diff($schema, 'MySQL', $target_schema, 'MySQL', { sqlt_args => { quote_identifiers => 0 } } ); + $out = SQL::Translator::Diff::schema_diff($schema, 'MySQL', $target_schema, + 'MySQL', { sqlt_args => { quote_identifiers => 0 } }); eq_or_diff($out, <<'## END OF DIFF', "No differences found", { context => 1 }); -- Convert schema 'create.sql' to 'create2.yml':; @@ -222,7 +230,6 @@ COMMIT; # Test InnoDB stupidness. Have to drop constraints before re-adding them if # they are just alters. - { my $s1 = SQL::Translator::Schema->new; my $s2 = SQL::Translator::Schema->new; @@ -233,24 +240,23 @@ COMMIT; my $t1 = $s1->add_table($target_schema->get_table('employee')); my $t2 = $s2->add_table(dclone($target_schema->get_table('employee'))); - my ($c) = grep { $_->name eq 'FK5302D47D93FE702E_diff' } $t2->get_constraints; $c->on_delete('CASCADE'); $t2->add_constraint( - name => 'new_constraint', - type => 'FOREIGN KEY', - fields => ['employee_id'], + name => 'new_constraint', + type => 'FOREIGN KEY', + fields => ['employee_id'], reference_fields => ['fake'], - reference_table => 'patty', + reference_table => 'patty', ); $t2->add_field( - name => 'new', + name => 'new', data_type => 'int' ); - my $out = SQL::Translator::Diff::schema_diff($s1, 'MySQL', $s2, 'MySQL' ); + my $out = SQL::Translator::Diff::schema_diff($s1, 'MySQL', $s2, 'MySQL'); eq_or_diff($out, <<'## END OF DIFF', "Batch alter of constraints work for InnoDB", { context => 1 }); -- Convert schema 'Schema 1' to 'Schema 2':; @@ -286,23 +292,22 @@ COMMIT; $t2->extra(renamed_from => 'employee'); $s2->add_table($t2); - $t1->add_constraint( - name => 'bar_fk', - type => 'FOREIGN KEY', - fields => ['employee_id'], + name => 'bar_fk', + type => 'FOREIGN KEY', + fields => ['employee_id'], reference_fields => ['id'], - reference_table => 'bar', + reference_table => 'bar', ); $t2->add_constraint( - name => 'foo_fk', - type => 'FOREIGN KEY', - fields => ['employee_id'], + name => 'foo_fk', + type => 'FOREIGN KEY', + fields => ['employee_id'], reference_fields => ['id'], - reference_table => 'foo', + reference_table => 'foo', ); - my $out = SQL::Translator::Diff::schema_diff($s1, 'MySQL', $s2, 'MySQL' ); + my $out = SQL::Translator::Diff::schema_diff($s1, 'MySQL', $s2, 'MySQL'); eq_or_diff($out, <<'## END OF DIFF', "Alter/drop constraints works with rename table", { context => 1 }); -- Convert schema 'Schema 3' to 'Schema 4':; @@ -322,9 +327,7 @@ COMMIT; ## END OF DIFF # Test quoting works too. - $out = SQL::Translator::Diff::schema_diff($s1, 'MySQL', $s2, 'MySQL', - { sqlt_args => { quote_identifiers => 1 } } - ); + $out = SQL::Translator::Diff::schema_diff($s1, 'MySQL', $s2, 'MySQL', { sqlt_args => { quote_identifiers => 1 } }); eq_or_diff($out, <<'## END OF DIFF', "Quoting can be turned on", { context => 1 }); -- Convert schema 'Schema 3' to 'Schema 4':; diff --git a/t/30sqlt-new-diff-pgsql.t b/t/30sqlt-new-diff-pgsql.t index cc881a9ec..3d269ae9d 100644 --- a/t/30sqlt-new-diff-pgsql.t +++ b/t/30sqlt-new-diff-pgsql.t @@ -6,7 +6,7 @@ use warnings; use SQL::Translator; use File::Spec::Functions qw(catfile updir tmpdir); -use FindBin qw($Bin); +use FindBin qw($Bin); use Test::More; use Test::Differences; use Test::SQL::Translator qw(maybe_plan); @@ -19,31 +19,31 @@ use_ok('SQL::Translator::Diff') or die "Cannot continue\n"; my $tr = SQL::Translator->new; -my ( $source_schema, $target_schema ) = map { - my $t = SQL::Translator->new; - $t->parser( 'YAML' ) +my ($source_schema, $target_schema) = map { + my $t = SQL::Translator->new; + $t->parser('YAML') or die $tr->error; - my $out = $t->translate( catfile($Bin, qw/data diff pgsql/, $_ ) ) + my $out = $t->translate(catfile($Bin, qw/data diff pgsql/, $_)) or die $tr->error; - my $schema = $t->schema; - unless ( $schema->name ) { - $schema->name( $_ ); - } - ($schema); + my $schema = $t->schema; + unless ($schema->name) { + $schema->name($_); + } + ($schema); } (qw( create1.yml create2.yml )); # Test for differences my $out = SQL::Translator::Diff::schema_diff( - $source_schema, - 'PostgreSQL', - $target_schema, - 'PostgreSQL', - { - sqlt_args => { - quote_identifiers => 1, - } - } + $source_schema, + 'PostgreSQL', + $target_schema, + 'PostgreSQL', + { + sqlt_args => { + quote_identifiers => 1, + } + } ); eq_or_diff($out, <<'## END OF DIFF', "Diff as expected"); @@ -102,13 +102,18 @@ COMMIT; ## END OF DIFF $out = SQL::Translator::Diff::schema_diff( - $source_schema, 'PostgreSQL', $target_schema, 'PostgreSQL', - { ignore_index_names => 1, - ignore_constraint_names => 1, - sqlt_args => { - quote_identifiers => 0, - } - }); + $source_schema, + 'PostgreSQL', + $target_schema, + 'PostgreSQL', + { + ignore_index_names => 1, + ignore_constraint_names => 1, + sqlt_args => { + quote_identifiers => 0, + } + } +); eq_or_diff($out, <<'## END OF DIFF', "Diff as expected"); -- Convert schema 'create1.yml' to 'create2.yml':; @@ -156,11 +161,8 @@ COMMIT; ## END OF DIFF - # Test for sameness -$out = SQL::Translator::Diff::schema_diff( - $source_schema, 'PostgreSQL', $source_schema, 'PostgreSQL' -); +$out = SQL::Translator::Diff::schema_diff($source_schema, 'PostgreSQL', $source_schema, 'PostgreSQL'); eq_or_diff($out, <<'## END OF DIFF', "No differences found"); -- Convert schema 'create1.yml' to 'create1.yml':; diff --git a/t/30sqlt-new-diff-sqlite.t b/t/30sqlt-new-diff-sqlite.t index 34f6fb1c4..0a79df19e 100644 --- a/t/30sqlt-new-diff-sqlite.t +++ b/t/30sqlt-new-diff-sqlite.t @@ -6,7 +6,7 @@ use warnings; use SQL::Translator; use File::Spec::Functions qw(catfile updir tmpdir); -use FindBin qw($Bin); +use FindBin qw($Bin); use Test::More; use Test::Differences; use Test::SQL::Translator qw(maybe_plan); @@ -15,27 +15,32 @@ plan tests => 4; use_ok('SQL::Translator::Diff') or die "Cannot continue\n"; -my $tr = SQL::Translator->new; +my $tr = SQL::Translator->new; -my ( $source_schema, $target_schema ) = map { - my $t = SQL::Translator->new; - $t->parser( 'YAML' ) +my ($source_schema, $target_schema) = map { + my $t = SQL::Translator->new; + $t->parser('YAML') or die $tr->error; - my $out = $t->translate( catfile($Bin, qw/data diff/, $_ ) ) + my $out = $t->translate(catfile($Bin, qw/data diff/, $_)) or die $tr->error; - my $schema = $t->schema; - unless ( $schema->name ) { - $schema->name( $_ ); - } - ($schema); + my $schema = $t->schema; + unless ($schema->name) { + $schema->name($_); + } + ($schema); } (qw/create1.yml create2.yml/); # Test for differences -my $out = SQL::Translator::Diff::schema_diff( $source_schema, 'SQLite', $target_schema, 'SQLite', - { no_batch_alters => 1, +my $out = SQL::Translator::Diff::schema_diff( + $source_schema, + 'SQLite', + $target_schema, + 'SQLite', + { + no_batch_alters => 1, ignore_missing_methods => 1, - output_db => 'SQLite', + output_db => 'SQLite', } ); @@ -79,12 +84,17 @@ COMMIT; ## END OF DIFF - -$out = SQL::Translator::Diff::schema_diff($source_schema, 'SQLite', $target_schema, 'SQLite', - { ignore_index_names => 1, - ignore_constraint_names => 1, - output_db => 'SQLite', - }); +$out = SQL::Translator::Diff::schema_diff( + $source_schema, + 'SQLite', + $target_schema, + 'SQLite', + { + ignore_index_names => 1, + ignore_constraint_names => 1, + output_db => 'SQLite', + } +); eq_or_diff($out, <<'## END OF DIFF', "Diff as expected"); -- Convert schema 'create1.yml' to 'create2.yml':; @@ -170,7 +180,7 @@ COMMIT; # the main schema object # Test for sameness -$out = SQL::Translator::Diff::schema_diff($source_schema, 'MySQL', $source_schema, 'MySQL' ); +$out = SQL::Translator::Diff::schema_diff($source_schema, 'MySQL', $source_schema, 'MySQL'); eq_or_diff($out, <<'## END OF DIFF', "No differences found"); -- Convert schema 'create1.yml' to 'create1.yml':; diff --git a/t/30sqlt-new-diff.t b/t/30sqlt-new-diff.t index b2e55d72e..26230a692 100644 --- a/t/30sqlt-new-diff.t +++ b/t/30sqlt-new-diff.t @@ -6,7 +6,7 @@ use warnings; use SQL::Translator; use File::Spec::Functions qw(catfile updir tmpdir); -use FindBin qw($Bin); +use FindBin qw($Bin); use Test::More; use Test::Differences; @@ -14,20 +14,20 @@ plan tests => 10; use_ok('SQL::Translator::Diff') or die "Cannot continue\n"; -my $tr = SQL::Translator->new; +my $tr = SQL::Translator->new; -my ( $source_schema, $target_schema ) = map { - my $t = SQL::Translator->new; - $t->parser( 'YAML' ) +my ($source_schema, $target_schema) = map { + my $t = SQL::Translator->new; + $t->parser('YAML') or die $tr->error; - my $out = $t->translate( catfile($Bin, qw/data diff /, $_ ) ) + my $out = $t->translate(catfile($Bin, qw/data diff /, $_)) or die $tr->error; - my $schema = $t->schema; - unless ( $schema->name ) { - $schema->name( $_ ); - } - ($schema); + my $schema = $t->schema; + unless ($schema->name) { + $schema->name($_); + } + ($schema); } (qw/create1.yml create2.yml/); # Test for differences @@ -40,78 +40,66 @@ my $diff = SQL::Translator::Diff->new({ my $diff_hash = make_diff_hash(); -eq_or_diff($diff_hash->{employee}, +eq_or_diff( + $diff_hash->{employee}, { - constraints_to_create => [ 'FK5302D47D93FE702E_diff' ], - constraints_to_drop => [ 'FK5302D47D93FE702E' ], - fields_to_drop => [ 'job_title' ] + constraints_to_create => ['FK5302D47D93FE702E_diff'], + constraints_to_drop => ['FK5302D47D93FE702E'], + fields_to_drop => ['job_title'] }, - "Correct differences correct on employee table"); + "Correct differences correct on employee table" +); -eq_or_diff($diff_hash->{person}, +eq_or_diff( + $diff_hash->{person}, { constraints_to_create => [ 'UC_person_id', 'UC_age_name' ], - constraints_to_drop => [ 'UC_age_name' ], - fields_to_alter => [ - 'person_id person_id', - 'name name', - 'age age', - 'iq iq', - ], - fields_to_create => [ 'is_rock_star' ], - fields_to_rename => [ 'description physical_description' ], - indexes_to_create => [ 'unique_name' ], - indexes_to_drop => [ 'u_name' ], - table_options => [ 'person' ], + constraints_to_drop => ['UC_age_name'], + fields_to_alter => [ 'person_id person_id', 'name name', 'age age', 'iq iq', ], + fields_to_create => ['is_rock_star'], + fields_to_rename => ['description physical_description'], + indexes_to_create => ['unique_name'], + indexes_to_drop => ['u_name'], + table_options => ['person'], }, - "Correct differences correct on person table"); - -eq_or_diff( - [ map { $_->name } @{$diff->tables_to_drop} ], - [ "deleted" ], - "tables_to_drop right" + "Correct differences correct on person table" ); -eq_or_diff( - [ map { $_->name } @{$diff->tables_to_create} ], - [ "added" ], - "tables_to_create right" -); +eq_or_diff([ map { $_->name } @{ $diff->tables_to_drop } ], ["deleted"], "tables_to_drop right"); +eq_or_diff([ map { $_->name } @{ $diff->tables_to_create } ], ["added"], "tables_to_create right"); $diff = SQL::Translator::Diff->new({ - source_schema => $source_schema, - source_db => 'MySQL', - target_schema => $target_schema, - target_db => 'MySQL', + source_schema => $source_schema, + source_db => 'MySQL', + target_schema => $target_schema, + target_db => 'MySQL', ignore_index_names => 1, ignore_constraint_names => 1, })->compute_differences; $diff_hash = make_diff_hash(); -eq_or_diff($diff_hash->{employee}, +eq_or_diff( + $diff_hash->{employee}, { - fields_to_drop => [ 'job_title' ] + fields_to_drop => ['job_title'] }, - "Correct differences correct on employee table"); + "Correct differences correct on employee table" +); -eq_or_diff($diff_hash->{person}, +eq_or_diff( + $diff_hash->{person}, { constraints_to_create => [ 'UC_person_id', 'UC_age_name' ], - constraints_to_drop => [ 'UC_age_name' ], - fields_to_alter => [ - 'person_id person_id', - 'name name', - 'age age', - 'iq iq', - ], - fields_to_create => [ 'is_rock_star' ], - fields_to_rename => [ 'description physical_description' ], - table_options => [ 'person' ], + constraints_to_drop => ['UC_age_name'], + fields_to_alter => [ 'person_id person_id', 'name name', 'age age', 'iq iq', ], + fields_to_create => ['is_rock_star'], + fields_to_rename => ['description physical_description'], + table_options => ['person'], }, - "Correct differences correct on person table"); - + "Correct differences correct on person table" +); # Test for sameness $diff = SQL::Translator::Diff->new({ @@ -125,33 +113,28 @@ $diff_hash = make_diff_hash(); eq_or_diff($diff_hash, {}, "No differences"); -is( @{$diff->tables_to_drop}, 0, "tables_to_drop right"); -is( @{$diff->tables_to_create}, 0, "tables_to_create right"); - +is(@{ $diff->tables_to_drop }, 0, "tables_to_drop right"); +is(@{ $diff->tables_to_create }, 0, "tables_to_create right"); # Turn table_diff_hash into something we can eq_or_diff better sub make_diff_hash { return { map { - my $table = $_; + my $table = $_; my $table_diff = $diff->table_diff_hash->{$table}; my %table_diffs = ( map { my $opt = $table_diff->{$_}; - @$opt ? ( $_ => [ map { - (ref $_||'') eq 'ARRAY' ? "@$_" : - (ref $_) ? $_->name - : "$_"; - } @$opt - ] ) - : () + @$opt + ? ($_ => [ map { (ref $_ || '') eq 'ARRAY' ? "@$_" : (ref $_) ? $_->name : "$_"; } @$opt ]) + : () } keys %$table_diff ); - %table_diffs ? ( $table => \%table_diffs ) : (); + %table_diffs ? ($table => \%table_diffs) : (); } keys %{ $diff->table_diff_hash } }; diff --git a/t/31dumper.t b/t/31dumper.t index 927c82d20..3d657d218 100644 --- a/t/31dumper.t +++ b/t/31dumper.t @@ -9,53 +9,51 @@ use IPC::Open3; use SQL::Translator; use Test::More; use Test::SQL::Translator qw(maybe_plan); -use Symbol qw(gensym); -use Text::ParseWords qw(shellwords); +use Symbol qw(gensym); +use Text::ParseWords qw(shellwords); BEGIN { - maybe_plan( - 5, - 'DBI', - 'SQL::Translator::Parser::SQLite', - 'SQL::Translator::Producer::Dumper' - ); + maybe_plan(5, 'DBI', 'SQL::Translator::Parser::SQLite', 'SQL::Translator::Producer::Dumper'); } -my $db_user = 'nomar'; -my $db_pass = 'gos0X!'; -my $dsn = 'dbi:SQLite:dbname=/tmp/foo'; -my $file = "$Bin/data/sqlite/create.sql"; -my $t = SQL::Translator->new( - from => 'SQLite', - to => 'Dumper', - producer_args => { - skip => 'pet', - skiplike => '', - db_user => $db_user, - db_password => $db_pass, - dsn => $dsn, - } +my $db_user = 'nomar'; +my $db_pass = 'gos0X!'; +my $dsn = 'dbi:SQLite:dbname=/tmp/foo'; +my $file = "$Bin/data/sqlite/create.sql"; +my $t = SQL::Translator->new( + from => 'SQLite', + to => 'Dumper', + producer_args => { + skip => 'pet', + skiplike => '', + db_user => $db_user, + db_password => $db_pass, + dsn => $dsn, + } ); -my $output = $t->translate( $file ); -ok( $output, 'Got dumper script' ); +my $output = $t->translate($file); +ok($output, 'Got dumper script'); -like( $output, qr{DBI->connect\(\s*'$dsn',\s*'$db_user',\s*'$db_pass',}, - 'Script contains correct DSN, db user and password' ); +like( + $output, + qr{DBI->connect\(\s*'$dsn',\s*'$db_user',\s*'$db_pass',}, + 'Script contains correct DSN, db user and password' +); -like( $output, qr/table_name\s*=>\s*'person',/, 'Found "person" table' ); -unlike( $output, qr/table_name\s*=>\s*'pet',/, 'Skipped "pet" table' ); +like($output, qr/table_name\s*=>\s*'person',/, 'Found "person" table'); +unlike($output, qr/table_name\s*=>\s*'pet',/, 'Skipped "pet" table'); -my ( $fh, $filename ) = tempfile( 'XXXXXXXX' ); +my ($fh, $filename) = tempfile('XXXXXXXX'); print $fh $output; close $fh or die "Can't close file '$filename': $!"; my $out; -my $pid = open3( undef, $out, undef, $^X, shellwords($ENV{HARNESS_PERL_SWITCHES}||''), '-cw', $filename ); +my $pid = open3(undef, $out, undef, $^X, shellwords($ENV{HARNESS_PERL_SWITCHES} || ''), '-cw', $filename); my $res = do { local $/; <$out> }; waitpid($pid, 0); -like( $res, qr/syntax OK/, 'Generated script syntax is OK' ); +like($res, qr/syntax OK/, 'Generated script syntax is OK'); unlink $filename; diff --git a/t/32schema-lookups.t b/t/32schema-lookups.t index a60e2671f..f42a5314e 100644 --- a/t/32schema-lookups.t +++ b/t/32schema-lookups.t @@ -11,6 +11,7 @@ use FindBin qw/$Bin/; use Test::More; use Test::SQL::Translator; + #use Test::Exception; use Data::Dumper; use SQL::Translator; @@ -19,94 +20,96 @@ use SQL::Translator::Schema::Constants; # Simple options. -d for debug my %opt; -BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; } + +BEGIN { + map { $opt{$_} = 1 if s/^-// } @ARGV; +} use constant DEBUG => (exists $opt{d} ? 1 : 0); # Setup a (somewaht contrived!) test schema #============================================================================= -my $schema = SQL::Translator::Schema->new( name => "Lookup-tests" ); +my $schema = SQL::Translator::Schema->new(name => "Lookup-tests"); -my $tbl_order = $schema->add_table( name => "Order" ); +my $tbl_order = $schema->add_table(name => "Order"); # Fields $tbl_order->add_field( - name => "order_id", - data_type => "INT", - size => "10", - is_primary_key => 1, + name => "order_id", + data_type => "INT", + size => "10", + is_primary_key => 1, ); $tbl_order->add_field( - name => "customer_id", - data_type => "INT", - size => "10", + name => "customer_id", + data_type => "INT", + size => "10", ); $tbl_order->add_field( - name => "invoice_number", - data_type => "VARCHAR", - size => "20", + name => "invoice_number", + data_type => "VARCHAR", + size => "20", ); $tbl_order->add_field( - name => "notes", - data_type => "TEXT", + name => "notes", + data_type => "TEXT", ); # Constraints $tbl_order->add_constraint( - name => "con_pkey", - type => PRIMARY_KEY, - fields => "order_id", + name => "con_pkey", + type => PRIMARY_KEY, + fields => "order_id", ); $tbl_order->add_constraint( - name => "con_customer_fkey", - type => FOREIGN_KEY, - fields => "customer_id", - reference_table => "Customer", - reference_fields => "customer_id", + name => "con_customer_fkey", + type => FOREIGN_KEY, + fields => "customer_id", + reference_table => "Customer", + reference_fields => "customer_id", ); $tbl_order->add_constraint( - name => "con_unique_invoice", - type => UNIQUE, - fields => "invoice_number", + name => "con_unique_invoice", + type => UNIQUE, + fields => "invoice_number", ); -print STDERR "Test Schema:",Dumper($schema) if DEBUG; -die "Test is schema is invalid! : ".$schema->err unless $schema->is_valid; - +print STDERR "Test Schema:", Dumper($schema) if DEBUG; +die "Test is schema is invalid! : " . $schema->err unless $schema->is_valid; # Testing 1,2,3,.. #============================================================================= -plan( tests => 15 ); +plan(tests => 15); -my (@flds,@cons); +my (@flds, @cons); @flds = $tbl_order->pkey_fields; -is( join(",",@flds), "order_id", "pkey_fields" ); -isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); +is(join(",", @flds), "order_id", "pkey_fields"); +isa_ok($flds[0], "SQL::Translator::Schema::Field"); @flds = $tbl_order->fkey_fields; -is( join(",",@flds), "customer_id", "fkey_fields" ); -isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); +is(join(",", @flds), "customer_id", "fkey_fields"); +isa_ok($flds[0], "SQL::Translator::Schema::Field"); @flds = $tbl_order->nonpkey_fields; -is( join(",",@flds), "customer_id,invoice_number,notes", "nonpkey_fields" ); -isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); -isa_ok( $flds[1], "SQL::Translator::Schema::Field" ); +is(join(",", @flds), "customer_id,invoice_number,notes", "nonpkey_fields"); +isa_ok($flds[0], "SQL::Translator::Schema::Field"); +isa_ok($flds[1], "SQL::Translator::Schema::Field"); @flds = $tbl_order->data_fields; -is( join(",",@flds), "invoice_number,notes", "data_fields" ); -isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); +is(join(",", @flds), "invoice_number,notes", "data_fields"); +isa_ok($flds[0], "SQL::Translator::Schema::Field"); @flds = $tbl_order->unique_fields; -is( join(",",@flds), "invoice_number", "unique_fields" ); -isa_ok( $flds[0], "SQL::Translator::Schema::Field" ); +is(join(",", @flds), "invoice_number", "unique_fields"); +isa_ok($flds[0], "SQL::Translator::Schema::Field"); @cons = $tbl_order->unique_constraints; -is( scalar @cons, 1, "Number of unique_constraints is 1" ); -is( $cons[0]->name, "con_unique_invoice", "unique_constraints" ); +is(scalar @cons, 1, "Number of unique_constraints is 1"); +is($cons[0]->name, "con_unique_invoice", "unique_constraints"); @cons = $tbl_order->fkey_constraints; -is( scalar @cons, 1, "Number of fkey_constraints is 1" ); -is( $cons[0]->name, "con_customer_fkey", "fkey_constraints" ); +is(scalar @cons, 1, "Number of fkey_constraints is 1"); +is($cons[0]->name, "con_customer_fkey", "fkey_constraints"); diff --git a/t/33tt-table-producer.t b/t/33tt-table-producer.t index db87f8309..4db5032b7 100644 --- a/t/33tt-table-producer.t +++ b/t/33tt-table-producer.t @@ -11,17 +11,20 @@ use Test::SQL::Translator qw(maybe_plan); use Data::Dumper; use vars '%opt'; -BEGIN { map { $opt{$_}=1 if s/^-// } @ARGV; } + +BEGIN { + map { $opt{$_} = 1 if s/^-// } @ARGV; +} use constant DEBUG => (exists $opt{d} ? 1 : 0); -use FindBin qw/$Bin/; +use FindBin qw/$Bin/; use File::Temp qw/tempdir/; # Testing 1,2,3,4... #============================================================================= BEGIN { - maybe_plan(8, 'Template 2.20', 'Test::Differences') + maybe_plan(8, 'Template 2.20', 'Test::Differences'); } use Test::Differences; @@ -29,43 +32,39 @@ use SQL::Translator; use SQL::Translator::Producer::TT::Table; # Setup a tmp directory we can output files to. -my $tdir = tempdir( CLEANUP => 1 ); +my $tdir = tempdir(CLEANUP => 1); # Parse the test XML schema my $obj; $obj = SQL::Translator->new( - debug => DEBUG, #$opt{d}, - show_warnings => 1, - add_drop_table => 1, - from => "SQLite", - filename => "$Bin/data/sqlite/create.sql", - to => "TT-Table", - producer_args => { - tt_table => "$Bin/data/template/table.tt", - mk_files => 1, - mk_files_base => "$tdir", - mk_file_ext => "txt", - on_exists => "replace", - }, + debug => DEBUG, #$opt{d}, + show_warnings => 1, + add_drop_table => 1, + from => "SQLite", + filename => "$Bin/data/sqlite/create.sql", + to => "TT-Table", + producer_args => { + tt_table => "$Bin/data/template/table.tt", + mk_files => 1, + mk_files_base => "$tdir", + mk_file_ext => "txt", + on_exists => "replace", + }, ); my $out; -lives_ok { $out = $obj->translate; } "Translate ran"; -ok $out ne "" ,"Produced something!"; +lives_ok { $out = $obj->translate; } "Translate ran"; +ok $out ne "", "Produced something!"; warn $obj->error unless $out; # Normal output looks ok -local $/ = undef; # slurp -eq_or_diff - $out, - do { local (@ARGV, $/) = "$Bin/data/template/testresult_table.txt"; <> }, - "Output looks right" -; +local $/ = undef; # slurp +eq_or_diff $out, do { local (@ARGV, $/) = "$Bin/data/template/testresult_table.txt"; <> }, "Output looks right"; # File output my @files = glob("$tdir/*.txt"); -ok( @files == 2, "Wrote 2 files." ); -is( $files[0], "$tdir/person.txt" , "Wrote person.txt" ); -is( $files[1], "$tdir/pet.txt" , "Wrote pet.txt" ); +ok(@files == 2, "Wrote 2 files."); +is($files[0], "$tdir/person.txt", "Wrote person.txt"); +is($files[1], "$tdir/pet.txt", "Wrote pet.txt"); open(FILE, "$tdir/person.txt") || die "Couldn't open $tdir/person.txt : $!"; eq_or_diff , qq{Table: person @@ -74,7 +73,7 @@ eq_or_diff , qq{Table: person Data Fields: name, age, weight, iq, description } -, "person.txt looks right"; + , "person.txt looks right"; close(FILE); open(FILE, "$tdir/pet.txt") || die "Couldn't open $tdir/pet.txt : $!"; @@ -84,8 +83,9 @@ eq_or_diff , qq{Table: pet Data Fields: name, age } -, "pet.txt looks right"; + , "pet.txt looks right"; close(FILE); print $out if DEBUG; + #print "Debug:", Dumper($obj) if DEBUG; diff --git a/t/34tt-base.t b/t/34tt-base.t index f69f2aa66..b3fcf33a2 100644 --- a/t/34tt-base.t +++ b/t/34tt-base.t @@ -10,35 +10,32 @@ use Test::Exception; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan(4, 'Template 2.20', - 'Test::Differences', - 'SQL::Translator::Parser::XML::SQLFairy') + maybe_plan(4, 'Template 2.20', 'Test::Differences', 'SQL::Translator::Parser::XML::SQLFairy'); } use Test::Differences; use SQL::Translator; use FindBin qw/$Bin/; + # Access to test libs. We want Producer/BaseTest.pm from here. use lib ("$Bin/lib"); - # Parse the test XML schema my $obj; $obj = SQL::Translator->new( - debug => 0, - show_warnings => 0, - add_drop_table => 1, - from => "XML-SQLFairy", - filename => "$Bin/data/xml/schema.xml", - to => "Producer::BaseTest::produce", + debug => 0, + show_warnings => 0, + add_drop_table => 1, + from => "XML-SQLFairy", + filename => "$Bin/data/xml/schema.xml", + to => "Producer::BaseTest::produce", ); my $out; -lives_ok { $out = $obj->translate; } "Translate ran"; -is $obj->error, '' ,"No errors"; -ok $out ne "" ,"Produced something!"; -local $/ = undef; # slurp -eq_or_diff $out, ,"Output looks right"; - +lives_ok { $out = $obj->translate; } "Translate ran"; +is $obj->error, '', "No errors"; +ok $out ne "", "Produced something!"; +local $/ = undef; # slurp +eq_or_diff $out, , "Output looks right"; __DATA__ Hello World diff --git a/t/35-access-parser.t b/t/35-access-parser.t index e372a1d35..659d72e9a 100644 --- a/t/35-access-parser.t +++ b/t/35-access-parser.t @@ -18,85 +18,95 @@ use Test::SQL::Translator qw(maybe_plan table_ok); use SQL::Translator::Parser::Access 'parse'; { - my $tr = SQL::Translator->new; + my $tr = SQL::Translator->new; - my $file = "$Bin/data/access/gdpdm.ddl"; - open FH, "<$file" or die "Can't read '$file': $!\n"; - local $/; - my $data = ; - close FH; - my $val = parse($tr, $data); - ok( $val, 'Parsed OK' ); + my $file = "$Bin/data/access/gdpdm.ddl"; + open FH, "<$file" or die "Can't read '$file': $!\n"; + local $/; + my $data = ; + close FH; + my $val = parse($tr, $data); + ok($val, 'Parsed OK'); - my $schema = $tr->schema; - is( $schema->is_valid, 1, 'Schema is valid' ); - my @tables = $schema->get_tables; - is( scalar @tables, 24, 'Right number of tables (24)' ); + my $schema = $tr->schema; + is($schema->is_valid, 1, 'Schema is valid'); + my @tables = $schema->get_tables; + is(scalar @tables, 24, 'Right number of tables (24)'); - my @tblnames = map {$_->name} @tables; - is_deeply( \@tblnames, - [qw/div_aa_annotation div_allele div_allele_assay div_annotation_type div_exp_entry div_experiment div_generation div_locality div_locus div_marker div_obs_unit div_obs_unit_sample div_passport div_poly_type div_statistic_type div_stock div_stock_parent div_trait div_trait_uom div_treatment div_treatment_uom div_unit_of_measure qtl_trait_ontology qtl_treatment_ontology/] - ,"tables"); + my @tblnames = map { $_->name } @tables; + is_deeply( + \@tblnames, + [ + qw/div_aa_annotation div_allele div_allele_assay div_annotation_type div_exp_entry div_experiment div_generation div_locality div_locus div_marker div_obs_unit div_obs_unit_sample div_passport div_poly_type div_statistic_type div_stock div_stock_parent div_trait div_trait_uom div_treatment div_treatment_uom div_unit_of_measure qtl_trait_ontology qtl_treatment_ontology/ + ], + "tables" + ); - table_ok( $schema->get_table("div_aa_annotation"), { - name => "div_aa_annotation", - fields => [ + table_ok( + $schema->get_table("div_aa_annotation"), + { + name => "div_aa_annotation", + fields => [ { - name => "div_aa_annotation_id", - data_type => "Long Integer", - size => 4, + name => "div_aa_annotation_id", + data_type => "Long Integer", + size => 4, }, { - name => "div_annotation_type_id", - data_type => "Long Integer", - size => 4, + name => "div_annotation_type_id", + data_type => "Long Integer", + size => 4, }, { - name => "div_allele_assay_id", - data_type => "Long Integer", - size => 4, + name => "div_allele_assay_id", + data_type => "Long Integer", + size => 4, }, { - name => "annotation_value", - data_type => "Text", - size => 50, + name => "annotation_value", + data_type => "Text", + size => 50, }, - ], - }); + ], + } + ); - table_ok( $schema->get_table("div_allele"), { - name => "div_allele", - fields => [ + table_ok( + $schema->get_table("div_allele"), + { + name => "div_allele", + fields => [ { - name => "div_allele_id", - data_type => "Long Integer", - size => 4, + name => "div_allele_id", + data_type => "Long Integer", + size => 4, }, { - name => "div_obs_unit_sample_id", - data_type => "Long Integer", - size => 4, + name => "div_obs_unit_sample_id", + data_type => "Long Integer", + size => 4, }, { - name => "div_allele_assay_id", - data_type => "Long Integer", - size => 4, + name => "div_allele_assay_id", + data_type => "Long Integer", + size => 4, }, { - name => "allele_num", - data_type => "Long Integer", - size => 4, + name => "allele_num", + data_type => "Long Integer", + size => 4, }, { - name => "quality", - data_type => "Long Integer", - size => 4, + name => "quality", + data_type => "Long Integer", + size => 4, }, { - name => "value", - data_type => "Text", - size => 50, + name => "value", + data_type => "Text", + size => 50, }, - ], - }); + ], + } + ); } diff --git a/t/36-filters.t b/t/36-filters.t index f69206577..7612e2e8f 100644 --- a/t/36-filters.t +++ b/t/36-filters.t @@ -6,31 +6,30 @@ package SQL::Translator::Filter::Ok; use strict; -sub filter { Test::More::pass( - 'Filter called with args: ' . join ', ', @_ -) } +sub filter { + Test::More::pass('Filter called with args: ' . join ', ', @_); +} # Hack to allow sqlt to see our module as it wasn't loaded from a .pm $INC{'SQL/Translator/Filter/Ok.pm'} = 'lib/SQL/Translator/Filter/Ok.pm'; #============================================================================= # SQL::Translator::Filter::HelloWorld - Test filter in a package -package # hide from cpan +package # hide from cpan SQL::Translator::Filter::HelloWorld; use strict; sub filter { - my ($schema,%args) = (shift,@_); + my ($schema, %args) = (shift, @_); - my $greeting = $args{greeting} || "Hello"; - my $newtable = "${greeting}World"; - $schema->add_table( name => $newtable ); + my $greeting = $args{greeting} || "Hello"; + my $newtable = "${greeting}World"; + $schema->add_table(name => $newtable); } # Hack to allow sqlt to see our module as it wasn't loaded from a .pm -$INC{'SQL/Translator/Filter/HelloWorld.pm'} - = 'lib/SQL/Translator/Filter/HelloWorld.pm'; +$INC{'SQL/Translator/Filter/HelloWorld.pm'} = 'lib/SQL/Translator/Filter/HelloWorld.pm'; #============================================================================= @@ -44,9 +43,12 @@ use Test::SQL::Translator qw(maybe_plan); use Data::Dumper; BEGIN { - maybe_plan(16, 'Template 2.20', 'Test::Differences', - 'SQL::Translator::Parser::YAML', - 'SQL::Translator::Producer::YAML') + maybe_plan( + 16, 'Template 2.20', + 'Test::Differences', + 'SQL::Translator::Parser::YAML', + 'SQL::Translator::Producer::YAML' + ); } use Test::Differences; @@ -64,7 +66,7 @@ schema: }; my $sqlt_version = $SQL::Translator::VERSION; -my $ans_yaml = qq{--- +my $ans_yaml = qq{--- schema: procedures: {} tables: @@ -117,60 +119,63 @@ translator: # Parse the test XML schema my $obj; $obj = SQL::Translator->new( - debug => 0, - show_warnings => 1, - parser => "YAML", - data => $in_yaml, - to => "YAML", - filters => [ - # Check they get called ok - sub { - pass("Filter 1 called"); - isa_ok($_[0],"SQL::Translator::Schema", "Filter 1, arg0 "); - is( $#_, 0, "Filter 1, got no args"); - }, - sub { - pass("Filter 2 called"); - isa_ok($_[0],"SQL::Translator::Schema", "Filter 2, arg0 "); - is( $#_, 0, "Filter 2, got no args"); - }, - - # Sub filter with args - [ sub { - pass("Filter 3 called"); - isa_ok($_[0],"SQL::Translator::Schema", "Filter 3, arg0 "); - is( $#_, 2, "Filter 3, go 2 args"); - is( $_[1], "hello", "Filter 3, arg1=hello"); - is( $_[2], "world", "Filter 3, arg2=world"); - }, - hello => "world" ], - - # Uppercase all the table names. - sub { - my $schema = shift; - foreach ($schema->get_tables) { - $_->name(uc $_->name); - } - }, - - # lowercase all the field names. - sub { - my $schema = shift; - foreach ( map { $_->get_fields } $schema->get_tables ) { - $_->name(lc $_->name); - } - }, - - # Filter from SQL::Translator::Filter::* - 'Ok', - [ 'HelloWorld' ], - [ 'HelloWorld', greeting => 'Gday' ], + debug => 0, + show_warnings => 1, + parser => "YAML", + data => $in_yaml, + to => "YAML", + filters => [ + + # Check they get called ok + sub { + pass("Filter 1 called"); + isa_ok($_[0], "SQL::Translator::Schema", "Filter 1, arg0 "); + is($#_, 0, "Filter 1, got no args"); + }, + sub { + pass("Filter 2 called"); + isa_ok($_[0], "SQL::Translator::Schema", "Filter 2, arg0 "); + is($#_, 0, "Filter 2, got no args"); + }, + + # Sub filter with args + [ + sub { + pass("Filter 3 called"); + isa_ok($_[0], "SQL::Translator::Schema", "Filter 3, arg0 "); + is($#_, 2, "Filter 3, go 2 args"); + is($_[1], "hello", "Filter 3, arg1=hello"); + is($_[2], "world", "Filter 3, arg2=world"); + }, + hello => "world" ], -) or die "Failed to create translator object: ".SQL::Translator->error; + # Uppercase all the table names. + sub { + my $schema = shift; + foreach ($schema->get_tables) { + $_->name(uc $_->name); + } + }, + + # lowercase all the field names. + sub { + my $schema = shift; + foreach (map { $_->get_fields } $schema->get_tables) { + $_->name(lc $_->name); + } + }, + + # Filter from SQL::Translator::Filter::* + 'Ok', + ['HelloWorld'], + [ 'HelloWorld', greeting => 'Gday' ], + ], + +) or die "Failed to create translator object: " . SQL::Translator->error; my $out; -lives_ok { $out = $obj->translate; } "Translate ran"; -is $obj->error, '' ,"No errors"; -ok $out ne "" ,"Produced something!"; -eq_or_diff $out, $ans_yaml ,"Output looks right"; +lives_ok { $out = $obj->translate; } "Translate ran"; +is $obj->error, '', "No errors"; +ok $out ne "", "Produced something!"; +eq_or_diff $out, $ans_yaml, "Output looks right"; diff --git a/t/38-filter-names.t b/t/38-filter-names.t index 4edd79343..9ff4f7fdd 100644 --- a/t/38-filter-names.t +++ b/t/38-filter-names.t @@ -12,7 +12,7 @@ use Test::SQL::Translator qw(maybe_plan); use Data::Dumper; BEGIN { - maybe_plan(4, 'YAML', 'Test::Differences') + maybe_plan(4, 'YAML', 'Test::Differences'); } use Test::Differences; use SQL::Translator; @@ -67,26 +67,31 @@ translator: # Parse the test schema my $obj; $obj = SQL::Translator->new( - debug => 0, - show_warnings => 1, - from => "YAML", - to => "YAML", - data => $in_yaml, - filters => [ - # Filter from SQL::Translator::Filter::* - [ 'Names', { - tables => 'lc', - fields => 'ucfirst', - } ], + debug => 0, + show_warnings => 1, + from => "YAML", + to => "YAML", + data => $in_yaml, + filters => [ + + # Filter from SQL::Translator::Filter::* + [ + 'Names', + { + tables => 'lc', + fields => 'ucfirst', + } ], + ], -) or die "Failed to create translator object: ".SQL::Translator->error; +) or die "Failed to create translator object: " . SQL::Translator->error; my $out; -lives_ok { $out = $obj->translate; } "Translate ran"; -is $obj->error, '' ,"No errors"; -ok $out ne "" ,"Produced something!"; +lives_ok { $out = $obj->translate; } "Translate ran"; +is $obj->error, '', "No errors"; +ok $out ne "", "Produced something!"; + # Somewhat hackishly modify the yaml with a regex to avoid # failing randomly on every change of version. $out =~ s/version: .*/version: SUPPRESSED/; -eq_or_diff $out, $ans_yaml ,"Output looks right"; +eq_or_diff $out, $ans_yaml, "Output looks right"; diff --git a/t/38-mysql-producer.t b/t/38-mysql-producer.t index 8b03c50d7..9b0c3498e 100644 --- a/t/38-mysql-producer.t +++ b/t/38-mysql-producer.t @@ -19,18 +19,14 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(79, - 'YAML', - 'SQL::Translator::Producer::MySQL', - 'Test::Differences', - ) + maybe_plan(79, 'YAML', 'SQL::Translator::Producer::MySQL', 'Test::Differences',); } use Test::Differences; use SQL::Translator; # Main test. { -my $yaml_in = <new( + show_warnings => 1, + no_comments => 1, - my $sqlt; - $sqlt = SQL::Translator->new( - show_warnings => 1, - no_comments => 1, -# debug => 1, - from => "YAML", - to => "MySQL", - quote_table_names => 1, - quote_field_names => 1 - ); + # debug => 1, + from => "YAML", + to => "MySQL", + quote_table_names => 1, + quote_field_names => 1 + ); - my $out = $sqlt->translate(\$yaml_in) - or die "Translate error:".$sqlt->error; - ok $out ne "", "Produced something!"; - eq_or_diff $out, $mysql_out, "Scalar output looks right with quoting"; + my $out = $sqlt->translate(\$yaml_in) + or die "Translate error:" . $sqlt->error; + ok $out ne "", "Produced something!"; + eq_or_diff $out, $mysql_out, "Scalar output looks right with quoting"; - my @out = $sqlt->translate(\$yaml_in) - or die "Translat eerror:".$sqlt->error; - is_deeply \@out, \@stmts_no_drop, "Array output looks right with quoting"; + my @out = $sqlt->translate(\$yaml_in) + or die "Translat eerror:" . $sqlt->error; + is_deeply \@out, \@stmts_no_drop, "Array output looks right with quoting"; - $sqlt->quote_identifiers(0); + $sqlt->quote_identifiers(0); - $out = $sqlt->translate(\$yaml_in) - or die "Translate error:".$sqlt->error; + $out = $sqlt->translate(\$yaml_in) + or die "Translate error:" . $sqlt->error; - @out = $sqlt->translate(\$yaml_in) - or die "Translate error:".$sqlt->error; - $mysql_out =~ s/`//g; - my @unquoted_stmts = map { s/`//g; $_} @stmts_no_drop; - eq_or_diff $out, $mysql_out, "Output looks right without quoting"; - is_deeply \@out, \@unquoted_stmts, "Array output looks right without quoting"; + @out = $sqlt->translate(\$yaml_in) + or die "Translate error:" . $sqlt->error; + $mysql_out =~ s/`//g; + my @unquoted_stmts = map { s/`//g; $_ } @stmts_no_drop; + eq_or_diff $out, $mysql_out, "Output looks right without quoting"; + is_deeply \@out, \@unquoted_stmts, "Array output looks right without quoting"; - $sqlt->quote_identifiers(1); - $sqlt->add_drop_table(1); + $sqlt->quote_identifiers(1); + $sqlt->add_drop_table(1); - @out = $sqlt->translate(\$yaml_in) - or die "Translat eerror:".$sqlt->error; - $out = $sqlt->translate(\$yaml_in) - or die "Translat eerror:".$sqlt->error; + @out = $sqlt->translate(\$yaml_in) + or die "Translat eerror:" . $sqlt->error; + $out = $sqlt->translate(\$yaml_in) + or die "Translat eerror:" . $sqlt->error; - eq_or_diff $out, join(";\n\n", @stmts) . ";\n\n", "Output looks right with DROP TABLEs"; - is_deeply \@out, \@stmts, "Array output looks right with DROP TABLEs"; + eq_or_diff $out, join(";\n\n", @stmts) . ";\n\n", "Output looks right with DROP TABLEs"; + is_deeply \@out, \@stmts, "Array output looks right with DROP TABLEs"; } ############################################################################### # New alter/add subs { -my $table = SQL::Translator::Schema::Table->new( name => 'mytable'); - -my $field1 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); - -my $field1_sql = SQL::Translator::Producer::MySQL::create_field($field1); - -is($field1_sql, 'myfield VARCHAR(10) NULL', 'Create field works'); - -my $field2 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 25, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - -my $alter_field = SQL::Translator::Producer::MySQL::alter_field($field1, - $field2); -is($alter_field, 'ALTER TABLE mytable CHANGE COLUMN myfield myfield VARCHAR(25) NOT NULL', 'Alter field works'); - -my $add_field = SQL::Translator::Producer::MySQL::add_field($field1); - -is($add_field, 'ALTER TABLE mytable ADD COLUMN myfield VARCHAR(10) NULL', 'Add field works'); - -my $drop_field = SQL::Translator::Producer::MySQL::drop_field($field2); -is($drop_field, 'ALTER TABLE mytable DROP COLUMN myfield', 'Drop field works'); - -my $field3 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'boolean', - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - -my $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 4.1 }); -is($field3_sql, 'myfield boolean NOT NULL', 'For Mysql >= 4, use boolean type'); -$field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 3.22 }); -is($field3_sql, "myfield enum('0','1') NOT NULL", 'For Mysql < 4, use enum for boolean type'); -$field3_sql = SQL::Translator::Producer::MySQL::create_field($field3,); -is($field3_sql, "myfield enum('0','1') NOT NULL", 'When no version specified, use enum for boolean type'); - -my $number_sizes = { + my $table = SQL::Translator::Schema::Table->new(name => 'mytable'); + + my $field1 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 + ); + + my $field1_sql = SQL::Translator::Producer::MySQL::create_field($field1); + + is($field1_sql, 'myfield VARCHAR(10) NULL', 'Create field works'); + + my $field2 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 25, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 + ); + + my $alter_field = SQL::Translator::Producer::MySQL::alter_field($field1, $field2); + is($alter_field, 'ALTER TABLE mytable CHANGE COLUMN myfield myfield VARCHAR(25) NOT NULL', 'Alter field works'); + + my $add_field = SQL::Translator::Producer::MySQL::add_field($field1); + + is($add_field, 'ALTER TABLE mytable ADD COLUMN myfield VARCHAR(10) NULL', 'Add field works'); + + my $drop_field = SQL::Translator::Producer::MySQL::drop_field($field2); + is($drop_field, 'ALTER TABLE mytable DROP COLUMN myfield', 'Drop field works'); + + my $field3 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'boolean', + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 + ); + + my $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 4.1 }); + is($field3_sql, 'myfield boolean NOT NULL', 'For Mysql >= 4, use boolean type'); + $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 3.22 }); + is($field3_sql, "myfield enum('0','1') NOT NULL", 'For Mysql < 4, use enum for boolean type'); + $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3,); + is($field3_sql, "myfield enum('0','1') NOT NULL", 'When no version specified, use enum for boolean type'); + + my $number_sizes = { '3, 2' => 'double', - 12 => 'bigint', - 1 => 'tinyint', - 4 => 'int', -}; -for my $size (keys %$number_sizes) { - my $expected = $number_sizes->{$size}; + 12 => 'bigint', + 1 => 'tinyint', + 4 => 'int', + }; + for my $size (keys %$number_sizes) { + my $expected = $number_sizes->{$size}; my $number_field = SQL::Translator::Schema::Field->new( - name => "numberfield_$expected", - table => $table, - data_type => 'number', - size => $size, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 + name => "numberfield_$expected", + table => $table, + data_type => 'number', + size => $size, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 ); is( - SQL::Translator::Producer::MySQL::create_field($number_field), - "numberfield_$expected $expected($size) NULL", - "Use $expected for NUMBER types of size $size" + SQL::Translator::Producer::MySQL::create_field($number_field), + "numberfield_$expected $expected($size) NULL", + "Use $expected for NUMBER types of size $size" ); -} + } -my $varchars; -for my $size (qw/255 256 65535 65536/) { + my $varchars; + for my $size (qw/255 256 65535 65536/) { $varchars->{$size} = SQL::Translator::Schema::Field->new( - name => "vch_$size", - table => $table, - data_type => 'varchar', - size => $size, - is_nullable => 1, + name => "vch_$size", + table => $table, + data_type => 'varchar', + size => $size, + is_nullable => 1, ); -} - + } -is ( + is( SQL::Translator::Producer::MySQL::create_field($varchars->{255}, { mysql_version => 5.000003 }), 'vch_255 varchar(255) NULL', 'VARCHAR(255) is not substituted with TEXT for Mysql >= 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{255}, { mysql_version => 5.0 }), 'vch_255 varchar(255) NULL', 'VARCHAR(255) is not substituted with TEXT for Mysql < 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{255}), 'vch_255 varchar(255) NULL', 'VARCHAR(255) is not substituted with TEXT when no version specified', -); + ); - -is ( + is( SQL::Translator::Producer::MySQL::create_field($varchars->{256}, { mysql_version => 5.000003 }), 'vch_256 varchar(256) NULL', 'VARCHAR(256) is not substituted with TEXT for Mysql >= 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{256}, { mysql_version => 5.0 }), 'vch_256 text NULL', 'VARCHAR(256) is substituted with TEXT for Mysql < 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{256}), 'vch_256 text NULL', 'VARCHAR(256) is substituted with TEXT when no version specified', -); - + ); -is ( + is( SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, { mysql_version => 5.000003 }), 'vch_65535 varchar(65535) NULL', 'VARCHAR(65535) is not substituted with TEXT for Mysql >= 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, { mysql_version => 5.0 }), 'vch_65535 text NULL', 'VARCHAR(65535) is substituted with TEXT for Mysql < 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{65535}), 'vch_65535 text NULL', 'VARCHAR(65535) is substituted with TEXT when no version specified', -); + ); - -is ( + is( SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, { mysql_version => 5.000003 }), 'vch_65536 text NULL', 'VARCHAR(65536) is substituted with TEXT for Mysql >= 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, { mysql_version => 5.0 }), 'vch_65536 text NULL', 'VARCHAR(65536) is substituted with TEXT for Mysql < 5.0.3' -); -is ( + ); + is( SQL::Translator::Producer::MySQL::create_field($varchars->{65536}), 'vch_65536 text NULL', 'VARCHAR(65536) is substituted with TEXT when no version specified', -); + ); + { + my $view1 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', + extra => { + mysql_definer => 'CURRENT_USER', + mysql_algorithm => 'MERGE', + mysql_security => 'DEFINER', + } + ); + my $create_opts = { add_replace_view => 1, no_comments => 1 }; + my $view1_sql1 = SQL::Translator::Producer::MySQL::create_view($view1, $create_opts); -{ - my $view1 = SQL::Translator::Schema::View->new( name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing', - extra => { - mysql_definer => 'CURRENT_USER', - mysql_algorithm => 'MERGE', - mysql_security => 'DEFINER', - }); - my $create_opts = { add_replace_view => 1, no_comments => 1 }; - my $view1_sql1 = SQL::Translator::Producer::MySQL::create_view($view1, $create_opts); - - my $view_sql_replace = <<'EOV'; + my $view_sql_replace = <<'EOV'; CREATE OR REPLACE ALGORITHM = MERGE DEFINER = CURRENT_USER @@ -474,244 +472,250 @@ CREATE OR REPLACE SELECT id, name FROM thing EOV - is($view1_sql1, $view_sql_replace, 'correct "CREATE OR REPLACE VIEW" SQL'); - + is($view1_sql1, $view_sql_replace, 'correct "CREATE OR REPLACE VIEW" SQL'); - my $view2 = SQL::Translator::Schema::View->new( name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing',); - my $create2_opts = { add_replace_view => 0, no_comments => 1 }; - my $view1_sql2 = SQL::Translator::Producer::MySQL::create_view($view2, $create2_opts); - my $view_sql_noreplace = <<'EOV'; + my $view2 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', + ); + my $create2_opts = { add_replace_view => 0, no_comments => 1 }; + my $view1_sql2 = SQL::Translator::Producer::MySQL::create_view($view2, $create2_opts); + my $view_sql_noreplace = <<'EOV'; CREATE VIEW view_foo ( id, name ) AS SELECT id, name FROM thing EOV - is($view1_sql2, $view_sql_noreplace, 'correct "CREATE VIEW" SQL'); + is($view1_sql2, $view_sql_noreplace, 'correct "CREATE VIEW" SQL'); - { - my %extra = $view1->extra; - is_deeply \%extra, - { - 'mysql_algorithm' => 'MERGE', - 'mysql_definer' => 'CURRENT_USER', - 'mysql_security' => 'DEFINER' - }, - 'Extra attributes'; - } + { + my %extra = $view1->extra; + is_deeply \%extra, + { + 'mysql_algorithm' => 'MERGE', + 'mysql_definer' => 'CURRENT_USER', + 'mysql_security' => 'DEFINER' + }, + 'Extra attributes'; + } - $view1->remove_extra(qw/mysql_definer mysql_security/); - { - my %extra = $view1->extra; - is_deeply \%extra, { 'mysql_algorithm' => 'MERGE', }, 'Extra attributes after first reset_extra call'; - } + $view1->remove_extra(qw/mysql_definer mysql_security/); + { + my %extra = $view1->extra; + is_deeply \%extra, { 'mysql_algorithm' => 'MERGE', }, 'Extra attributes after first reset_extra call'; + } - $view1->remove_extra(); - { - my %extra = $view1->extra; - is_deeply \%extra, {}, 'Extra attributes completely removed'; + $view1->remove_extra(); + { + my %extra = $view1->extra; + is_deeply \%extra, {}, 'Extra attributes completely removed'; + } } -} -{ + { # certain types do not support a size, see also: # http://dev.mysql.com/doc/refman/5.1/de/create-table.html for my $type (qw/date time timestamp datetime year/) { - my $field = SQL::Translator::Schema::Field->new( - name => "my$type", - table => $table, - data_type => $type, - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 - ); - my $sql = SQL::Translator::Producer::MySQL::create_field($field); - is($sql, "my$type $type NULL", "Skip length param for type $type"); + my $field = SQL::Translator::Schema::Field->new( + name => "my$type", + table => $table, + data_type => $type, + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 + ); + my $sql = SQL::Translator::Producer::MySQL::create_field($field); + is($sql, "my$type $type NULL", "Skip length param for type $type"); } -} + } -} #non quoted test +} #non quoted test { - #Quoted test - my $table = SQL::Translator::Schema::Table->new( name => 'mydb.mytable'); - - my $field1 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); - - - my $field2 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 25, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - - my $field3 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'boolean', - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - - - my $qt = '`'; - my $qf = '`'; - my $options = { - quote_table_names => $qt, - quote_field_names => $qf, - }; - - - my $alter_field = SQL::Translator::Producer::MySQL::alter_field($field1, $field2, $options); - is($alter_field, 'ALTER TABLE `mydb`.`mytable` CHANGE COLUMN `myfield` `myfield` VARCHAR(25) NOT NULL', 'Alter field works'); - - my $add_field = SQL::Translator::Producer::MySQL::add_field($field1, $options); - - is($add_field, 'ALTER TABLE `mydb`.`mytable` ADD COLUMN `myfield` VARCHAR(10) NULL', 'Add field works'); - - my $drop_field = SQL::Translator::Producer::MySQL::drop_field($field2, $options); - is($drop_field, 'ALTER TABLE `mydb`.`mytable` DROP COLUMN `myfield`', 'Drop field works'); - - my $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 4.1, %$options }); -is($field3_sql, '`myfield` boolean NOT NULL', 'For Mysql >= 4, use boolean type'); -$field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 3.22, %$options }); -is($field3_sql, "`myfield` enum('0','1') NOT NULL", 'For Mysql < 4, use enum for boolean type'); -$field3_sql = SQL::Translator::Producer::MySQL::create_field($field3,$options); -is($field3_sql, "`myfield` enum('0','1') NOT NULL", 'When no version specified, use enum for boolean type'); - - my $number_sizes = { - '3, 2' => 'double', - 12 => 'bigint', - 1 => 'tinyint', - 4 => 'int', - }; - for my $size (keys %$number_sizes) { - my $expected = $number_sizes->{$size}; - my $number_field = SQL::Translator::Schema::Field->new( - name => "numberfield_$expected", - table => $table, - data_type => 'number', - size => $size, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 - ); - - is( - SQL::Translator::Producer::MySQL::create_field($number_field, $options), - "`numberfield_$expected` $expected($size) NULL", - "Use $expected for NUMBER types of size $size" - ); - } - - my $varchars; - for my $size (qw/255 256 65535 65536/) { - $varchars->{$size} = SQL::Translator::Schema::Field->new( - name => "vch_$size", - table => $table, - data_type => 'varchar', - size => $size, - is_nullable => 1, - ); - } - - - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{255}, { mysql_version => 5.000003, %$options }), - '`vch_255` varchar(255) NULL', - 'VARCHAR(255) is not substituted with TEXT for Mysql >= 5.0.3' - ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{255}, { mysql_version => 5.0, %$options }), - '`vch_255` varchar(255) NULL', - 'VARCHAR(255) is not substituted with TEXT for Mysql < 5.0.3' - ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{255}, $options), - '`vch_255` varchar(255) NULL', - 'VARCHAR(255) is not substituted with TEXT when no version specified', + #Quoted test + my $table = SQL::Translator::Schema::Table->new(name => 'mydb.mytable'); + + my $field1 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 + ); + + my $field2 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 25, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 + ); + + my $field3 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'boolean', + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 + ); + + my $qt = '`'; + my $qf = '`'; + my $options = { + quote_table_names => $qt, + quote_field_names => $qf, + }; + + my $alter_field = SQL::Translator::Producer::MySQL::alter_field($field1, $field2, $options); + is( + $alter_field, + 'ALTER TABLE `mydb`.`mytable` CHANGE COLUMN `myfield` `myfield` VARCHAR(25) NOT NULL', + 'Alter field works' + ); + + my $add_field = SQL::Translator::Producer::MySQL::add_field($field1, $options); + + is($add_field, 'ALTER TABLE `mydb`.`mytable` ADD COLUMN `myfield` VARCHAR(10) NULL', 'Add field works'); + + my $drop_field = SQL::Translator::Producer::MySQL::drop_field($field2, $options); + is($drop_field, 'ALTER TABLE `mydb`.`mytable` DROP COLUMN `myfield`', 'Drop field works'); + + my $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 4.1, %$options }); + is($field3_sql, '`myfield` boolean NOT NULL', 'For Mysql >= 4, use boolean type'); + $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, { mysql_version => 3.22, %$options }); + is($field3_sql, "`myfield` enum('0','1') NOT NULL", 'For Mysql < 4, use enum for boolean type'); + $field3_sql = SQL::Translator::Producer::MySQL::create_field($field3, $options); + is($field3_sql, "`myfield` enum('0','1') NOT NULL", 'When no version specified, use enum for boolean type'); + + my $number_sizes = { + '3, 2' => 'double', + 12 => 'bigint', + 1 => 'tinyint', + 4 => 'int', + }; + for my $size (keys %$number_sizes) { + my $expected = $number_sizes->{$size}; + my $number_field = SQL::Translator::Schema::Field->new( + name => "numberfield_$expected", + table => $table, + data_type => 'number', + size => $size, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 ); - - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{256}, { mysql_version => 5.000003, %$options }), - '`vch_256` varchar(256) NULL', - 'VARCHAR(256) is not substituted with TEXT for Mysql >= 5.0.3' - ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{256}, { mysql_version => 5.0, %$options }), - '`vch_256` text NULL', - 'VARCHAR(256) is substituted with TEXT for Mysql < 5.0.3' + is( + SQL::Translator::Producer::MySQL::create_field($number_field, $options), + "`numberfield_$expected` $expected($size) NULL", + "Use $expected for NUMBER types of size $size" ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{256}, $options), - '`vch_256` text NULL', - 'VARCHAR(256) is substituted with TEXT when no version specified', + } + + my $varchars; + for my $size (qw/255 256 65535 65536/) { + $varchars->{$size} = SQL::Translator::Schema::Field->new( + name => "vch_$size", + table => $table, + data_type => 'varchar', + size => $size, + is_nullable => 1, ); + } + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{255}, { mysql_version => 5.000003, %$options }), + '`vch_255` varchar(255) NULL', + 'VARCHAR(255) is not substituted with TEXT for Mysql >= 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{255}, { mysql_version => 5.0, %$options }), + '`vch_255` varchar(255) NULL', + 'VARCHAR(255) is not substituted with TEXT for Mysql < 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{255}, $options), + '`vch_255` varchar(255) NULL', + 'VARCHAR(255) is not substituted with TEXT when no version specified', + ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, { mysql_version => 5.000003, %$options }), - '`vch_65535` varchar(65535) NULL', - 'VARCHAR(65535) is not substituted with TEXT for Mysql >= 5.0.3' - ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, { mysql_version => 5.0, %$options }), - '`vch_65535` text NULL', - 'VARCHAR(65535) is substituted with TEXT for Mysql < 5.0.3' - ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, $options), - '`vch_65535` text NULL', - 'VARCHAR(65535) is substituted with TEXT when no version specified', - ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{256}, { mysql_version => 5.000003, %$options }), + '`vch_256` varchar(256) NULL', + 'VARCHAR(256) is not substituted with TEXT for Mysql >= 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{256}, { mysql_version => 5.0, %$options }), + '`vch_256` text NULL', + 'VARCHAR(256) is substituted with TEXT for Mysql < 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{256}, $options), + '`vch_256` text NULL', + 'VARCHAR(256) is substituted with TEXT when no version specified', + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, { mysql_version => 5.000003, %$options }), + '`vch_65535` varchar(65535) NULL', + 'VARCHAR(65535) is not substituted with TEXT for Mysql >= 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, { mysql_version => 5.0, %$options }), + '`vch_65535` text NULL', + 'VARCHAR(65535) is substituted with TEXT for Mysql < 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{65535}, $options), + '`vch_65535` text NULL', + 'VARCHAR(65535) is substituted with TEXT when no version specified', + ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, { mysql_version => 5.000003, %$options }), - '`vch_65536` text NULL', - 'VARCHAR(65536) is substituted with TEXT for Mysql >= 5.0.3' - ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, { mysql_version => 5.0, %$options }), - '`vch_65536` text NULL', - 'VARCHAR(65536) is substituted with TEXT for Mysql < 5.0.3' - ); - is ( - SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, $options), - '`vch_65536` text NULL', - 'VARCHAR(65536) is substituted with TEXT when no version specified', + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, { mysql_version => 5.000003, %$options }), + '`vch_65536` text NULL', + 'VARCHAR(65536) is substituted with TEXT for Mysql >= 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, { mysql_version => 5.0, %$options }), + '`vch_65536` text NULL', + 'VARCHAR(65536) is substituted with TEXT for Mysql < 5.0.3' + ); + is( + SQL::Translator::Producer::MySQL::create_field($varchars->{65536}, $options), + '`vch_65536` text NULL', + 'VARCHAR(65536) is substituted with TEXT when no version specified', + ); + + { + my $view1 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT `id`, `name` FROM `my`.`thing`', + extra => { + mysql_definer => 'CURRENT_USER', + mysql_algorithm => 'MERGE', + mysql_security => 'DEFINER', + } ); + my $create_opts = { add_replace_view => 1, no_comments => 1, %$options }; + my $view1_sql1 = SQL::Translator::Producer::MySQL::create_view($view1, $create_opts); - { - my $view1 = SQL::Translator::Schema::View->new( name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT `id`, `name` FROM `my`.`thing`', - extra => { - mysql_definer => 'CURRENT_USER', - mysql_algorithm => 'MERGE', - mysql_security => 'DEFINER', - }); - my $create_opts = { add_replace_view => 1, no_comments => 1, %$options }; - my $view1_sql1 = SQL::Translator::Producer::MySQL::create_view($view1, $create_opts); - - my $view_sql_replace = <<'EOV'; + my $view_sql_replace = <<'EOV'; CREATE OR REPLACE ALGORITHM = MERGE DEFINER = CURRENT_USER @@ -720,158 +724,166 @@ CREATE OR REPLACE SELECT `id`, `name` FROM `my`.`thing` EOV - is($view1_sql1, $view_sql_replace, 'correct "CREATE OR REPLACE VIEW" SQL'); - + is($view1_sql1, $view_sql_replace, 'correct "CREATE OR REPLACE VIEW" SQL'); - my $view2 = SQL::Translator::Schema::View->new( name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT `id`, `name` FROM `my`.`thing`',); - my $create2_opts = { add_replace_view => 0, no_comments => 1, %$options }; - my $view1_sql2 = SQL::Translator::Producer::MySQL::create_view($view2, $create2_opts); - my $view_sql_noreplace = <<'EOV'; + my $view2 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT `id`, `name` FROM `my`.`thing`', + ); + my $create2_opts = { add_replace_view => 0, no_comments => 1, %$options }; + my $view1_sql2 = SQL::Translator::Producer::MySQL::create_view($view2, $create2_opts); + my $view_sql_noreplace = <<'EOV'; CREATE VIEW `view_foo` ( `id`, `name` ) AS SELECT `id`, `name` FROM `my`.`thing` EOV - is($view1_sql2, $view_sql_noreplace, 'correct "CREATE VIEW" SQL'); + is($view1_sql2, $view_sql_noreplace, 'correct "CREATE VIEW" SQL'); - { - my %extra = $view1->extra; - is_deeply \%extra, + { + my %extra = $view1->extra; + is_deeply \%extra, { 'mysql_algorithm' => 'MERGE', 'mysql_definer' => 'CURRENT_USER', 'mysql_security' => 'DEFINER' }, 'Extra attributes'; - } - - $view1->remove_extra(qw/mysql_definer mysql_security/); - { - my %extra = $view1->extra; - is_deeply \%extra, { 'mysql_algorithm' => 'MERGE', }, 'Extra attributes after first reset_extra call'; - } + } - $view1->remove_extra(); - { - my %extra = $view1->extra; - is_deeply \%extra, {}, 'Extra attributes completely removed'; - } + $view1->remove_extra(qw/mysql_definer mysql_security/); + { + my %extra = $view1->extra; + is_deeply \%extra, { 'mysql_algorithm' => 'MERGE', }, 'Extra attributes after first reset_extra call'; } + $view1->remove_extra(); { + my %extra = $view1->extra; + is_deeply \%extra, {}, 'Extra attributes completely removed'; + } + } + + { - # certain types do not support a size, see also: - # http://dev.mysql.com/doc/refman/5.1/de/create-table.html - for my $type (qw/date time timestamp datetime year/) { - my $field = SQL::Translator::Schema::Field->new( - name => "my$type", - table => $table, - data_type => $type, - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 - ); - my $sql = SQL::Translator::Producer::MySQL::create_field($field, $options); - is($sql, "`my$type` $type NULL", "Skip length param for type $type"); - } + # certain types do not support a size, see also: + # http://dev.mysql.com/doc/refman/5.1/de/create-table.html + for my $type (qw/date time timestamp datetime year/) { + my $field = SQL::Translator::Schema::Field->new( + name => "my$type", + table => $table, + data_type => $type, + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 + ); + my $sql = SQL::Translator::Producer::MySQL::create_field($field, $options); + is($sql, "`my$type` $type NULL", "Skip length param for type $type"); } + } } { - my $table = SQL::Translator::Schema::Table->new( name => 'foobar', fields => ['foo'] ); + my $table = SQL::Translator::Schema::Table->new( + name => 'foobar', + fields => ['foo'] + ); - { - my $index = $table->add_index(name => 'myindex', fields => ['foo']); - my ($def) = SQL::Translator::Producer::MySQL::create_index($index); - is($def, 'INDEX myindex (foo)', 'index created'); - } + { + my $index = $table->add_index(name => 'myindex', fields => ['foo']); + my ($def) = SQL::Translator::Producer::MySQL::create_index($index); + is($def, 'INDEX myindex (foo)', 'index created'); + } - { - my $index = $table->add_index(fields => ['foo']); - my ($def) = SQL::Translator::Producer::MySQL::create_index($index); - is($def, 'INDEX (foo)', 'index created'); - } + { + my $index = $table->add_index(fields => ['foo']); + my ($def) = SQL::Translator::Producer::MySQL::create_index($index); + is($def, 'INDEX (foo)', 'index created'); + } - { - my $index = $table->add_index(fields => [ { name => 'foo', prefix_length => 25 } ], type => 'unique'); - my ($def) = SQL::Translator::Producer::MySQL::create_index($index); - is($def, 'UNIQUE INDEX (foo(25))', 'unique index created'); - } + { + my $index = $table->add_index( + fields => [ { name => 'foo', prefix_length => 25 } ], + type => 'unique' + ); + my ($def) = SQL::Translator::Producer::MySQL::create_index($index); + is($def, 'UNIQUE INDEX (foo(25))', 'unique index created'); + } - { - my $index = $table->add_index(name => 'sized', fields => [ - 'foobar', - { name => 'foo', prefix_length => 10 }, - { name => 'bar', prefix_length => 15 }, - ]); - my ($def) = SQL::Translator::Producer::MySQL::create_index($index); - is($def, 'INDEX sized (foobar, foo(10), bar(15))', 'index created'); - } + { + my $index = $table->add_index( + name => 'sized', + fields => [ 'foobar', { name => 'foo', prefix_length => 10 }, { name => 'bar', prefix_length => 15 }, ] + ); + my ($def) = SQL::Translator::Producer::MySQL::create_index($index); + is($def, 'INDEX sized (foobar, foo(10), bar(15))', 'index created'); + } } -{ # test for rt62250 - my $table = SQL::Translator::Schema::Table->new(name => 'table'); - $table->add_field( - SQL::Translator::Schema::Field->new( name => 'mypk', - table => $table, - data_type => 'INT', - size => 10, - default_value => undef, - is_auto_increment => 1, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 1 )); - - my $constraint = $table->add_constraint(fields => ['mypk'], type => 'PRIMARY_KEY'); - my $options = {quote_table_names => '`'}; - is(SQL::Translator::Producer::MySQL::alter_drop_constraint($constraint,$options), - 'ALTER TABLE `table` DROP PRIMARY KEY','valid drop primary key'); +{ # test for rt62250 + my $table = SQL::Translator::Schema::Table->new(name => 'table'); + $table->add_field(SQL::Translator::Schema::Field->new( + name => 'mypk', + table => $table, + data_type => 'INT', + size => 10, + default_value => undef, + is_auto_increment => 1, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 1 + )); + + my $constraint = $table->add_constraint(fields => ['mypk'], type => 'PRIMARY_KEY'); + my $options = { quote_table_names => '`' }; + is( + SQL::Translator::Producer::MySQL::alter_drop_constraint($constraint, $options), + 'ALTER TABLE `table` DROP PRIMARY KEY', + 'valid drop primary key' + ); } { - my $schema = SQL::Translator::Schema->new(); - my $table = $schema->add_table( name => 'foo', fields => ['bar'] ); + my $schema = SQL::Translator::Schema->new(); + my $table = $schema->add_table(name => 'foo', fields => ['bar']); - { - my $trigger = $schema->add_trigger( - name => 'mytrigger', - perform_action_when => 'before', - database_events => 'update', - on_table => 'foo', - fields => ['bar'], - action => 'BEGIN baz(); END' - ); - my ($def) = SQL::Translator::Producer::MySQL::create_trigger($trigger); - my $expected - = "--\n" - . "-- Trigger mytrigger\n" - . "--\n" - . "CREATE TRIGGER mytrigger before update ON foo\n" - . " FOR EACH ROW BEGIN baz(); END"; - is($def, $expected, 'trigger created'); - } + { + my $trigger = $schema->add_trigger( + name => 'mytrigger', + perform_action_when => 'before', + database_events => 'update', + on_table => 'foo', + fields => ['bar'], + action => 'BEGIN baz(); END' + ); + my ($def) = SQL::Translator::Producer::MySQL::create_trigger($trigger); + my $expected + = "--\n" + . "-- Trigger mytrigger\n" . "--\n" + . "CREATE TRIGGER mytrigger before update ON foo\n" + . " FOR EACH ROW BEGIN baz(); END"; + is($def, $expected, 'trigger created'); + } - { - my $trigger = $schema->add_trigger( - name => 'mytrigger2', - perform_action_when => 'after', - database_events => ['insert'], - on_table => 'foo', - fields => ['bar'], - action => 'baz()' - ); - my ($def) = SQL::Translator::Producer::MySQL::create_trigger($trigger); - my $expected - = "--\n" - . "-- Trigger mytrigger2\n" - . "--\n" - . "CREATE TRIGGER mytrigger2 after insert ON foo\n" - . " FOR EACH ROW BEGIN baz(); END"; - is($def, $expected, 'trigger created'); - } + { + my $trigger = $schema->add_trigger( + name => 'mytrigger2', + perform_action_when => 'after', + database_events => ['insert'], + on_table => 'foo', + fields => ['bar'], + action => 'baz()' + ); + my ($def) = SQL::Translator::Producer::MySQL::create_trigger($trigger); + my $expected + = "--\n" + . "-- Trigger mytrigger2\n" . "--\n" + . "CREATE TRIGGER mytrigger2 after insert ON foo\n" + . " FOR EACH ROW BEGIN baz(); END"; + is($def, $expected, 'trigger created'); + } } diff --git a/t/39-filter-globals.t b/t/39-filter-globals.t index cd79f9ef8..20feffa14 100644 --- a/t/39-filter-globals.t +++ b/t/39-filter-globals.t @@ -10,7 +10,7 @@ use Test::Exception; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan(3, 'YAML', 'Test::Differences') + maybe_plan(3, 'YAML', 'Test::Differences'); } use Test::Differences; use SQL::Translator; @@ -46,139 +46,127 @@ schema: name: first_name }; - - # Parse the test XML schema my $obj; $obj = SQL::Translator->new( - debug => 0, - show_warnings => 1, - from => "YAML", - to => "YAML", - data => $in_yaml, - filters => [ - # Filter from SQL::Translator::Filter::* - [ 'Globals', - # A global field to add given in the args - fields => [ - { - name => 'created', - data_type => 'timestamp', - is_nullable => 0, - } - ], - indices => [ - { - fields => 'created', - } - ], - ], + debug => 0, + show_warnings => 1, + from => "YAML", + to => "YAML", + data => $in_yaml, + filters => [ + + # Filter from SQL::Translator::Filter::* + [ + 'Globals', + + # A global field to add given in the args + fields => [ { + name => 'created', + data_type => 'timestamp', + is_nullable => 0, + } ], + indices => [ { + fields => 'created', + } ], ], + ], -) or die "Failed to create translator object: ".SQL::Translator->error; +) or die "Failed to create translator object: " . SQL::Translator->error; my $struct; -lives_ok { $struct = YAML::Load($obj->translate) } "Translate/yaml reload ran"; +lives_ok { $struct = YAML::Load($obj->translate) } +"Translate/yaml reload ran"; is $obj->error, '', "No errors"; # Should include the the items added from the Global table defined above in the # schema as well as those defined in the filter args below. -is_deeply ($struct, { - schema => { - procedures => {}, - tables => { - Person => { - constraints => [ - { - deferrable => 1, - expression => "", - fields => [ - "modified" - ], - match_type => "", - name => "", - on_delete => "", - on_update => "", - options => [], +is_deeply( + $struct, + { + schema => { + procedures => {}, + tables => { + Person => { + constraints => [ { + deferrable => 1, + expression => "", + fields => ["modified"], + match_type => "", + name => "", + on_delete => "", + on_update => "", + options => [], reference_fields => [], - reference_table => "", - type => "UNIQUE" - } - ], - fields => { - first_name => { - data_type => "foovar", - default_value => undef, - is_nullable => 1, - is_primary_key => 0, - is_unique => 0, - name => "first_name", - order => 1, - size => [ - 0 - ] - }, - created => { - data_type => "timestamp", - default_value => undef, - is_nullable => 0, - is_primary_key => 0, - is_unique => 0, - name => "created", - order => 2, - size => [ - 0 - ] - }, - modified => { - data_type => "timestamp", - default_value => undef, - is_nullable => 1, - is_primary_key => 0, - is_unique => 1, - name => "modified", - order => 3, - size => [ - 0 - ] - } - }, - indices => [ - { - fields => [ - "created" - ], - name => "", - options => [], - type => "NORMAL" + reference_table => "", + type => "UNIQUE" + } ], + fields => { + first_name => { + data_type => "foovar", + default_value => undef, + is_nullable => 1, + is_primary_key => 0, + is_unique => 0, + name => "first_name", + order => 1, + size => [0] + }, + created => { + data_type => "timestamp", + default_value => undef, + is_nullable => 0, + is_primary_key => 0, + is_unique => 0, + name => "created", + order => 2, + size => [0] + }, + modified => { + data_type => "timestamp", + default_value => undef, + is_nullable => 1, + is_primary_key => 0, + is_unique => 1, + name => "modified", + order => 3, + size => [0] + } }, - { - fields => [ - "modified" - ], - name => "", - options => [], - type => "NORMAL" - } - ], - name => "Person", - options => [], - order => 1 - } + indices => [ + { + fields => ["created"], + name => "", + options => [], + type => "NORMAL" + }, + { + fields => ["modified"], + name => "", + options => [], + type => "NORMAL" + } + ], + name => "Person", + options => [], + order => 1 + } + }, + triggers => {}, + views => {} }, - triggers => {}, - views => {} + translator => { + add_drop_table => 0, + filename => undef, + no_comments => 0, + parser_args => {}, + parser_type => "SQL::Translator::Parser::YAML", + producer_args => {}, + producer_type => "SQL::Translator::Producer::YAML", + show_warnings => 1, + trace => 0, + version => $SQL::Translator::VERSION, + } }, - translator => { - add_drop_table => 0, - filename => undef, - no_comments => 0, - parser_args => {}, - parser_type => "SQL::Translator::Parser::YAML", - producer_args => {}, - producer_type => "SQL::Translator::Producer::YAML", - show_warnings => 1, - trace => 0, - version => $SQL::Translator::VERSION, - } -}, 'Expected final yaml-schema'); + 'Expected final yaml-schema' +); diff --git a/t/40oracle-parser-dbi.t b/t/40oracle-parser-dbi.t index c915bdf18..63a75fbef 100644 --- a/t/40oracle-parser-dbi.t +++ b/t/40oracle-parser-dbi.t @@ -3,9 +3,7 @@ use Test::More; use Test::SQL::Translator qw(maybe_plan); BEGIN { - maybe_plan(1, - 'SQL::Translator::Parser::DBI::Oracle', - ); + maybe_plan(1, 'SQL::Translator::Parser::DBI::Oracle',); } use_ok('SQL::Translator::Parser::DBI::Oracle'); diff --git a/t/43xml-to-db2.t b/t/43xml-to-db2.t index 933ee69b2..07a233ba6 100644 --- a/t/43xml-to-db2.t +++ b/t/43xml-to-db2.t @@ -11,25 +11,24 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::DB2'); + maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::DB2'); } my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - no_comments => 1, - show_warnings => 0, - add_drop_table => 1, + no_comments => 1, + show_warnings => 0, + add_drop_table => 1, ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my $sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'DB2', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'DB2', + filename => $xmlfile, ) or die $sqlt->error; eq_or_diff($sql, << "SQL"); diff --git a/t/44-xml-to-db2-array.t b/t/44-xml-to-db2-array.t index 6a872ca12..0a03cbbce 100644 --- a/t/44-xml-to-db2-array.t +++ b/t/44-xml-to-db2-array.t @@ -9,31 +9,30 @@ use Data::Dumper; use SQL::Translator; use SQL::Translator::Schema::Constants; - BEGIN { - maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::DB2'); + maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::DB2'); } my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - no_comments => 1, - show_warnings => 0, - add_drop_table => 1, + no_comments => 1, + show_warnings => 0, + add_drop_table => 1, ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my @sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'DB2', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'DB2', + filename => $xmlfile, ) or die $sqlt->error; -my $want = [ 'DROP TABLE Basic;', -q|CREATE TABLE Basic ( +my $want = [ + 'DROP TABLE Basic;', + q|CREATE TABLE Basic ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, title VARCHAR(100) NOT NULL DEFAULT 'hello', description VARCHAR(0) DEFAULT '', @@ -48,24 +47,24 @@ q|CREATE TABLE Basic ( CONSTRAINT very_long_index_name_on_title_field_which_should_be_truncated_for_various_rdbms UNIQUE (title) );|, -'DROP TABLE Another;', + 'DROP TABLE Another;', -q|CREATE TABLE Another ( + q|CREATE TABLE Another ( id INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL, num NUMERIC(10,2), PRIMARY KEY (id) );|, -'ALTER TABLE Basic ADD FOREIGN KEY (another_id) REFERENCES Another(id);', + 'ALTER TABLE Basic ADD FOREIGN KEY (another_id) REFERENCES Another(id);', -'CREATE INDEX titleindex ON Basic ( title );', + 'CREATE INDEX titleindex ON Basic ( title );', -'CREATE VIEW email_list AS + 'CREATE VIEW email_list AS SELECT email FROM Basic WHERE (email IS NOT NULL);', -'CREATE TRIGGER foo_trigger after insert ON Basic REFERENCING OLD AS oldrow NEW AS newrow FOR EACH ROW MODE DB2SQL update modified=timestamp();', + 'CREATE TRIGGER foo_trigger after insert ON Basic REFERENCING OLD AS oldrow NEW AS newrow FOR EACH ROW MODE DB2SQL update modified=timestamp();', -'CREATE TRIGGER bar_trigger before insert, update ON Basic REFERENCING OLD AS oldrow NEW AS newrow FOR EACH ROW MODE DB2SQL update modified2=timestamp();', + 'CREATE TRIGGER bar_trigger before insert, update ON Basic REFERENCING OLD AS oldrow NEW AS newrow FOR EACH ROW MODE DB2SQL update modified2=timestamp();', ]; is_deeply(\@sql, $want, 'Got correct DB2 statements in list context'); diff --git a/t/45db2-producer.t b/t/45db2-producer.t index 35c01cf2e..ccb6c6e86 100644 --- a/t/45db2-producer.t +++ b/t/45db2-producer.t @@ -14,44 +14,42 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(6, - 'SQL::Translator::Producer::DB2', - 'Test::Differences', - ) + maybe_plan(6, 'SQL::Translator::Producer::DB2', 'Test::Differences',); } use Test::Differences; use SQL::Translator; +my $table = SQL::Translator::Schema::Table->new(name => 'mytable'); - -my $table = SQL::Translator::Schema::Table->new( name => 'mytable'); - -my $field1 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); +my $field1 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 +); my $field1_sql = SQL::Translator::Producer::DB2::create_field($field1); is($field1_sql, 'myfield VARCHAR(10)', 'Create field works'); -my $field2 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 25, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - -my $alter_field = SQL::Translator::Producer::DB2::alter_field($field1, - $field2); +my $field2 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 25, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); + +my $alter_field = SQL::Translator::Producer::DB2::alter_field($field1, $field2); is($alter_field, 'ALTER TABLE mytable ALTER myfield SET DATATYPE VARCHAR(25)', 'Alter field works'); my $add_field = SQL::Translator::Producer::DB2::add_field($field1); @@ -62,7 +60,10 @@ my $index = $table->add_index(name => 'myindex', fields => ['foo']); my ($def) = SQL::Translator::Producer::DB2::create_index($index); is($def, 'CREATE INDEX myindex ON mytable ( foo );', 'index created'); -my $index2 = $table->add_index(name => 'myindex', fields => [ { name => 'foo', prefix_length => 15 } ]); +my $index2 = $table->add_index( + name => 'myindex', + fields => [ { name => 'foo', prefix_length => 15 } ] +); my ($def2) = SQL::Translator::Producer::DB2::create_index($index); is($def2, 'CREATE INDEX myindex ON mytable ( foo );', 'index created'); diff --git a/t/46xml-to-pg.t b/t/46xml-to-pg.t index 3c8c85fa3..70fa37fca 100644 --- a/t/46xml-to-pg.t +++ b/t/46xml-to-pg.t @@ -10,28 +10,26 @@ use Data::Dumper; use SQL::Translator; use SQL::Translator::Schema::Constants; - BEGIN { - maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::PostgreSQL'); + maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::PostgreSQL'); } my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - no_comments => 1, - show_warnings => 0, - add_drop_table => 1, - producer_args => { attach_comments => 1 } + no_comments => 1, + show_warnings => 0, + add_drop_table => 1, + producer_args => { attach_comments => 1 } ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my $sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'PostgreSQL', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'PostgreSQL', + filename => $xmlfile, ) or die $sqlt->error; eq_or_diff($sql, << "SQL"); diff --git a/t/47postgres-producer.t b/t/47postgres-producer.t index 5910946f0..56f9a2c9a 100644 --- a/t/47postgres-producer.t +++ b/t/47postgres-producer.t @@ -14,10 +14,7 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(undef, - 'SQL::Translator::Producer::PostgreSQL', - 'Test::Differences', - ) + maybe_plan(undef, 'SQL::Translator::Producer::PostgreSQL', 'Test::Differences',); } use Test::Differences; use SQL::Translator; @@ -25,21 +22,26 @@ use SQL::Translator; my $PRODUCER = \&SQL::Translator::Producer::PostgreSQL::create_field; { - my $table = SQL::Translator::Schema::Table->new( name => 'foo.bar', - comments => [ "multi\nline",'single line' ] ); - my $field = SQL::Translator::Schema::Field->new( name => 'baz', - comments => [ "multi\nline",'single line' ], - table => $table, - data_type => 'VARCHAR', - size => 10, - default_value => 'quux', - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); + my $table = SQL::Translator::Schema::Table->new( + name => 'foo.bar', + comments => [ "multi\nline", 'single line' ] + ); + my $field = SQL::Translator::Schema::Field->new( + name => 'baz', + comments => [ "multi\nline", 'single line' ], + table => $table, + data_type => 'VARCHAR', + size => 10, + default_value => 'quux', + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 + ); $table->add_field($field); - my ($create, $fks) = SQL::Translator::Producer::PostgreSQL::create_table( - $table, { quote_table_names => q{"}, attach_comments => 1 }); + my ($create, $fks) + = SQL::Translator::Producer::PostgreSQL::create_table($table, + { quote_table_names => q{"}, attach_comments => 1 }); is($table->name, 'foo.bar'); my $expected = <new( name => 'mytable'); - -my $field1 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); +my $table = SQL::Translator::Schema::Table->new(name => 'mytable'); + +my $field1 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 +); my $field1_sql = SQL::Translator::Producer::PostgreSQL::create_field($field1); is($field1_sql, 'myfield character varying(10)', 'Create field works'); -my $field_array = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'character varying[]', - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); +my $field_array = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'character varying[]', + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 +); my $field_array_sql = SQL::Translator::Producer::PostgreSQL::create_field($field_array); is($field_array_sql, 'myfield character varying(10)[]', 'Create field works'); -my $field2 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 25, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field2 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 25, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); my $pk_constraint = SQL::Translator::Schema::Constraint->new( - table => $table, - name => 'foo', - fields => [qw(myfield)], - type => 'PRIMARY_KEY', + table => $table, + name => 'foo', + fields => [qw(myfield)], + type => 'PRIMARY_KEY', ); -my ($pk_constraint_def_ref, $pk_constraint_fk_ref ) = SQL::Translator::Producer::PostgreSQL::create_constraint($pk_constraint); -ok(@{$pk_constraint_def_ref} == 1 && @{$pk_constraint_fk_ref} == 0, 'precheck of create_Primary Key constraint'); +my ($pk_constraint_def_ref, $pk_constraint_fk_ref) + = SQL::Translator::Producer::PostgreSQL::create_constraint($pk_constraint); +ok(@{$pk_constraint_def_ref} == 1 && @{$pk_constraint_fk_ref} == 0, 'precheck of create_Primary Key constraint'); is($pk_constraint_def_ref->[0], 'CONSTRAINT foo PRIMARY KEY (myfield)', 'Create Primary Key Constraint works'); my $alter_pk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($pk_constraint); is($alter_pk_constraint, 'ALTER TABLE mytable DROP CONSTRAINT foo', 'Alter drop Primary Key constraint works'); subtest 'Dotted tables (schema)' => sub { - my $dotted_table = SQL::Translator::Schema::Table->new( name => 'dotted.mytable'); + my $dotted_table = SQL::Translator::Schema::Table->new(name => 'dotted.mytable'); my $dotted_pk_constraint = SQL::Translator::Schema::Constraint->new( - table => $dotted_table, - fields => [qw(myfield)], - type => 'PRIMARY_KEY', + table => $dotted_table, + fields => [qw(myfield)], + type => 'PRIMARY_KEY', ); my $alter_dotted_pk = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($dotted_pk_constraint); - is($alter_dotted_pk, 'ALTER TABLE dotted.mytable DROP CONSTRAINT mytable_pkey', 'generate correct PK name for dotted tables'); + is( + $alter_dotted_pk, + 'ALTER TABLE dotted.mytable DROP CONSTRAINT mytable_pkey', + 'generate correct PK name for dotted tables' + ); }; -my $table2 = SQL::Translator::Schema::Table->new( name => 'mytable2'); - -my $field1_2 = SQL::Translator::Schema::Field->new( name => 'myfield_2', - table => $table, - data_type => 'VARCHAR', - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); +my $table2 = SQL::Translator::Schema::Table->new(name => 'mytable2'); + +my $field1_2 = SQL::Translator::Schema::Field->new( + name => 'myfield_2', + table => $table, + data_type => 'VARCHAR', + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 +); # check named, and unnamed foreign keys -for my $name ( 'foo', undef ) { - my $fk_constraint = SQL::Translator::Schema::Constraint->new( - table => $table, - name => $name, - fields => [qw(myfield)], - type => 'FOREIGN_KEY', - reference_table => $table2, - reference_fields => [qw(myfield_2)], - ); - my $fk_constraint_2 = SQL::Translator::Schema::Constraint->new( - table => $table, - name => $name, - fields => [qw(myfield)], - type => 'FOREIGN_KEY', - reference_table => $table2, - reference_fields => [qw(myfield_2)], - ); +for my $name ('foo', undef) { + my $fk_constraint = SQL::Translator::Schema::Constraint->new( + table => $table, + name => $name, + fields => [qw(myfield)], + type => 'FOREIGN_KEY', + reference_table => $table2, + reference_fields => [qw(myfield_2)], + ); + my $fk_constraint_2 = SQL::Translator::Schema::Constraint->new( + table => $table, + name => $name, + fields => [qw(myfield)], + type => 'FOREIGN_KEY', + reference_table => $table2, + reference_fields => [qw(myfield_2)], + ); - my ($fk_constraint_def_ref, $fk_constraint_fk_ref ) = SQL::Translator::Producer::PostgreSQL::create_constraint($fk_constraint); + my ($fk_constraint_def_ref, $fk_constraint_fk_ref) + = SQL::Translator::Producer::PostgreSQL::create_constraint($fk_constraint); - ok(@{$fk_constraint_def_ref} == 0 && @{$fk_constraint_fk_ref} == 1, 'precheck of create_Foreign Key constraint'); + ok(@{$fk_constraint_def_ref} == 0 && @{$fk_constraint_fk_ref} == 1, 'precheck of create_Foreign Key constraint'); - if ( $name ) { - is($fk_constraint_fk_ref->[0], "ALTER TABLE mytable ADD CONSTRAINT $name FOREIGN KEY (myfield) - REFERENCES mytable2 (myfield_2) DEFERRABLE", 'Create Foreign Key Constraint works'); + if ($name) { + is( + $fk_constraint_fk_ref->[0], + "ALTER TABLE mytable ADD CONSTRAINT $name FOREIGN KEY (myfield) + REFERENCES mytable2 (myfield_2) DEFERRABLE", + 'Create Foreign Key Constraint works' + ); - # ToDo: may we should check if the constraint name was valid, or if next - # unused_name created has choosen a different one - my $alter_fk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($fk_constraint); - is($alter_fk_constraint, "ALTER TABLE mytable DROP CONSTRAINT $name", 'Alter drop Foreign Key constraint works'); - } - else { - is($fk_constraint_fk_ref->[0], 'ALTER TABLE mytable ADD FOREIGN KEY (myfield) - REFERENCES mytable2 (myfield_2) DEFERRABLE', 'Create un-named Foreign Key Constraint works'); + # ToDo: may we should check if the constraint name was valid, or if next + # unused_name created has choosen a different one + my $alter_fk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($fk_constraint); + is($alter_fk_constraint, "ALTER TABLE mytable DROP CONSTRAINT $name", 'Alter drop Foreign Key constraint works'); + } else { + is( + $fk_constraint_fk_ref->[0], + 'ALTER TABLE mytable ADD FOREIGN KEY (myfield) + REFERENCES mytable2 (myfield_2) DEFERRABLE', + 'Create un-named Foreign Key Constraint works' + ); - my $alter_fk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($fk_constraint); - is($alter_fk_constraint, 'ALTER TABLE mytable DROP CONSTRAINT mytable_myfield_fkey', 'Alter drop un-named Foreign Key constraint works'); - } + my $alter_fk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($fk_constraint); + is( + $alter_fk_constraint, + 'ALTER TABLE mytable DROP CONSTRAINT mytable_myfield_fkey', + 'Alter drop un-named Foreign Key constraint works' + ); + } } # check named, and unnamed primary keys -for my $name ( 'foo', undef ) { - my $pk_constraint = SQL::Translator::Schema::Constraint->new( - table => $table, - name => $name, - fields => [qw(myfield)], - type => 'PRIMARY_KEY', - ); - my $pk_constraint_2 = SQL::Translator::Schema::Constraint->new( - table => $table, - name => $name, - fields => [qw(myfield)], - type => 'PRIMARY_KEY', - ); +for my $name ('foo', undef) { + my $pk_constraint = SQL::Translator::Schema::Constraint->new( + table => $table, + name => $name, + fields => [qw(myfield)], + type => 'PRIMARY_KEY', + ); + my $pk_constraint_2 = SQL::Translator::Schema::Constraint->new( + table => $table, + name => $name, + fields => [qw(myfield)], + type => 'PRIMARY_KEY', + ); - my ($pk_constraint_def_ref, $pk_constraint_pk_ref ) = SQL::Translator::Producer::PostgreSQL::create_constraint($pk_constraint); + my ($pk_constraint_def_ref, $pk_constraint_pk_ref) + = SQL::Translator::Producer::PostgreSQL::create_constraint($pk_constraint); - if ( $name ) { - is($pk_constraint_def_ref->[0], "CONSTRAINT $name PRIMARY KEY (myfield)", 'Create Primary Key Constraint works'); + if ($name) { + is($pk_constraint_def_ref->[0], "CONSTRAINT $name PRIMARY KEY (myfield)", 'Create Primary Key Constraint works'); - # ToDo: may we should check if the constraint name was valid, or if next - # unused_name created has choosen a different one - my $alter_pk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($pk_constraint); - is($alter_pk_constraint, "ALTER TABLE mytable DROP CONSTRAINT $name", 'Alter drop Primary Key constraint works'); - } - else { - is($pk_constraint_def_ref->[0], 'PRIMARY KEY (myfield)', 'Create un-named Primary Key Constraint works'); + # ToDo: may we should check if the constraint name was valid, or if next + # unused_name created has choosen a different one + my $alter_pk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($pk_constraint); + is($alter_pk_constraint, "ALTER TABLE mytable DROP CONSTRAINT $name", 'Alter drop Primary Key constraint works'); + } else { + is($pk_constraint_def_ref->[0], 'PRIMARY KEY (myfield)', 'Create un-named Primary Key Constraint works'); - my $alter_pk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($pk_constraint); - is($alter_pk_constraint, 'ALTER TABLE mytable DROP CONSTRAINT mytable_pkey', 'Alter drop un-named Foreign Key constraint works'); - } + my $alter_pk_constraint = SQL::Translator::Producer::PostgreSQL::alter_drop_constraint($pk_constraint); + is( + $alter_pk_constraint, + 'ALTER TABLE mytable DROP CONSTRAINT mytable_pkey', + 'Alter drop un-named Foreign Key constraint works' + ); + } } subtest 'exclude constraints' => sub { - my $exclude_constraint = SQL::Translator::Schema::Constraint->new( - table => $table, - name => 'game', - expression => 'dates WITH &&, char with =', - options => { - using => 'gist', - where => 'fun IS TRUE', - }, - type => 'EXCLUDE', - ); - my ($def, undef) = SQL::Translator::Producer::PostgreSQL::create_constraint($exclude_constraint); - is $def->[0], 'CONSTRAINT game EXCLUDE USING gist ( dates WITH &&, char with = ) WHERE ( fun IS TRUE )', 'exclude constraint'; + my $exclude_constraint = SQL::Translator::Schema::Constraint->new( + table => $table, + name => 'game', + expression => 'dates WITH &&, char with =', + options => { + using => 'gist', + where => 'fun IS TRUE', + }, + type => 'EXCLUDE', + ); + my ($def, undef) = SQL::Translator::Producer::PostgreSQL::create_constraint($exclude_constraint); + is $def->[0], + 'CONSTRAINT game EXCLUDE USING gist ( dates WITH &&, char with = ) WHERE ( fun IS TRUE )', + 'exclude constraint'; }; -my $alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field1, - $field2); -is($alter_field, qq[ALTER TABLE mytable ALTER COLUMN myfield SET NOT NULL; +my $alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field1, $field2); +is( + $alter_field, qq[ALTER TABLE mytable ALTER COLUMN myfield SET NOT NULL; ALTER TABLE mytable ALTER COLUMN myfield TYPE character varying(25)], - 'Alter field works'); + 'Alter field works' +); my $field1_complex = SQL::Translator::Schema::Field->new( - name => 'my_complex_field', - table => $table, - data_type => 'VARCHAR', - size => 10, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 + name => 'my_complex_field', + table => $table, + data_type => 'VARCHAR', + size => 10, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 ); my $field2_complex = SQL::Translator::Schema::Field->new( - name => 'my_altered_field', - table => $table, - data_type => 'VARCHAR', - size => 60, - default_value => 'whatever', - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 + name => 'my_altered_field', + table => $table, + data_type => 'VARCHAR', + size => 60, + default_value => 'whatever', + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 ); my $alter_field_complex = SQL::Translator::Producer::PostgreSQL::alter_field($field1_complex, $field2_complex); is( - $alter_field_complex, - q{ALTER TABLE mytable RENAME COLUMN my_complex_field TO my_altered_field; + $alter_field_complex, + q{ALTER TABLE mytable RENAME COLUMN my_complex_field TO my_altered_field; ALTER TABLE mytable ALTER COLUMN my_altered_field TYPE character varying(60); ALTER TABLE mytable ALTER COLUMN my_altered_field SET DEFAULT 'whatever'}, - 'Complex Alter field works' + 'Complex Alter field works' ); $field1->name('field3'); @@ -275,389 +309,396 @@ is($add_field, 'ALTER TABLE mytable ADD COLUMN field3 character varying(10)', 'A my $drop_field = SQL::Translator::Producer::PostgreSQL::drop_field($field2); is($drop_field, 'ALTER TABLE mytable DROP COLUMN myfield', 'Drop field works'); -my $field_serial = SQL::Translator::Schema::Field->new( name => 'serial_field', - table => $table, - data_type => 'INT', - is_auto_increment => 1, - is_nullable => 0 ); +my $field_serial = SQL::Translator::Schema::Field->new( + name => 'serial_field', + table => $table, + data_type => 'INT', + is_auto_increment => 1, + is_nullable => 0 +); my $field_serial_sql = SQL::Translator::Producer::PostgreSQL::create_field($field_serial); is($field_serial_sql, 'serial_field serial NOT NULL', 'Create serial field works'); -my $field_bigserial = SQL::Translator::Schema::Field->new( name => 'bigserial_field', - table => $table, - data_type => 'BIGINT', - is_auto_increment => 1, - is_nullable => 0 ); +my $field_bigserial = SQL::Translator::Schema::Field->new( + name => 'bigserial_field', + table => $table, + data_type => 'BIGINT', + is_auto_increment => 1, + is_nullable => 0 +); my $field_bigserial_sql = SQL::Translator::Producer::PostgreSQL::create_field($field_bigserial); is($field_bigserial_sql, 'bigserial_field bigserial NOT NULL', 'Create bigserial field works (from bigint type)'); -$field_bigserial = SQL::Translator::Schema::Field->new( name => 'bigserial_field', - table => $table, - data_type => 'INT', - is_auto_increment => 1, - is_nullable => 0, - size => 12 ); +$field_bigserial = SQL::Translator::Schema::Field->new( + name => 'bigserial_field', + table => $table, + data_type => 'INT', + is_auto_increment => 1, + is_nullable => 0, + size => 12 +); $field_bigserial_sql = SQL::Translator::Producer::PostgreSQL::create_field($field_bigserial); is($field_bigserial_sql, 'bigserial_field bigserial NOT NULL', 'Create bigserial field works (based on size)'); -my $field3 = SQL::Translator::Schema::Field->new( name => 'time_field', - table => $table, - data_type => 'TIME', - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field3 = SQL::Translator::Schema::Field->new( + name => 'time_field', + table => $table, + data_type => 'TIME', + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); my $field3_sql = SQL::Translator::Producer::PostgreSQL::create_field($field3); is($field3_sql, 'time_field time NOT NULL', 'Create time field works'); my $field3_datetime_with_TZ = SQL::Translator::Schema::Field->new( - name => 'datetime_with_TZ', - table => $table, - data_type => 'timestamp with time zone', - size => 7, + name => 'datetime_with_TZ', + table => $table, + data_type => 'timestamp with time zone', + size => 7, ); -my $field3_datetime_with_TZ_sql = - SQL::Translator::Producer::PostgreSQL::create_field( - $field3_datetime_with_TZ - ); +my $field3_datetime_with_TZ_sql = SQL::Translator::Producer::PostgreSQL::create_field($field3_datetime_with_TZ); is( - $field3_datetime_with_TZ_sql, - 'datetime_with_TZ timestamp(6) with time zone', - 'Create time field with time zone and size, works' + $field3_datetime_with_TZ_sql, + 'datetime_with_TZ timestamp(6) with time zone', + 'Create time field with time zone and size, works' ); my $field3_time_without_TZ = SQL::Translator::Schema::Field->new( - name => 'time_without_TZ', - table => $table, - data_type => 'time without time zone', - size => 2, + name => 'time_without_TZ', + table => $table, + data_type => 'time without time zone', + size => 2, ); -my $field3_time_without_TZ_sql - = SQL::Translator::Producer::PostgreSQL::create_field( - $field3_time_without_TZ - ); +my $field3_time_without_TZ_sql = SQL::Translator::Producer::PostgreSQL::create_field($field3_time_without_TZ); is( - $field3_time_without_TZ_sql, - 'time_without_TZ time(2) without time zone', - 'Create time field without time zone but with size, works' + $field3_time_without_TZ_sql, + 'time_without_TZ time(2) without time zone', + 'Create time field without time zone but with size, works' ); -my $field_num = SQL::Translator::Schema::Field->new( name => 'num', - table => $table, - data_type => 'numeric', - size => [10,2], - ); +my $field_num = SQL::Translator::Schema::Field->new( + name => 'num', + table => $table, + data_type => 'numeric', + size => [ 10, 2 ], +); my $fieldnum_sql = SQL::Translator::Producer::PostgreSQL::create_field($field_num); is($fieldnum_sql, 'num numeric(10,2)', 'Create numeric field works'); - -my $field4 = SQL::Translator::Schema::Field->new( name => 'bytea_field', - table => $table, - data_type => 'bytea', - size => '16777215', - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field4 = SQL::Translator::Schema::Field->new( + name => 'bytea_field', + table => $table, + data_type => 'bytea', + size => '16777215', + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); my $field4_sql = SQL::Translator::Producer::PostgreSQL::create_field($field4); is($field4_sql, 'bytea_field bytea NOT NULL', 'Create bytea field works'); -my $field5 = SQL::Translator::Schema::Field->new( name => 'enum_field', - table => $table, - data_type => 'enum', - extra => { list => [ 'Foo', 'Bar', 'Ba\'z' ] }, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field5 = SQL::Translator::Schema::Field->new( + name => 'enum_field', + table => $table, + data_type => 'enum', + extra => { list => [ 'Foo', 'Bar', 'Ba\'z' ] }, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); my $field5_types = {}; -my $field5_sql = SQL::Translator::Producer::PostgreSQL::create_field( - $field5, - { - postgres_version => 8.3, - type_defs => $field5_types, - } +my $field5_sql = SQL::Translator::Producer::PostgreSQL::create_field( + $field5, + { + postgres_version => 8.3, + type_defs => $field5_types, + } ); is($field5_sql, 'enum_field mytable_enum_field_type NOT NULL', 'Create real enum field works'); is_deeply( - $field5_types, - { mytable_enum_field_type => - "DROP TYPE IF EXISTS mytable_enum_field_type CASCADE;\n" . - "CREATE TYPE mytable_enum_field_type AS ENUM ('Foo', 'Bar', 'Ba''z')" - }, - 'Create real enum type works' -); - -my $field5a = SQL::Translator::Schema::Field->new( name => 'enum_field', - table => $table, - data_type => 'enum', - extra => { - custom_type_name => 'mytable_enum_field_type', - list => [ 'Foo', 'Bar', 'Ba\'z' ] - }, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); -my $field5b = SQL::Translator::Schema::Field->new( name => 'enum_field', - table => $table, - data_type => 'enum', - extra => { - custom_type_name => 'mytable_enum_field_type', - list => [ 'Foo', 'Bar', 'Ba\'z', 'Other' ] - }, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - -$alter_field= SQL::Translator::Producer::PostgreSQL::alter_field($field5a, - $field5b, - { postgres_version => 9.001 }); -is( $alter_field, q(ALTER TYPE mytable_enum_field_type ADD VALUE IF NOT EXISTS 'Other'), 'Add value to enum' ); + $field5_types, + { + mytable_enum_field_type => "DROP TYPE IF EXISTS mytable_enum_field_type CASCADE;\n" + . "CREATE TYPE mytable_enum_field_type AS ENUM ('Foo', 'Bar', 'Ba''z')" + }, + 'Create real enum type works' +); + +my $field5a = SQL::Translator::Schema::Field->new( + name => 'enum_field', + table => $table, + data_type => 'enum', + extra => { + custom_type_name => 'mytable_enum_field_type', + list => [ 'Foo', 'Bar', 'Ba\'z' ] + }, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); +my $field5b = SQL::Translator::Schema::Field->new( + name => 'enum_field', + table => $table, + data_type => 'enum', + extra => { + custom_type_name => 'mytable_enum_field_type', + list => [ 'Foo', 'Bar', 'Ba\'z', 'Other' ] + }, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); + +$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field5a, $field5b, { postgres_version => 9.001 }); +is($alter_field, q(ALTER TYPE mytable_enum_field_type ADD VALUE IF NOT EXISTS 'Other'), 'Add value to enum'); my $field6 = SQL::Translator::Schema::Field->new( - name => 'character', - table => $table, - data_type => 'character', - size => '123', - default_value => 'foobar', - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0); + name => 'character', + table => $table, + data_type => 'character', + size => '123', + default_value => 'foobar', + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); my $field7 = SQL::Translator::Schema::Field->new( - name => 'character', - table => $table, - data_type => 'character', - size => '123', - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0); - -$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, - $field7); + name => 'character', + table => $table, + data_type => 'character', + size => '123', + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); + +$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, $field7); is($alter_field, q(ALTER TABLE mytable ALTER COLUMN character DROP DEFAULT), 'DROP DEFAULT'); $field7->default_value(q(foo'bar')); -$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, - $field7); +$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, $field7); is($alter_field, q(ALTER TABLE mytable ALTER COLUMN character SET DEFAULT 'foo''bar'''), 'DEFAULT with escaping'); $field7->default_value(\q(foobar)); -$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, - $field7); +$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, $field7); is($alter_field, q(ALTER TABLE mytable ALTER COLUMN character SET DEFAULT foobar), 'DEFAULT unescaped if scalarref'); $field7->is_nullable(1); $field7->default_value(q(foobar)); -$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, - $field7); +$alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field6, $field7); is($alter_field, q(ALTER TABLE mytable ALTER COLUMN character DROP NOT NULL), 'DROP NOT NULL'); -my $field8 = SQL::Translator::Schema::Field->new( name => 'ts_field', - table => $table, - data_type => 'timestamp with time zone', - size => 6, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field8 = SQL::Translator::Schema::Field->new( + name => 'ts_field', + table => $table, + data_type => 'timestamp with time zone', + size => 6, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); -my $field8_sql = SQL::Translator::Producer::PostgreSQL::create_field($field8,{ postgres_version => 8.3 }); +my $field8_sql = SQL::Translator::Producer::PostgreSQL::create_field($field8, { postgres_version => 8.3 }); is($field8_sql, 'ts_field timestamp(6) with time zone NOT NULL', 'timestamp with precision'); -my $field9 = SQL::Translator::Schema::Field->new( name => 'time_field', - table => $table, - data_type => 'time with time zone', - size => 6, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field9 = SQL::Translator::Schema::Field->new( + name => 'time_field', + table => $table, + data_type => 'time with time zone', + size => 6, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); -my $field9_sql = SQL::Translator::Producer::PostgreSQL::create_field($field9,{ postgres_version => 8.3 }); +my $field9_sql = SQL::Translator::Producer::PostgreSQL::create_field($field9, { postgres_version => 8.3 }); is($field9_sql, 'time_field time(6) with time zone NOT NULL', 'time with precision'); -my $field10 = SQL::Translator::Schema::Field->new( name => 'interval_field', - table => $table, - data_type => 'interval', - size => 6, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field10 = SQL::Translator::Schema::Field->new( + name => 'interval_field', + table => $table, + data_type => 'interval', + size => 6, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); -my $field10_sql = SQL::Translator::Producer::PostgreSQL::create_field($field10,{ postgres_version => 8.3 }); +my $field10_sql = SQL::Translator::Producer::PostgreSQL::create_field($field10, { postgres_version => 8.3 }); is($field10_sql, 'interval_field interval(6) NOT NULL', 'time with precision'); +my $field11 = SQL::Translator::Schema::Field->new( + name => 'time_field', + table => $table, + data_type => 'time without time zone', + size => 6, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); -my $field11 = SQL::Translator::Schema::Field->new( name => 'time_field', - table => $table, - data_type => 'time without time zone', - size => 6, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - -my $field11_sql = SQL::Translator::Producer::PostgreSQL::create_field($field11,{ postgres_version => 8.3 }); +my $field11_sql = SQL::Translator::Producer::PostgreSQL::create_field($field11, { postgres_version => 8.3 }); is($field11_sql, 'time_field time(6) without time zone NOT NULL', 'time with precision'); +my $field12 = SQL::Translator::Schema::Field->new( + name => 'time_field', + table => $table, + data_type => 'timestamp', + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); - -my $field12 = SQL::Translator::Schema::Field->new( name => 'time_field', - table => $table, - data_type => 'timestamp', - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - -my $field12_sql = SQL::Translator::Producer::PostgreSQL::create_field($field12,{ postgres_version => 8.3 }); +my $field12_sql = SQL::Translator::Producer::PostgreSQL::create_field($field12, { postgres_version => 8.3 }); is($field12_sql, 'time_field timestamp NOT NULL', 'time with precision'); -my $field13 = SQL::Translator::Schema::Field->new( name => 'enum_field_with_type_name', - table => $table, - data_type => 'enum', - extra => { list => [ 'Foo', 'Bar', 'Ba\'z' ], - custom_type_name => 'real_enum_type' }, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); +my $field13 = SQL::Translator::Schema::Field->new( + name => 'enum_field_with_type_name', + table => $table, + data_type => 'enum', + extra => { + list => [ 'Foo', 'Bar', 'Ba\'z' ], + custom_type_name => 'real_enum_type' + }, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); my $field13_types = {}; -my $field13_sql = SQL::Translator::Producer::PostgreSQL::create_field( - $field13, - { - postgres_version => 8.3, - type_defs => $field13_types, - } +my $field13_sql = SQL::Translator::Producer::PostgreSQL::create_field( + $field13, + { + postgres_version => 8.3, + type_defs => $field13_types, + } ); is($field13_sql, 'enum_field_with_type_name real_enum_type NOT NULL', 'Create real enum field works'); is_deeply( - $field13_types, - { real_enum_type => - "DROP TYPE IF EXISTS real_enum_type CASCADE;\n" . - "CREATE TYPE real_enum_type AS ENUM ('Foo', 'Bar', 'Ba''z')" - }, - 'Create real enum type works' + $field13_types, + { + real_enum_type => "DROP TYPE IF EXISTS real_enum_type CASCADE;\n" + . "CREATE TYPE real_enum_type AS ENUM ('Foo', 'Bar', 'Ba''z')" + }, + 'Create real enum type works' ); - { - # let's test default values! -- rjbs, 2008-09-30 - my %field = ( - table => $table, - data_type => 'VARCHAR', - size => 10, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0, + # let's test default values! -- rjbs, 2008-09-30 + my %field = ( + table => $table, + data_type => 'VARCHAR', + size => 10, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0, + ); + + { + my $simple_default = SQL::Translator::Schema::Field->new( + %field, + name => 'str_default', + default_value => 'foo', ); - { - my $simple_default = SQL::Translator::Schema::Field->new( - %field, - name => 'str_default', - default_value => 'foo', - ); - - is( - $PRODUCER->($simple_default), - q{str_default character varying(10) DEFAULT 'foo'}, - 'default str', - ); - } - - { - my $null_default = SQL::Translator::Schema::Field->new( - %field, - name => 'null_default', - default_value => \'NULL', - ); - - is( - $PRODUCER->($null_default), - q{null_default character varying(10) DEFAULT NULL}, - 'default null', - ); - } - - { - my $null_default = SQL::Translator::Schema::Field->new( - %field, - name => 'null_default_2', - default_value => 'NULL', # XXX: this should go away - ); - - is( - $PRODUCER->($null_default), - q{null_default_2 character varying(10) DEFAULT NULL}, - 'default null from special cased string', - ); - } - - { - my $func_default = SQL::Translator::Schema::Field->new( - %field, - name => 'func_default', - default_value => \'func(funky)', - ); - - is( - $PRODUCER->($func_default), - q{func_default character varying(10) DEFAULT func(funky)}, - 'unquoted default from scalar ref', - ); - } -} + is($PRODUCER->($simple_default), q{str_default character varying(10) DEFAULT 'foo'}, 'default str',); + } + + { + my $null_default = SQL::Translator::Schema::Field->new( + %field, + name => 'null_default', + default_value => \'NULL', + ); + + is($PRODUCER->($null_default), q{null_default character varying(10) DEFAULT NULL}, 'default null',); + } + + { + my $null_default = SQL::Translator::Schema::Field->new( + %field, + name => 'null_default_2', + default_value => 'NULL', # XXX: this should go away + ); + is( + $PRODUCER->($null_default), + q{null_default_2 character varying(10) DEFAULT NULL}, + 'default null from special cased string', + ); + } + + { + my $func_default = SQL::Translator::Schema::Field->new( + %field, + name => 'func_default', + default_value => \'func(funky)', + ); + + is( + $PRODUCER->($func_default), + q{func_default character varying(10) DEFAULT func(funky)}, + 'unquoted default from scalar ref', + ); + } +} my $view1 = SQL::Translator::Schema::View->new( - name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing', + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', ); my $create_opts = { add_replace_view => 1, no_comments => 1 }; -my $view1_sql1 = SQL::Translator::Producer::PostgreSQL::create_view($view1, $create_opts); +my $view1_sql1 = SQL::Translator::Producer::PostgreSQL::create_view($view1, $create_opts); my $view_sql_replace = "CREATE VIEW view_foo ( id, name ) AS SELECT id, name FROM thing @@ -665,15 +706,15 @@ my $view_sql_replace = "CREATE VIEW view_foo ( id, name ) AS is($view1_sql1, $view_sql_replace, 'correct "CREATE OR REPLACE VIEW" SQL'); my $view2 = SQL::Translator::Schema::View->new( - name => 'view_foo2', - sql => 'SELECT id, name FROM thing', - extra => { - 'temporary' => '1', - 'check_option' => 'cascaded', - }, + name => 'view_foo2', + sql => 'SELECT id, name FROM thing', + extra => { + 'temporary' => '1', + 'check_option' => 'cascaded', + }, ); my $create2_opts = { add_replace_view => 1, no_comments => 1 }; -my $view2_sql1 = SQL::Translator::Producer::PostgreSQL::create_view($view2, $create2_opts); +my $view2_sql1 = SQL::Translator::Producer::PostgreSQL::create_view($view2, $create2_opts); my $view2_sql_replace = "CREATE TEMPORARY VIEW view_foo2 AS SELECT id, name FROM thing @@ -681,83 +722,120 @@ my $view2_sql_replace = "CREATE TEMPORARY VIEW view_foo2 AS is($view2_sql1, $view2_sql_replace, 'correct "CREATE OR REPLACE VIEW" SQL 2'); { - my $table = SQL::Translator::Schema::Table->new( name => 'foobar', fields => [qw( foo bar )] ); - my $quote = { quote_table_names => '"' }; - - { - my $index = $table->add_index(name => 'myindex', fields => ['foo']); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); - is($def, "CREATE INDEX myindex on foobar (foo)", 'index created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); - is($def, 'CREATE INDEX "myindex" on "foobar" ("foo")', 'index created w/ quotes'); - } - - { - my $index = $table->add_index(name => 'myindex', fields => [ { name => 'foo', prefix_length => 20 } ]); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); - is($def, "CREATE INDEX myindex on foobar (foo)", 'index created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); - is($def, 'CREATE INDEX "myindex" on "foobar" ("foo")', 'index created w/ quotes'); - } - - { - my $index = $table->add_index(name => 'myindex', fields => ['lower(foo)']); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); - is($def, "CREATE INDEX myindex on foobar (lower(foo))", 'index created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); - is($def, 'CREATE INDEX "myindex" on "foobar" (lower(foo))', 'index created w/ quotes'); - } - - { - my $index = $table->add_index(name => 'myindex', fields => ['bar', 'lower(foo)']); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); - is($def, "CREATE INDEX myindex on foobar (bar, lower(foo))", 'index created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); - is($def, 'CREATE INDEX "myindex" on "foobar" ("bar", lower(foo))', 'index created w/ quotes'); - } - - { - my $index = $table->add_index(name => 'covering', fields => ['bar'], options => { include => [ 'lower(foo)', 'baz' ] }); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); - is($def, "CREATE INDEX covering on foobar (bar)", 'skip if postgres is too old'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, { postgres_version => 11 }); - is($def, "CREATE INDEX covering on foobar (bar) INCLUDE (lower(foo), baz)", 'index created'); - } - - { - my $constr = $table->add_constraint(name => 'constr', type => UNIQUE, fields => ['foo']); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr); - is($def->[0], 'CONSTRAINT constr UNIQUE (foo)', 'constraint created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr, $quote); - is($def->[0], 'CONSTRAINT "constr" UNIQUE ("foo")', 'constraint created w/ quotes'); - } - - { - my $constr = $table->add_constraint(name => 'constr', type => UNIQUE, fields => ['lower(foo)']); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr); - is($def->[0], 'CONSTRAINT constr UNIQUE (lower(foo))', 'constraint created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr, $quote); - is($def->[0], 'CONSTRAINT "constr" UNIQUE (lower(foo))', 'constraint created w/ quotes'); - } - - { - my $constr = $table->add_constraint(name => 'constr', type => UNIQUE, fields => ['bar', 'lower(foo)']); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr); - is($def->[0], 'CONSTRAINT constr UNIQUE (bar, lower(foo))', 'constraint created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr, $quote); - is($def->[0], 'CONSTRAINT "constr" UNIQUE ("bar", lower(foo))', 'constraint created w/ quotes'); - } - - { - my $index = $table->add_index(name => 'myindex', options => [{using => 'hash'}, {where => "upper(foo) = 'bar' AND bar = 'foo'"}], fields => ['bar', 'lower(foo)']); - my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); - is($def, "CREATE INDEX myindex on foobar USING hash (bar, lower(foo)) WHERE upper(foo) = 'bar' AND bar = 'foo'", 'index using & where created'); - ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); - is($def, 'CREATE INDEX "myindex" on "foobar" USING hash ("bar", lower(foo)) WHERE upper(foo) = \'bar\' AND bar = \'foo\'', 'index using & where created w/ quotes'); - } + my $table = SQL::Translator::Schema::Table->new( + name => 'foobar', + fields => [qw( foo bar )] + ); + my $quote = { quote_table_names => '"' }; + + { + my $index = $table->add_index(name => 'myindex', fields => ['foo']); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); + is($def, "CREATE INDEX myindex on foobar (foo)", 'index created'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); + is($def, 'CREATE INDEX "myindex" on "foobar" ("foo")', 'index created w/ quotes'); + } + + { + my $index = $table->add_index( + name => 'myindex', + fields => [ { name => 'foo', prefix_length => 20 } ] + ); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); + is($def, "CREATE INDEX myindex on foobar (foo)", 'index created'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); + is($def, 'CREATE INDEX "myindex" on "foobar" ("foo")', 'index created w/ quotes'); + } + + { + my $index = $table->add_index(name => 'myindex', fields => ['lower(foo)']); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); + is($def, "CREATE INDEX myindex on foobar (lower(foo))", 'index created'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); + is($def, 'CREATE INDEX "myindex" on "foobar" (lower(foo))', 'index created w/ quotes'); + } + + { + my $index = $table->add_index( + name => 'myindex', + fields => [ 'bar', 'lower(foo)' ] + ); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); + is($def, "CREATE INDEX myindex on foobar (bar, lower(foo))", 'index created'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); + is($def, 'CREATE INDEX "myindex" on "foobar" ("bar", lower(foo))', 'index created w/ quotes'); + } + + { + my $index = $table->add_index( + name => 'covering', + fields => ['bar'], + options => { include => [ 'lower(foo)', 'baz' ] } + ); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); + is($def, "CREATE INDEX covering on foobar (bar)", 'skip if postgres is too old'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, { postgres_version => 11 }); + is($def, "CREATE INDEX covering on foobar (bar) INCLUDE (lower(foo), baz)", 'index created'); + } + + { + my $constr = $table->add_constraint( + name => 'constr', + type => UNIQUE, + fields => ['foo'] + ); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr); + is($def->[0], 'CONSTRAINT constr UNIQUE (foo)', 'constraint created'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr, $quote); + is($def->[0], 'CONSTRAINT "constr" UNIQUE ("foo")', 'constraint created w/ quotes'); + } + + { + my $constr = $table->add_constraint( + name => 'constr', + type => UNIQUE, + fields => ['lower(foo)'] + ); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr); + is($def->[0], 'CONSTRAINT constr UNIQUE (lower(foo))', 'constraint created'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr, $quote); + is($def->[0], 'CONSTRAINT "constr" UNIQUE (lower(foo))', 'constraint created w/ quotes'); + } + + { + my $constr = $table->add_constraint( + name => 'constr', + type => UNIQUE, + fields => [ 'bar', 'lower(foo)' ] + ); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr); + is($def->[0], 'CONSTRAINT constr UNIQUE (bar, lower(foo))', 'constraint created'); + ($def) = SQL::Translator::Producer::PostgreSQL::create_constraint($constr, $quote); + is($def->[0], 'CONSTRAINT "constr" UNIQUE ("bar", lower(foo))', 'constraint created w/ quotes'); + } + + { + my $index = $table->add_index( + name => 'myindex', + options => [ { using => 'hash' }, { where => "upper(foo) = 'bar' AND bar = 'foo'" } ], + fields => [ 'bar', 'lower(foo)' ] + ); + my ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index); + is( + $def, + "CREATE INDEX myindex on foobar USING hash (bar, lower(foo)) WHERE upper(foo) = 'bar' AND bar = 'foo'", + 'index using & where created' + ); + ($def) = SQL::Translator::Producer::PostgreSQL::create_index($index, $quote); + is( + $def, + 'CREATE INDEX "myindex" on "foobar" USING hash ("bar", lower(foo)) WHERE upper(foo) = \'bar\' AND bar = \'foo\'', + 'index using & where created w/ quotes' + ); + } } -my $drop_view_opts1 = { add_drop_view => 1, no_comments => 1, postgres_version => 8.001 }; +my $drop_view_opts1 = { add_drop_view => 1, no_comments => 1, postgres_version => 8.001 }; my $drop_view_8_1_produced = SQL::Translator::Producer::PostgreSQL::create_view($view1, $drop_view_opts1); my $drop_view_8_1_expected = "DROP VIEW view_foo; @@ -767,7 +845,7 @@ CREATE VIEW view_foo ( id, name ) AS is($drop_view_8_1_produced, $drop_view_8_1_expected, "My DROP VIEW statement for 8.1 is correct"); -my $drop_view_opts2 = { add_drop_view => 1, no_comments => 1, postgres_version => 9.001 }; +my $drop_view_opts2 = { add_drop_view => 1, no_comments => 1, postgres_version => 9.001 }; my $drop_view_9_1_produced = SQL::Translator::Producer::PostgreSQL::create_view($view1, $drop_view_opts2); my $drop_view_9_1_expected = "DROP VIEW IF EXISTS view_foo; @@ -778,15 +856,15 @@ CREATE VIEW view_foo ( id, name ) AS is($drop_view_9_1_produced, $drop_view_9_1_expected, "My DROP VIEW statement for 9.1 is correct"); my $mat_view = SQL::Translator::Schema::View->new( - name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing', - extra => { - materialized => 1 - } + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', + extra => { + materialized => 1 + } ); -my $mat_view_sql = SQL::Translator::Producer::PostgreSQL::create_view($mat_view, { no_comments => 1 }); +my $mat_view_sql = SQL::Translator::Producer::PostgreSQL::create_view($mat_view, { no_comments => 1 }); my $mat_view_sql_expected = "CREATE MATERIALIZED VIEW view_foo ( id, name ) AS SELECT id, name FROM thing diff --git a/t/48xml-to-sqlite.t b/t/48xml-to-sqlite.t index 21e8ad355..02da48bb6 100644 --- a/t/48xml-to-sqlite.t +++ b/t/48xml-to-sqlite.t @@ -10,28 +10,26 @@ use Data::Dumper; use SQL::Translator; use SQL::Translator::Schema::Constants; - BEGIN { - maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::SQLite'); + maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::SQLite'); } my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - quote_identifiers => 1, - no_comments => 1, - show_warnings => 0, - add_drop_table => 1, + quote_identifiers => 1, + no_comments => 1, + show_warnings => 0, + add_drop_table => 1, ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my $sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'SQLite', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'SQLite', + filename => $xmlfile, ) or die $sqlt->error; eq_or_diff($sql, << "SQL"); @@ -88,16 +86,17 @@ SQL # Test in list context my @sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'SQLite', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'SQLite', + filename => $xmlfile, ) or die $sqlt->error; -eq_or_diff(\@sql, - [ - 'BEGIN TRANSACTION', - q, - q, + q, - q, - q, - q, - q, - q, + q, + q, + q, + q, - q, - q, + q, - q, - q, - q, - q, - q, - q, - 'COMMIT', - - ], 'SQLite translate in list context matches'); - + q, + q, + q, + q, + q, + q, + 'COMMIT', + + ], + 'SQLite translate in list context matches' +); diff --git a/t/49xml-to-pg-samefield.t b/t/49xml-to-pg-samefield.t index 2b4a8f8ee..9f44c6716 100644 --- a/t/49xml-to-pg-samefield.t +++ b/t/49xml-to-pg-samefield.t @@ -9,27 +9,25 @@ use Data::Dumper; use SQL::Translator; use SQL::Translator::Schema::Constants; - BEGIN { - maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::PostgreSQL'); + maybe_plan(1, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::PostgreSQL'); } my $xmlfile = "$Bin/data/xml/samefield.xml"; my $sqlt; $sqlt = SQL::Translator->new( - no_comments => 1, - show_warnings => 1, - add_drop_table => 1, + no_comments => 1, + show_warnings => 1, + add_drop_table => 1, ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my $sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'PostgreSQL', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'PostgreSQL', + filename => $xmlfile, ) or die $sqlt->error; is($sql, << "SQL"); diff --git a/t/50-sqlserver-parser.t b/t/50-sqlserver-parser.t index 298e5f66d..6cc1067fe 100644 --- a/t/50-sqlserver-parser.t +++ b/t/50-sqlserver-parser.t @@ -13,114 +13,113 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(46, 'SQL::Translator::Parser::SQLServer'); - SQL::Translator::Parser::SQLServer->import('parse'); + maybe_plan(46, 'SQL::Translator::Parser::SQLServer'); + SQL::Translator::Parser::SQLServer->import('parse'); } my $file = "$Bin/data/sqlserver/create.sql"; -ok( -e $file, "File exists" ); +ok(-e $file, "File exists"); my $data; { - local $/; - open my $fh, "<$file" or die "Can't read file '$file': $!\n"; - $data = <$fh>; - close $fh; + local $/; + open my $fh, "<$file" or die "Can't read file '$file': $!\n"; + $data = <$fh>; + close $fh; } -ok( $data, 'Data' ); +ok($data, 'Data'); my $t = SQL::Translator->new; my $val = parse($t, $data); -is( $val, 1, 'Parse' ); +is($val, 1, 'Parse'); my $schema = $t->schema; -isa_ok( $schema, 'SQL::Translator::Schema', 'Schema' ); +isa_ok($schema, 'SQL::Translator::Schema', 'Schema'); -is( $schema->is_valid, 1, 'Schema is valid' ); +is($schema->is_valid, 1, 'Schema is valid'); my @tables = $schema->get_tables; -is( scalar @tables, 8, 'Eight tables' ); +is(scalar @tables, 8, 'Eight tables'); { - my $t = $schema->get_table( 'jdbc_function_escapes' ); - isa_ok( $t, 'SQL::Translator::Schema::Table', 'Table' ); - is( $t->name, 'jdbc_function_escapes', "Name = 'jdbc_function_escapes'" ); - - my @fields = $t->get_fields; - is( scalar @fields, 2, 'Two fields' ); - - is( $fields[0]->name, 'escape_name', "First field name is 'escape_name'" ); - is( $fields[0]->data_type, 'varchar', "First field is 'varchar'" ); - is( $fields[0]->size, 40, "First field size is '40'" ); - is( $fields[0]->is_nullable, 0, "First field cannot be null" ); - - is( $fields[1]->name, 'map_string', "Second field name is 'map_string'" ); - is( $fields[1]->data_type, 'varchar', "Second field is 'varchar'" ); - is( $fields[1]->size, 40, "Second field size is '40'" ); - is( $fields[1]->is_nullable, 0, "Second field cannot be null" ); + my $t = $schema->get_table('jdbc_function_escapes'); + isa_ok($t, 'SQL::Translator::Schema::Table', 'Table'); + is($t->name, 'jdbc_function_escapes', "Name = 'jdbc_function_escapes'"); + + my @fields = $t->get_fields; + is(scalar @fields, 2, 'Two fields'); + + is($fields[0]->name, 'escape_name', "First field name is 'escape_name'"); + is($fields[0]->data_type, 'varchar', "First field is 'varchar'"); + is($fields[0]->size, 40, "First field size is '40'"); + is($fields[0]->is_nullable, 0, "First field cannot be null"); + + is($fields[1]->name, 'map_string', "Second field name is 'map_string'"); + is($fields[1]->data_type, 'varchar', "Second field is 'varchar'"); + is($fields[1]->size, 40, "Second field size is '40'"); + is($fields[1]->is_nullable, 0, "Second field cannot be null"); } { - my $t = $schema->get_table( 'spt_jtext' ); - isa_ok( $t, 'SQL::Translator::Schema::Table', 'Table' ); - is( $t->name, 'spt_jtext', "Name = 'spt_jtext'" ); + my $t = $schema->get_table('spt_jtext'); + isa_ok($t, 'SQL::Translator::Schema::Table', 'Table'); + is($t->name, 'spt_jtext', "Name = 'spt_jtext'"); - my @fields = $t->get_fields; - is( scalar @fields, 2, 'Two fields' ); + my @fields = $t->get_fields; + is(scalar @fields, 2, 'Two fields'); - is( $fields[0]->name, 'mdinfo', "First field name is 'mdinfo'" ); - is( $fields[0]->data_type, 'varchar', "First field is 'varchar'" ); - is( $fields[0]->size, 30, "First field size is '30'" ); - is( $fields[0]->is_nullable, 0, "First field cannot be null" ); + is($fields[0]->name, 'mdinfo', "First field name is 'mdinfo'"); + is($fields[0]->data_type, 'varchar', "First field is 'varchar'"); + is($fields[0]->size, 30, "First field size is '30'"); + is($fields[0]->is_nullable, 0, "First field cannot be null"); - is( $fields[1]->name, 'value', "Second field name is 'value'" ); - is( $fields[1]->data_type, 'text', "Second field is 'text'" ); - is( $fields[1]->size, 0, "Second field size is '0'" ); - is( $fields[1]->is_nullable, 0, "Second field cannot be null" ); + is($fields[1]->name, 'value', "Second field name is 'value'"); + is($fields[1]->data_type, 'text', "Second field is 'text'"); + is($fields[1]->size, 0, "Second field size is '0'"); + is($fields[1]->is_nullable, 0, "Second field cannot be null"); - my @constraints = $t->get_constraints; - is( scalar @constraints, 1, 'One constraint' ); + my @constraints = $t->get_constraints; + is(scalar @constraints, 1, 'One constraint'); - is( $constraints[0]->type, UNIQUE, 'Constraint is UNIQUE' ); - is( join(',', $constraints[0]->fields), 'mdinfo', 'On "mdinfo"' ); + is($constraints[0]->type, UNIQUE, 'Constraint is UNIQUE'); + is(join(',', $constraints[0]->fields), 'mdinfo', 'On "mdinfo"'); } { - my $t = $schema->get_table( 'spt_mda' ); - isa_ok( $t, 'SQL::Translator::Schema::Table', 'Table' ); - is( $t->name, 'spt_mda', "Name = 'spt_mda'" ); + my $t = $schema->get_table('spt_mda'); + isa_ok($t, 'SQL::Translator::Schema::Table', 'Table'); + is($t->name, 'spt_mda', "Name = 'spt_mda'"); - my @fields = $t->get_fields; - is( scalar @fields, 7, 'Seven fields' ); + my @fields = $t->get_fields; + is(scalar @fields, 7, 'Seven fields'); - is( $fields[0]->name, 'mdinfo', "First field name is 'mdinfo'" ); - is( $fields[0]->data_type, 'varchar', "First field is 'varchar'" ); - is( $fields[0]->size, 30, "First field size is '30'" ); - is( $fields[0]->is_nullable, 0, "First field cannot be null" ); + is($fields[0]->name, 'mdinfo', "First field name is 'mdinfo'"); + is($fields[0]->data_type, 'varchar', "First field is 'varchar'"); + is($fields[0]->size, 30, "First field size is '30'"); + is($fields[0]->is_nullable, 0, "First field cannot be null"); - my @constraints = $t->get_constraints; - is( scalar @constraints, 1, 'One constraint' ); + my @constraints = $t->get_constraints; + is(scalar @constraints, 1, 'One constraint'); - is( $constraints[0]->type, UNIQUE, 'Constraint is UNIQUE' ); - is( join(',', $constraints[0]->fields), - 'mdinfo,mdaver_end,srvver_end', 'On "mdinfo,mdaver_end,srvver_end"' ); + is($constraints[0]->type, UNIQUE, 'Constraint is UNIQUE'); + is(join(',', $constraints[0]->fields), 'mdinfo,mdaver_end,srvver_end', 'On "mdinfo,mdaver_end,srvver_end"'); } # New testing for views and procedures my @views = $schema->get_views; -is( scalar @views, 1, 'One view' ); +is(scalar @views, 1, 'One view'); like($views[0]->sql, qr/vs_xdp_data/, "Detected view vs_xdp_data"); my @procedures = $schema->get_procedures; -is( scalar @procedures, 10, 'Ten procedures' ); -like($procedures[8]->sql, qr/Tx_B_Get_Vlan/, "Detected procedure Tx_B_Get_Vlan"); +is(scalar @procedures, 10, 'Ten procedures'); +like($procedures[8]->sql, qr/Tx_B_Get_Vlan/, "Detected procedure Tx_B_Get_Vlan"); like($procedures[9]->sql, qr/\[dbo\].inet_ntoa/, "Detected function [dbo].inet_ntoa"); diff --git a/t/51-xml-to-oracle.t b/t/51-xml-to-oracle.t index d6049c1d3..bca287074 100644 --- a/t/51-xml-to-oracle.t +++ b/t/51-xml-to-oracle.t @@ -11,40 +11,39 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::Oracle'); } my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - no_comments => 1, - quote_table_names => 0, - quote_field_names => 0, - show_warnings => 0, - add_drop_table => 1, + no_comments => 1, + quote_table_names => 0, + quote_field_names => 0, + show_warnings => 0, + add_drop_table => 1, ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my @sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'Oracle', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'Oracle', + filename => $xmlfile, ) or die $sqlt->error; my $sql_string = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'Oracle', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'Oracle', + filename => $xmlfile, ) or die $sqlt->error; my $want = [ -'DROP TABLE Basic CASCADE CONSTRAINTS', - 'DROP SEQUENCE sq_Basic_id', - 'CREATE SEQUENCE sq_Basic_id', - 'CREATE TABLE Basic ( + 'DROP TABLE Basic CASCADE CONSTRAINTS', + 'DROP SEQUENCE sq_Basic_id', + 'CREATE SEQUENCE sq_Basic_id', + 'CREATE TABLE Basic ( id number(10) NOT NULL, title varchar2(100) DEFAULT \'hello\' NOT NULL, description clob DEFAULT \'\', @@ -58,19 +57,19 @@ my $want = [ CONSTRAINT u_Basic_emailuniqueindex UNIQUE (email), CONSTRAINT u_Basic_very_long_index_name_o UNIQUE (title) )', -'DROP TABLE Another CASCADE CONSTRAINTS', -'DROP SEQUENCE sq_Another_id', -'CREATE SEQUENCE sq_Another_id', -'CREATE TABLE Another ( + 'DROP TABLE Another CASCADE CONSTRAINTS', + 'DROP SEQUENCE sq_Another_id', + 'CREATE SEQUENCE sq_Another_id', + 'CREATE TABLE Another ( id number(10) NOT NULL, num number(10,2), PRIMARY KEY (id) )', -'DROP VIEW email_list', -'CREATE VIEW email_list AS + 'DROP VIEW email_list', + 'CREATE VIEW email_list AS SELECT email FROM Basic WHERE (email IS NOT NULL)', -'ALTER TABLE Basic ADD CONSTRAINT Basic_another_id_fk FOREIGN KEY (another_id) REFERENCES Another (id)', -'CREATE OR REPLACE TRIGGER ai_Basic_id + 'ALTER TABLE Basic ADD CONSTRAINT Basic_another_id_fk FOREIGN KEY (another_id) REFERENCES Another (id)', + 'CREATE OR REPLACE TRIGGER ai_Basic_id BEFORE INSERT ON Basic FOR EACH ROW WHEN ( new.id IS NULL OR new.id = 0 @@ -81,7 +80,7 @@ BEGIN FROM dual; END; ', -'CREATE OR REPLACE TRIGGER ai_Another_id + 'CREATE OR REPLACE TRIGGER ai_Another_id BEFORE INSERT ON Another FOR EACH ROW WHEN ( new.id IS NULL OR new.id = 0 @@ -92,11 +91,13 @@ BEGIN FROM dual; END; ', -'CREATE INDEX titleindex ON Basic (title)']; + 'CREATE INDEX titleindex ON Basic (title)' +]; is_deeply(\@sql, $want, 'Got correct Oracle statements in list context'); -eq_or_diff($sql_string, q|DROP TABLE Basic CASCADE CONSTRAINTS; +eq_or_diff( + $sql_string, q|DROP TABLE Basic CASCADE CONSTRAINTS; DROP SEQUENCE sq_Basic_id01; @@ -162,4 +163,5 @@ BEGIN END; / -|); +| +); diff --git a/t/51-xml-to-oracle_quoted.t b/t/51-xml-to-oracle_quoted.t index 5bbacf14e..bca4732d5 100644 --- a/t/51-xml-to-oracle_quoted.t +++ b/t/51-xml-to-oracle_quoted.t @@ -11,40 +11,39 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::Oracle'); } my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - no_comments => 1, - quote_table_names => 1, - quote_field_names => 1, - show_warnings => 0, - add_drop_table => 1, + no_comments => 1, + quote_table_names => 1, + quote_field_names => 1, + show_warnings => 0, + add_drop_table => 1, ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my @sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'Oracle', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'Oracle', + filename => $xmlfile, ) or die $sqlt->error; my $sql_string = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'Oracle', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'Oracle', + filename => $xmlfile, ) or die $sqlt->error; my $want = [ -'DROP TABLE "Basic" CASCADE CONSTRAINTS', -'DROP SEQUENCE "sq_Basic_id"', -'CREATE SEQUENCE "sq_Basic_id"', -'CREATE TABLE "Basic" ( + 'DROP TABLE "Basic" CASCADE CONSTRAINTS', + 'DROP SEQUENCE "sq_Basic_id"', + 'CREATE SEQUENCE "sq_Basic_id"', + 'CREATE TABLE "Basic" ( "id" number(10) NOT NULL, "title" varchar2(100) DEFAULT \'hello\' NOT NULL, "description" clob DEFAULT \'\', @@ -58,19 +57,19 @@ my $want = [ CONSTRAINT "u_Basic_emailuniqueindex" UNIQUE ("email"), CONSTRAINT "u_Basic_very_long_index_name_o" UNIQUE ("title") )', -'DROP TABLE "Another" CASCADE CONSTRAINTS', -'DROP SEQUENCE "sq_Another_id"', -'CREATE SEQUENCE "sq_Another_id"', -'CREATE TABLE "Another" ( + 'DROP TABLE "Another" CASCADE CONSTRAINTS', + 'DROP SEQUENCE "sq_Another_id"', + 'CREATE SEQUENCE "sq_Another_id"', + 'CREATE TABLE "Another" ( "id" number(10) NOT NULL, "num" number(10,2), PRIMARY KEY ("id") )', -'DROP VIEW "email_list"', -'CREATE VIEW "email_list" AS + 'DROP VIEW "email_list"', + 'CREATE VIEW "email_list" AS SELECT email FROM Basic WHERE (email IS NOT NULL)', -'ALTER TABLE "Basic" ADD CONSTRAINT "Basic_another_id_fk" FOREIGN KEY ("another_id") REFERENCES "Another" ("id")', -'CREATE OR REPLACE TRIGGER "ai_Basic_id" + 'ALTER TABLE "Basic" ADD CONSTRAINT "Basic_another_id_fk" FOREIGN KEY ("another_id") REFERENCES "Another" ("id")', + 'CREATE OR REPLACE TRIGGER "ai_Basic_id" BEFORE INSERT ON "Basic" FOR EACH ROW WHEN ( new."id" IS NULL OR new."id" = 0 @@ -81,7 +80,7 @@ BEGIN FROM dual; END; ', -'CREATE OR REPLACE TRIGGER "ai_Another_id" + 'CREATE OR REPLACE TRIGGER "ai_Another_id" BEFORE INSERT ON "Another" FOR EACH ROW WHEN ( new."id" IS NULL OR new."id" = 0 @@ -92,11 +91,13 @@ BEGIN FROM dual; END; ', -'CREATE INDEX "titleindex" ON "Basic" ("title")']; + 'CREATE INDEX "titleindex" ON "Basic" ("title")' +]; is_deeply(\@sql, $want, 'Got correct Oracle statements in list context'); -eq_or_diff($sql_string, q|DROP TABLE "Basic" CASCADE CONSTRAINTS; +eq_or_diff( + $sql_string, q|DROP TABLE "Basic" CASCADE CONSTRAINTS; DROP SEQUENCE "sq_Basic_id01"; @@ -162,4 +163,5 @@ BEGIN END; / -|); +| +); diff --git a/t/52-oracle-options.t b/t/52-oracle-options.t index c9ba5ef1d..c8264cef6 100644 --- a/t/52-oracle-options.t +++ b/t/52-oracle-options.t @@ -10,22 +10,21 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(3, 'SQL::Translator::Parser::YAML', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(3, 'SQL::Translator::Parser::YAML', 'SQL::Translator::Producer::Oracle'); } my $yamlfile = "$Bin/data/oracle/schema_with_options.yaml"; my $sqlt; $sqlt = SQL::Translator->new( - show_warnings => 0, - add_drop_table => 0, + show_warnings => 0, + add_drop_table => 0, ); my $sql_string = $sqlt->translate( - from => 'YAML', - to => 'Oracle', - filename => $yamlfile, + from => 'YAML', + to => 'Oracle', + filename => $yamlfile, ); ok($sql_string, 'Translation successfull'); diff --git a/t/53-oracle-delay-constraints.t b/t/53-oracle-delay-constraints.t index bdc3362fa..36c21d1f0 100644 --- a/t/53-oracle-delay-constraints.t +++ b/t/53-oracle-delay-constraints.t @@ -10,26 +10,25 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(2, 'SQL::Translator::Parser::YAML', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(2, 'SQL::Translator::Parser::YAML', 'SQL::Translator::Producer::Oracle'); } my $yamlfile = "$Bin/data/oracle/schema_with_options.yaml"; my $sqlt; $sqlt = SQL::Translator->new( - show_warnings => 0, - add_drop_table => 0, - producer_args => { 'delay_constraints' => 1 }, - quote_table_names => 0, - quote_field_names => 0, + show_warnings => 0, + add_drop_table => 0, + producer_args => { 'delay_constraints' => 1 }, + quote_table_names => 0, + quote_field_names => 0, ); my $sql_string = $sqlt->translate( - from => 'YAML', - to => 'Oracle', - filename => $yamlfile, + from => 'YAML', + to => 'Oracle', + filename => $yamlfile, ); -ok($sql_string, 'Translation successfull'); +ok($sql_string, 'Translation successfull'); ok($sql_string =~ /ADD CONSTRAINT pk_d_operator PRIMARY KEY/, 'constraints delayed'); diff --git a/t/53-oracle-delay-constraints_quoted.t b/t/53-oracle-delay-constraints_quoted.t index 1d3299bcf..c45433938 100644 --- a/t/53-oracle-delay-constraints_quoted.t +++ b/t/53-oracle-delay-constraints_quoted.t @@ -10,26 +10,25 @@ use SQL::Translator; use SQL::Translator::Schema::Constants; BEGIN { - maybe_plan(2, 'SQL::Translator::Parser::YAML', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(2, 'SQL::Translator::Parser::YAML', 'SQL::Translator::Producer::Oracle'); } my $yamlfile = "$Bin/data/oracle/schema_with_options.yaml"; my $sqlt; $sqlt = SQL::Translator->new( - show_warnings => 0, - add_drop_table => 0, - producer_args => { 'delay_constraints' => 1 }, - quote_table_names => 1, - quote_field_names => 1, + show_warnings => 0, + add_drop_table => 0, + producer_args => { 'delay_constraints' => 1 }, + quote_table_names => 1, + quote_field_names => 1, ); my $sql_string = $sqlt->translate( - from => 'YAML', - to => 'Oracle', - filename => $yamlfile, + from => 'YAML', + to => 'Oracle', + filename => $yamlfile, ); -ok($sql_string, 'Translation successfull'); +ok($sql_string, 'Translation successfull'); ok($sql_string =~ /ADD CONSTRAINT "pk_d_operator" PRIMARY KEY/, 'constraints delayed'); diff --git a/t/54-oracle-alter-constraint.t b/t/54-oracle-alter-constraint.t index 1dd6cb5da..e7058d9ea 100644 --- a/t/54-oracle-alter-constraint.t +++ b/t/54-oracle-alter-constraint.t @@ -9,40 +9,37 @@ use SQL::Translator; use SQL::Translator::Diff; BEGIN { - maybe_plan(6, 'SQL::Translator::Parser::YAML', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(6, 'SQL::Translator::Parser::YAML', 'SQL::Translator::Producer::Oracle'); } -my $schema1 = $Bin.'/data/oracle/schema_diff_d.yaml'; -my $schema2 = $Bin.'/data/oracle/schema_diff_e.yaml'; +my $schema1 = $Bin . '/data/oracle/schema_diff_d.yaml'; +my $schema2 = $Bin . '/data/oracle/schema_diff_e.yaml'; open my $io1, '<', $schema1 or die $!; open my $io2, '<', $schema2 or die $!; my ($yaml1, $yaml2); { - local $/ = undef; - $yaml1 = <$io1>; - $yaml2 = <$io2>; + local $/ = undef; + $yaml1 = <$io1>; + $yaml2 = <$io2>; }; close $io1; close $io2; my $s = SQL::Translator->new(from => 'YAML'); -$s->parser->($s,$yaml1); +$s->parser->($s, $yaml1); my $t = SQL::Translator->new(from => 'YAML'); -$t->parser->($t,$yaml2); - -my $d = SQL::Translator::Diff->new - ({ - output_db => 'Oracle', - target_db => 'Oracle', - source_schema => $s->schema, - target_schema => $t->schema, - }); - +$t->parser->($t, $yaml2); + +my $d = SQL::Translator::Diff->new({ + output_db => 'Oracle', + target_db => 'Oracle', + source_schema => $s->schema, + target_schema => $t->schema, +}); my $diff = $d->compute_differences->produce_diff_sql || die $d->error; diff --git a/t/54-oracle-alter-field.t b/t/54-oracle-alter-field.t index 38b37b961..93f6c1216 100644 --- a/t/54-oracle-alter-field.t +++ b/t/54-oracle-alter-field.t @@ -9,45 +9,40 @@ use SQL::Translator; use SQL::Translator::Diff; BEGIN { - maybe_plan(3, 'SQL::Translator::Parser::YAML', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(3, 'SQL::Translator::Parser::YAML', 'SQL::Translator::Producer::Oracle'); } -my $schema1 = $Bin.'/data/oracle/schema_diff_a.yaml'; -my $schema2 = $Bin.'/data/oracle/schema_diff_b.yaml'; +my $schema1 = $Bin . '/data/oracle/schema_diff_a.yaml'; +my $schema2 = $Bin . '/data/oracle/schema_diff_b.yaml'; open my $io1, '<', $schema1 or die $!; open my $io2, '<', $schema2 or die $!; my ($yaml1, $yaml2); { - local $/ = undef; - $yaml1 = <$io1>; - $yaml2 = <$io2>; + local $/ = undef; + $yaml1 = <$io1>; + $yaml2 = <$io2>; }; close $io1; close $io2; my $s = SQL::Translator->new(from => 'YAML'); -$s->parser->($s,$yaml1); +$s->parser->($s, $yaml1); my $t = SQL::Translator->new(from => 'YAML'); -$t->parser->($t,$yaml2); - -my $d = SQL::Translator::Diff->new - ({ - output_db => 'Oracle', - target_db => 'Oracle', - source_schema => $s->schema, - target_schema => $t->schema, - }); +$t->parser->($t, $yaml2); +my $d = SQL::Translator::Diff->new({ + output_db => 'Oracle', + target_db => 'Oracle', + source_schema => $s->schema, + target_schema => $t->schema, +}); my $diff = $d->compute_differences->produce_diff_sql || die $d->error; ok($diff, 'Diff generated.'); -like($diff, '/ALTER TABLE d_operator MODIFY \( name nvarchar2\(10\) NULL \)/', - 'Alter table generated.'); -like($diff, '/ALTER TABLE d_operator MODIFY \( other nvarchar2\(10\) NOT NULL \)/', - 'Alter table generated.'); +like($diff, '/ALTER TABLE d_operator MODIFY \( name nvarchar2\(10\) NULL \)/', 'Alter table generated.'); +like($diff, '/ALTER TABLE d_operator MODIFY \( other nvarchar2\(10\) NOT NULL \)/', 'Alter table generated.'); diff --git a/t/54-oracle-sql-diff.t b/t/54-oracle-sql-diff.t index 20aba524c..b7be2a276 100644 --- a/t/54-oracle-sql-diff.t +++ b/t/54-oracle-sql-diff.t @@ -9,38 +9,37 @@ use SQL::Translator; use SQL::Translator::Diff; BEGIN { - maybe_plan(11, 'SQL::Translator::Producer::Oracle'); + maybe_plan(11, 'SQL::Translator::Producer::Oracle'); } -my $schema1 = $Bin.'/data/oracle/schema-1.5.sql'; -my $schema2 = $Bin.'/data/oracle/schema-1.6.sql'; +my $schema1 = $Bin . '/data/oracle/schema-1.5.sql'; +my $schema2 = $Bin . '/data/oracle/schema-1.6.sql'; open my $io1, '<', $schema1 or die $!; open my $io2, '<', $schema2 or die $!; my ($yaml1, $yaml2); { - local $/ = undef; - $sql1 = <$io1>; - $sql2 = <$io2>; + local $/ = undef; + $sql1 = <$io1>; + $sql2 = <$io2>; }; close $io1; close $io2; my $s = SQL::Translator->new(from => 'Oracle'); -$s->parser->($s,$sql1); +$s->parser->($s, $sql1); my $t = SQL::Translator->new(from => 'Oracle', debug => 1); -$t->parser->($t,$sql2); +$t->parser->($t, $sql2); -my $d = SQL::Translator::Diff->new - ({ - output_db => 'Oracle', - source_schema => $s->schema, - target_schema => $t->schema, - sqlt_args => {quote_identifiers => 0} - }); +my $d = SQL::Translator::Diff->new({ + output_db => 'Oracle', + source_schema => $s->schema, + target_schema => $t->schema, + sqlt_args => { quote_identifiers => 0 } +}); my $diff = $d->compute_differences->produce_diff_sql || die $d->error; @@ -50,9 +49,17 @@ like($diff, '/CREATE TABLE t_group/', 'CREATE TABLE t_group generated'); like($diff, '/ALTER TABLE t_category DROP PRIMARY KEY/', 'Drop PRIMARY KEY generated'); -like($diff, '/ALTER TABLE t_category DROP CONSTRAINT t_category_display_name/', 'DROP constraint t_category_display_name generated'); +like( + $diff, + '/ALTER TABLE t_category DROP CONSTRAINT t_category_display_name/', + 'DROP constraint t_category_display_name generated' +); -like($diff, '/ALTER TABLE t_user_groups DROP CONSTRAINT t_user_groups_group_id_fk/', 'DROP FOREIGN KEY constraint generated'); +like( + $diff, + '/ALTER TABLE t_user_groups DROP CONSTRAINT t_user_groups_group_id_fk/', + 'DROP FOREIGN KEY constraint generated' +); like($diff, '/DROP INDEX t_alert_roles_idx_alert_id/', 'DROP INDEX generated'); @@ -60,8 +67,16 @@ like($diff, '/ALTER TABLE t_message MODIFY \( alert_id number\(11\) \)/', 'MODIF like($diff, '/CREATE INDEX t_user_groups_idx_user_id ON t_user_groups \(user_id\)/', 'CREATE INDEX generated'); -like($diff, '/ALTER TABLE t_user_groups ADD CONSTRAINT t_user_groups_group_id_fk FOREIGN KEY \(group_id\) REFERENCES t_group \(group_id\) ON DELETE CASCADE/', 'ADD FOREIGN KEY constraint generated'); +like( + $diff, + '/ALTER TABLE t_user_groups ADD CONSTRAINT t_user_groups_group_id_fk FOREIGN KEY \(group_id\) REFERENCES t_group \(group_id\) ON DELETE CASCADE/', + 'ADD FOREIGN KEY constraint generated' +); -like($diff, '/ALTER TABLE t_population_group DROP CONSTRAINT t_population_group_group_role_fk/', 'DROP FOREIGN KEY before drop table generated'); +like( + $diff, + '/ALTER TABLE t_population_group DROP CONSTRAINT t_population_group_group_role_fk/', + 'DROP FOREIGN KEY before drop table generated' +); -like($diff, '/DROP TABLE t_population_group/', 'DROP TABLE generated'); \ No newline at end of file +like($diff, '/DROP TABLE t_population_group/', 'DROP TABLE generated'); diff --git a/t/55-oracle-add-drop-field.t b/t/55-oracle-add-drop-field.t index b7f74f2b9..224ea3246 100644 --- a/t/55-oracle-add-drop-field.t +++ b/t/55-oracle-add-drop-field.t @@ -9,43 +9,40 @@ use SQL::Translator; use SQL::Translator::Diff; BEGIN { - maybe_plan(3, 'SQL::Translator::Parser::YAML', - 'SQL::Translator::Producer::Oracle'); + maybe_plan(3, 'SQL::Translator::Parser::YAML', 'SQL::Translator::Producer::Oracle'); } -my $schema1 = $Bin.'/data/oracle/schema_diff_b.yaml'; -my $schema2 = $Bin.'/data/oracle/schema_diff_c.yaml'; +my $schema1 = $Bin . '/data/oracle/schema_diff_b.yaml'; +my $schema2 = $Bin . '/data/oracle/schema_diff_c.yaml'; open my $io1, '<', $schema1 or die $!; open my $io2, '<', $schema2 or die $!; my ($yaml1, $yaml2); { - local $/ = undef; - $yaml1 = <$io1>; - $yaml2 = <$io2>; + local $/ = undef; + $yaml1 = <$io1>; + $yaml2 = <$io2>; }; close $io1; close $io2; my $s = SQL::Translator->new(from => 'YAML'); -$s->parser->($s,$yaml1); +$s->parser->($s, $yaml1); my $t = SQL::Translator->new(from => 'YAML'); -$t->parser->($t,$yaml2); - -my $d = SQL::Translator::Diff->new - ({ - output_db => 'Oracle', - source_schema => $s->schema, - target_schema => $t->schema, - }); +$t->parser->($t, $yaml2); +my $d = SQL::Translator::Diff->new({ + output_db => 'Oracle', + source_schema => $s->schema, + target_schema => $t->schema, +}); my $diff = $d->compute_differences->produce_diff_sql || die $d->error; ok($diff, 'Diff generated.'); -like($diff, '/ALTER TABLE d_operator DROP COLUMN bar/', 'DROP column generated.'); +like($diff, '/ALTER TABLE d_operator DROP COLUMN bar/', 'DROP column generated.'); like($diff, '/ALTER TABLE d_operator ADD \( foo nvarchar2\(10\) NOT NULL \)/', 'ADD column generated.'); diff --git a/t/55-oracle-producer.t b/t/55-oracle-producer.t index efc98d06d..e184838da 100644 --- a/t/55-oracle-producer.t +++ b/t/55-oracle-producer.t @@ -13,101 +13,102 @@ use SQL::Translator::Schema::Constraint; use SQL::Translator::Producer::Oracle; { - my $table1 = SQL::Translator::Schema::Table->new( name => 'table1' ); - - my $table1_field1 = $table1->add_field( - name => 'fk_col1', - data_type => 'NUMBER', - size => 6, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 1, - is_unique => 0 - ); - - my $table1_field2 = $table1->add_field( - name => 'fk_col2', - data_type => 'VARCHAR', - size => 64, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 1, - is_unique => 0 - ); - - my $table2 = SQL::Translator::Schema::Table->new( name => 'table2' ); - - my $table2_field1 = $table2->add_field( - name => 'fk_col1', - data_type => 'NUMBER', - size => 6, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 - ); - - my $table2_field2 = $table2->add_field( - name => 'fk_col2', - data_type => 'VARCHAR', - size => 64, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 - ); - - my $constraint1 = $table1->add_constraint( - name => 'foo', - fields => [qw/ fk_col1 fk_col2 /], - reference_fields => [qw/ fk_col1 fk_col2 /], - reference_table => 'table2', - type => FOREIGN_KEY, - ); - - my $index1 = $table1->add_index(name => 'myfooindex', fields => ['foo']); - my $index2 = $table1->add_index(name => 'mybarindex', fields => [ { name => 'bar', prefix_length => 10 } ]); - - my ($table1_def, $fk1_def, $trigger1_def, - $index1_def, $constraint1_def - ) = SQL::Translator::Producer::Oracle::create_table($table1); - - is_deeply( - $fk1_def, - [ 'ALTER TABLE table1 ADD CONSTRAINT table1_fk_col1_fk_col2_fk FOREIGN KEY (fk_col1, fk_col2) REFERENCES table2 (fk_col1, fk_col2)' - ], - 'correct "CREATE CONSTRAINT" SQL' - ); - - is_deeply( - $index1_def, - [ 'CREATE INDEX myfooindex ON table1 (foo)', - 'CREATE INDEX mybarindex ON table1 (bar)' - ], - 'correct "CREATE INDEX" SQL' - ); - - my $materialized_view = SQL::Translator::Schema::View->new( - name => 'matview', - sql => 'SELECT id, name FROM table3', - fields => 'id, name', - extra => { - materialized => - 'REFRESH START WITH SYSDATE NEXT SYSDATE + 5/1440 FORCE WITH ROWID' - } - ); - - my ($materialized_view_def) = SQL::Translator::Producer::Oracle::create_view($materialized_view); - is_deeply( - $materialized_view_def, - [ "CREATE MATERIALIZED VIEW matview REFRESH START WITH SYSDATE NEXT SYSDATE + 5/1440 FORCE WITH ROWID AS\nSELECT id, name FROM table3" - ], - 'correct "CREATE MATERIALZED VIEW" SQL' - ); + my $table1 = SQL::Translator::Schema::Table->new(name => 'table1'); + + my $table1_field1 = $table1->add_field( + name => 'fk_col1', + data_type => 'NUMBER', + size => 6, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 1, + is_unique => 0 + ); + + my $table1_field2 = $table1->add_field( + name => 'fk_col2', + data_type => 'VARCHAR', + size => 64, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 1, + is_unique => 0 + ); + + my $table2 = SQL::Translator::Schema::Table->new(name => 'table2'); + + my $table2_field1 = $table2->add_field( + name => 'fk_col1', + data_type => 'NUMBER', + size => 6, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 + ); + + my $table2_field2 = $table2->add_field( + name => 'fk_col2', + data_type => 'VARCHAR', + size => 64, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 + ); + + my $constraint1 = $table1->add_constraint( + name => 'foo', + fields => [qw/ fk_col1 fk_col2 /], + reference_fields => [qw/ fk_col1 fk_col2 /], + reference_table => 'table2', + type => FOREIGN_KEY, + ); + + my $index1 = $table1->add_index(name => 'myfooindex', fields => ['foo']); + my $index2 = $table1->add_index( + name => 'mybarindex', + fields => [ { name => 'bar', prefix_length => 10 } ] + ); + + my ($table1_def, $fk1_def, $trigger1_def, $index1_def, $constraint1_def) + = SQL::Translator::Producer::Oracle::create_table($table1); + + is_deeply( + $fk1_def, + [ + 'ALTER TABLE table1 ADD CONSTRAINT table1_fk_col1_fk_col2_fk FOREIGN KEY (fk_col1, fk_col2) REFERENCES table2 (fk_col1, fk_col2)' + ], + 'correct "CREATE CONSTRAINT" SQL' + ); + + is_deeply( + $index1_def, + [ 'CREATE INDEX myfooindex ON table1 (foo)', 'CREATE INDEX mybarindex ON table1 (bar)' ], + 'correct "CREATE INDEX" SQL' + ); + + my $materialized_view = SQL::Translator::Schema::View->new( + name => 'matview', + sql => 'SELECT id, name FROM table3', + fields => 'id, name', + extra => { + materialized => 'REFRESH START WITH SYSDATE NEXT SYSDATE + 5/1440 FORCE WITH ROWID' + } + ); + + my ($materialized_view_def) = SQL::Translator::Producer::Oracle::create_view($materialized_view); + is_deeply( + $materialized_view_def, + [ + "CREATE MATERIALIZED VIEW matview REFRESH START WITH SYSDATE NEXT SYSDATE + 5/1440 FORCE WITH ROWID AS\nSELECT id, name FROM table3" + ], + 'correct "CREATE MATERIALZED VIEW" SQL' + ); } diff --git a/t/56-sqlite-producer.t b/t/56-sqlite-producer.t index ac87f60aa..49086d97c 100644 --- a/t/56-sqlite-producer.t +++ b/t/56-sqlite-producer.t @@ -12,249 +12,255 @@ use SQL::Translator::Producer::SQLite; $SQL::Translator::Producer::SQLite::NO_QUOTES = 0; { - my $view1 = SQL::Translator::Schema::View->new( name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing', - extra => { - temporary => 1, - if_not_exists => 1, - }); + my $view1 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', + extra => { + temporary => 1, + if_not_exists => 1, + } + ); my $create_opts = { no_comments => 1 }; - my $view1_sql1 = [ SQL::Translator::Producer::SQLite::create_view($view1, $create_opts) ]; + my $view1_sql1 = [ SQL::Translator::Producer::SQLite::create_view($view1, $create_opts) ]; - my $view_sql_replace = [ 'CREATE TEMPORARY VIEW IF NOT EXISTS "view_foo" AS - SELECT id, name FROM thing' ]; + my $view_sql_replace = [ + 'CREATE TEMPORARY VIEW IF NOT EXISTS "view_foo" AS + SELECT id, name FROM thing' + ]; is_deeply($view1_sql1, $view_sql_replace, 'correct "CREATE TEMPORARY VIEW" SQL'); + my $view2 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', + ); - my $view2 = SQL::Translator::Schema::View->new( name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing',); - - my $view1_sql2 = [ SQL::Translator::Producer::SQLite::create_view($view2, $create_opts) ]; - my $view_sql_noreplace = [ 'CREATE VIEW "view_foo" AS - SELECT id, name FROM thing' ]; + my $view1_sql2 = [ SQL::Translator::Producer::SQLite::create_view($view2, $create_opts) ]; + my $view_sql_noreplace = [ + 'CREATE VIEW "view_foo" AS + SELECT id, name FROM thing' + ]; is_deeply($view1_sql2, $view_sql_noreplace, 'correct "CREATE VIEW" SQL'); } { - my $create_opts; + my $create_opts; - my $table = SQL::Translator::Schema::Table->new( - name => 'foo_table', - ); - $table->add_field( - name => 'foreign_key', - data_type => 'integer', - default_value => 1, - ); - my $constraint = SQL::Translator::Schema::Constraint->new( - table => $table, - name => 'fk', - type => 'FOREIGN_KEY', - fields => ['foreign_key'], - reference_fields => ['id'], - reference_table => 'foo', - on_delete => 'RESTRICT', - on_update => 'CASCADE', - ); - my $expected = [ 'FOREIGN KEY ("foreign_key") REFERENCES "foo"("id") ON DELETE RESTRICT ON UPDATE CASCADE']; - my $result = [SQL::Translator::Producer::SQLite::create_foreignkey($constraint,$create_opts)]; - is_deeply($result, $expected, 'correct "FOREIGN KEY"'); + my $table = SQL::Translator::Schema::Table->new(name => 'foo_table',); + $table->add_field( + name => 'foreign_key', + data_type => 'integer', + default_value => 1, + ); + my $constraint = SQL::Translator::Schema::Constraint->new( + table => $table, + name => 'fk', + type => 'FOREIGN_KEY', + fields => ['foreign_key'], + reference_fields => ['id'], + reference_table => 'foo', + on_delete => 'RESTRICT', + on_update => 'CASCADE', + ); + my $expected = ['FOREIGN KEY ("foreign_key") REFERENCES "foo"("id") ON DELETE RESTRICT ON UPDATE CASCADE']; + my $result = [ SQL::Translator::Producer::SQLite::create_foreignkey($constraint, $create_opts) ]; + is_deeply($result, $expected, 'correct "FOREIGN KEY"'); } { - my $table = SQL::Translator::Schema::Table->new( - name => 'foo_table', - ); - $table->add_field( - name => 'id', - data_type => 'integer', - default_value => 1, - ); - my $expected = [ qq]; - my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })]; - is_deeply($result, $expected, 'correctly unquoted DEFAULT'); + my $table = SQL::Translator::Schema::Table->new(name => 'foo_table',); + $table->add_field( + name => 'id', + data_type => 'integer', + default_value => 1, + ); + my $expected = [qq]; + my $result = [ SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 }) ]; + is_deeply($result, $expected, 'correctly unquoted DEFAULT'); } { - my $table = SQL::Translator::Schema::Table->new( - name => 'foo', - ); - $table->add_field( - name => 'data', - data_type => 'bytea', - ); - $table->add_field( - name => 'data2', - data_type => 'set', - ); - $table->add_field( - name => 'data2', - data_type => 'set', - ); - $table->add_field( - name => 'data3', - data_type => 'text', - size => 30, - ); - $table->add_field( - name => 'data4', - data_type => 'blob', - size => 30, - ); - my $expected = [ qqnew(name => 'foo',); + $table->add_field( + name => 'data', + data_type => 'bytea', + ); + $table->add_field( + name => 'data2', + data_type => 'set', + ); + $table->add_field( + name => 'data2', + data_type => 'set', + ); + $table->add_field( + name => 'data3', + data_type => 'text', + size => 30, + ); + $table->add_field( + name => 'data4', + data_type => 'blob', + size => 30, + ); + my $expected = [ + qq]; - my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })]; - is_deeply($result, $expected, 'correctly translated bytea to blob'); +)> + ]; + my $result = [ SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 }) ]; + is_deeply($result, $expected, 'correctly translated bytea to blob'); } { - my $table = SQL::Translator::Schema::Table->new( - name => 'foo_table', - ); - $table->add_field( - name => 'id', - data_type => 'integer', - default_value => \'gunshow', - ); - my $expected = [ qq]; - my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })]; - is_deeply($result, $expected, 'correctly unquoted DEFAULT'); + my $table = SQL::Translator::Schema::Table->new(name => 'foo_table',); + $table->add_field( + name => 'id', + data_type => 'integer', + default_value => \'gunshow', + ); + my $expected = [qq]; + my $result = [ SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 }) ]; + is_deeply($result, $expected, 'correctly unquoted DEFAULT'); } { - my $table = SQL::Translator::Schema::Table->new( - name => 'foo_table', - ); - $table->add_field( - name => 'id', - data_type => 'integer', - default_value => 'frew', - ); - my $expected = [ qq]; - my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })]; - is_deeply($result, $expected, 'correctly quoted DEFAULT'); + my $table = SQL::Translator::Schema::Table->new(name => 'foo_table',); + $table->add_field( + name => 'id', + data_type => 'integer', + default_value => 'frew', + ); + my $expected = [qq]; + my $result = [ SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 }) ]; + is_deeply($result, $expected, 'correctly quoted DEFAULT'); } { - my $table = SQL::Translator::Schema::Table->new( - name => 'foo', - ); - $table->add_field( - name => 'id', - data_type => 'integer', - default_value => 'NULL', - ); - $table->add_field( - name => 'when', - default_value => 'now()', - ); - $table->add_field( - name => 'at', - default_value => 'CURRENT_TIMESTAMP', - ); - my $expected = [ qqnew(name => 'foo',); + $table->add_field( + name => 'id', + data_type => 'integer', + default_value => 'NULL', + ); + $table->add_field( + name => 'when', + default_value => 'now()', + ); + $table->add_field( + name => 'at', + default_value => 'CURRENT_TIMESTAMP', + ); + my $expected = [ + qq]; - my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })]; - is_deeply($result, $expected, 'correctly unquoted excempted DEFAULTs'); +)> + ]; + my $result = [ SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 }) ]; + is_deeply($result, $expected, 'correctly unquoted excempted DEFAULTs'); } { - my $table = SQL::Translator::Schema::Table->new( - name => 'some_table', - ); - $table->add_field( - name => 'id', - data_type => 'integer', - is_auto_increment => 1, - is_nullable => 0, - extra => { - auto_increment_type => 'monotonic', - }, - ); - $table->primary_key('id'); - my $expected = [ qq]; - my $result = [SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 })]; - is_deeply($result, $expected, 'correctly built monotonicly autoincremened PK'); + my $table = SQL::Translator::Schema::Table->new(name => 'some_table',); + $table->add_field( + name => 'id', + data_type => 'integer', + is_auto_increment => 1, + is_nullable => 0, + extra => { + auto_increment_type => 'monotonic', + }, + ); + $table->primary_key('id'); + my $expected = [qq]; + my $result = [ SQL::Translator::Producer::SQLite::create_table($table, { no_comments => 1 }) ]; + is_deeply($result, $expected, 'correctly built monotonicly autoincremened PK'); } { - my $table = SQL::Translator::Schema::Table->new( name => 'foobar', fields => ['foo'] ); + my $table = SQL::Translator::Schema::Table->new( + name => 'foobar', + fields => ['foo'] + ); - { - my $index = $table->add_index(name => 'myindex', fields => ['foo']); - my ($def) = SQL::Translator::Producer::SQLite::create_index($index); - is($def, 'CREATE INDEX "myindex" ON "foobar" ("foo")', 'index created'); - } + { + my $index = $table->add_index(name => 'myindex', fields => ['foo']); + my ($def) = SQL::Translator::Producer::SQLite::create_index($index); + is($def, 'CREATE INDEX "myindex" ON "foobar" ("foo")', 'index created'); + } - { - my $index = $table->add_index(name => 'myindex2', fields => [ { name => 'foo', prefix_length => 15 } ]); - my ($def) = SQL::Translator::Producer::SQLite::create_index($index); - is($def, 'CREATE INDEX "myindex2" ON "foobar" ("foo")', 'index created'); - } + { + my $index = $table->add_index( + name => 'myindex2', + fields => [ { name => 'foo', prefix_length => 15 } ] + ); + my ($def) = SQL::Translator::Producer::SQLite::create_index($index); + is($def, 'CREATE INDEX "myindex2" ON "foobar" ("foo")', 'index created'); + } - { - my $index = $table->add_index(fields => ['foo']); - my ($def) = SQL::Translator::Producer::SQLite::create_index($index); - is($def, 'CREATE INDEX "foobar_idx" ON "foobar" ("foo")', 'index created'); - } + { + my $index = $table->add_index(fields => ['foo']); + my ($def) = SQL::Translator::Producer::SQLite::create_index($index); + is($def, 'CREATE INDEX "foobar_idx" ON "foobar" ("foo")', 'index created'); + } - { - my $constr = $table->add_constraint(name => 'constr', fields => ['foo']); - my ($def) = SQL::Translator::Producer::SQLite::create_constraint($constr); - is($def, 'CREATE UNIQUE INDEX "constr" ON "foobar" ("foo")', 'constraint created'); - } + { + my $constr = $table->add_constraint(name => 'constr', fields => ['foo']); + my ($def) = SQL::Translator::Producer::SQLite::create_constraint($constr); + is($def, 'CREATE UNIQUE INDEX "constr" ON "foobar" ("foo")', 'constraint created'); + } - { - my $constr = $table->add_constraint(fields => ['foo']); - my ($def) = SQL::Translator::Producer::SQLite::create_constraint($constr); - is($def, 'CREATE UNIQUE INDEX "foobar_idx02" ON "foobar" ("foo")', 'constraint created'); - } + { + my $constr = $table->add_constraint(fields => ['foo']); + my ($def) = SQL::Translator::Producer::SQLite::create_constraint($constr); + is($def, 'CREATE UNIQUE INDEX "foobar_idx02" ON "foobar" ("foo")', 'constraint created'); + } } { - my $schema = SQL::Translator::Schema->new(); - my $table = $schema->add_table( name => 'foo', fields => ['bar'] ); + my $schema = SQL::Translator::Schema->new(); + my $table = $schema->add_table(name => 'foo', fields => ['bar']); - { - my $trigger = $schema->add_trigger( - name => 'mytrigger', - perform_action_when => 'before', - database_events => 'update', - on_table => 'foo', - fields => ['bar'], - action => 'BEGIN baz() END' - ); - my ($def) = SQL::Translator::Producer::SQLite::create_trigger($trigger); - is($def, 'CREATE TRIGGER "mytrigger" before update on "foo" BEGIN baz() END', 'trigger created'); - } + { + my $trigger = $schema->add_trigger( + name => 'mytrigger', + perform_action_when => 'before', + database_events => 'update', + on_table => 'foo', + fields => ['bar'], + action => 'BEGIN baz() END' + ); + my ($def) = SQL::Translator::Producer::SQLite::create_trigger($trigger); + is($def, 'CREATE TRIGGER "mytrigger" before update on "foo" BEGIN baz() END', 'trigger created'); + } - { - my $trigger = $schema->add_trigger( - name => 'mytrigger2', - perform_action_when => 'after', - database_events => ['insert'], - on_table => 'foo', - fields => ['bar'], - action => 'baz()' - ); - my ($def) = SQL::Translator::Producer::SQLite::create_trigger($trigger); - is($def, 'CREATE TRIGGER "mytrigger2" after insert on "foo" BEGIN baz() END', 'trigger created'); - } + { + my $trigger = $schema->add_trigger( + name => 'mytrigger2', + perform_action_when => 'after', + database_events => ['insert'], + on_table => 'foo', + fields => ['bar'], + action => 'baz()' + ); + my ($def) = SQL::Translator::Producer::SQLite::create_trigger($trigger); + is($def, 'CREATE TRIGGER "mytrigger2" after insert on "foo" BEGIN baz() END', 'trigger created'); + } } { - my $table = SQL::Translator::Schema::Table->new( name => 'foobar', fields => ['foo'] ); - my $constr = $table->add_constraint(name => 'constr', expression => "foo != 'baz'"); - my ($def) = SQL::Translator::Producer::SQLite::create_check_constraint($constr); + my $table = SQL::Translator::Schema::Table->new( + name => 'foobar', + fields => ['foo'] + ); + my $constr = $table->add_constraint(name => 'constr', expression => "foo != 'baz'"); + my ($def) = SQL::Translator::Producer::SQLite::create_check_constraint($constr); - is($def, q{CONSTRAINT "constr" CHECK(foo != 'baz')}, 'check constraint created'); + is($def, q{CONSTRAINT "constr" CHECK(foo != 'baz')}, 'check constraint created'); } done_testing; diff --git a/t/57-class-dbi.t b/t/57-class-dbi.t index 26534a413..e7b838087 100644 --- a/t/57-class-dbi.t +++ b/t/57-class-dbi.t @@ -4,38 +4,40 @@ use strict; use Test::More tests => 2; use Test::SQL::Translator qw(maybe_plan); -use FindBin qw/$Bin/; +use FindBin qw/$Bin/; use SQL::Translator::Schema::View; use SQL::Translator::Producer::SQLite; { - my $view1 = SQL::Translator::Schema::View->new( - name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing', - extra => { - temporary => 1, - if_not_exists => 1, - } - ); - my $create_opts = { no_comments => 1 }; - my $view1_sql1 = - [ SQL::Translator::Producer::SQLite::create_view( $view1, $create_opts ) ]; + my $view1 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', + extra => { + temporary => 1, + if_not_exists => 1, + } + ); + my $create_opts = { no_comments => 1 }; + my $view1_sql1 = [ SQL::Translator::Producer::SQLite::create_view($view1, $create_opts) ]; - my $view_sql_replace = [ 'CREATE TEMPORARY VIEW IF NOT EXISTS view_foo AS - SELECT id, name FROM thing' ]; - is_deeply( $view1_sql1, $view_sql_replace, 'correct "CREATE TEMPORARY VIEW" SQL' ); + my $view_sql_replace = [ + 'CREATE TEMPORARY VIEW IF NOT EXISTS view_foo AS + SELECT id, name FROM thing' + ]; + is_deeply($view1_sql1, $view_sql_replace, 'correct "CREATE TEMPORARY VIEW" SQL'); - my $view2 = SQL::Translator::Schema::View->new( - name => 'view_foo', - fields => [qw/id name/], - sql => 'SELECT id, name FROM thing', - ); + my $view2 = SQL::Translator::Schema::View->new( + name => 'view_foo', + fields => [qw/id name/], + sql => 'SELECT id, name FROM thing', + ); - my $view1_sql2 = - [ SQL::Translator::Producer::SQLite::create_view( $view2, $create_opts ) ]; - my $view_sql_noreplace = [ 'CREATE VIEW view_foo AS - SELECT id, name FROM thing' ]; - is_deeply( $view1_sql2, $view_sql_noreplace, 'correct "CREATE VIEW" SQL' ); + my $view1_sql2 = [ SQL::Translator::Producer::SQLite::create_view($view2, $create_opts) ]; + my $view_sql_noreplace = [ + 'CREATE VIEW view_foo AS + SELECT id, name FROM thing' + ]; + is_deeply($view1_sql2, $view_sql_noreplace, 'correct "CREATE VIEW" SQL'); } diff --git a/t/60roundtrip.t b/t/60roundtrip.t index e99cfe8fa..8a1b3afa0 100644 --- a/t/60roundtrip.t +++ b/t/60roundtrip.t @@ -10,233 +10,231 @@ use FindBin qw/$Bin/; use SQL::Translator; use SQL::Translator::Utils qw/ddl_parser_instance/; - ### Set $ENV{SQLTTEST_RT_DEBUG} = 1 for more output # What tests to run - parser/producer name, and optional args my $plan = [ { - engine => 'XML', - req => 'XML::LibXML 1.69', + engine => 'XML', + req => 'XML::LibXML 1.69', no_grammar => 1, }, { - engine => 'YAML', + engine => 'YAML', no_grammar => 1, }, { - engine => 'SQLite', + engine => 'SQLite', producer_args => {}, - parser_args => {}, + parser_args => {}, }, { - engine => 'MySQL', + engine => 'MySQL', producer_args => {}, - parser_args => {}, + parser_args => {}, }, { - engine => 'MySQL', - name => 'MySQL 5.0', - producer_args => { mysql_version => 5 }, - parser_args => { mysql_parser_version => 5 }, + engine => 'MySQL', + name => 'MySQL 5.0', + producer_args => { mysql_version => 5 }, + parser_args => { mysql_parser_version => 5 }, }, { - engine => 'MySQL', - name => 'MySQL 5.1', - producer_args => { mysql_version => '5.1' }, - parser_args => { mysql_parser_version => '5.1' }, + engine => 'MySQL', + name => 'MySQL 5.1', + producer_args => { mysql_version => '5.1' }, + parser_args => { mysql_parser_version => '5.1' }, }, { - engine => 'PostgreSQL', + engine => 'PostgreSQL', producer_args => {}, - parser_args => {}, + parser_args => {}, }, { - engine => 'PostgreSQL', - name => 'Postgres w/ attached comments', + engine => 'PostgreSQL', + name => 'Postgres w/ attached comments', producer_args => { attach_comments => 1 }, - parser_args => {}, + parser_args => {}, }, { - engine => 'SQLServer', + engine => 'SQLServer', producer_args => {}, - parser_args => {}, + parser_args => {}, }, { - engine => 'Oracle', + engine => 'Oracle', producer_args => {}, - parser_args => {}, - todo_cmp => "auto-increment triggers aren't detected", + parser_args => {}, + todo_cmp => "auto-increment triggers aren't detected", }, { - engine => 'Sybase', + engine => 'Sybase', producer_args => {}, - parser_args => {}, - todo => 'Needs volunteers', + parser_args => {}, + todo => 'Needs volunteers', }, { - engine => 'DB2', + engine => 'DB2', producer_args => {}, - parser_args => {}, - todo => 'Needs volunteers', + parser_args => {}, + todo => 'Needs volunteers', }, -# There is no Access producer -# { -# engine => 'Access', -# producer_args => {}, -# parser_args => {}, -# }, + # There is no Access producer + # { + # engine => 'Access', + # producer_args => {}, + # parser_args => {}, + # }, ]; - # This data file has the right mix of table/view/procedure/trigger # definitions, and lists enough quirks to trip up most combos my $base_file = "$Bin/data/roundtrip_autogen.yaml"; -open (my $base_fh, '<', $base_file) or die "$base_file: $!"; +open(my $base_fh, '<', $base_file) or die "$base_file: $!"; my $base_t = SQL::Translator->new; -$base_t->$_ (1) for qw/add_drop_table no_comments quote_identifiers/; +$base_t->$_(1) for qw/add_drop_table no_comments quote_identifiers/; -my $base_schema = $base_t->translate ( +my $base_schema = $base_t->translate( parser => 'YAML', - data => do { local $/; <$base_fh>; }, + data => do { local $/; <$base_fh>; }, ) or die $base_t->error; - #assume there is at least one table my $string_re = { - XML => qr/\s*
qr/\s*
qr/\A---\n.+tables\:/s, - SQL => qr/^\s*CREATE TABLE/m, + SQL => qr/^\s*CREATE TABLE/m, }; for my $args (@$plan) { - SKIP: { +SKIP: { $args->{name} ||= $args->{engine}; - my @req = ref $args->{req} ? @{$args->{req}} : $args->{req}||(); + my @req = ref $args->{req} ? @{ $args->{req} } : $args->{req} || (); my @missing; for (@req) { eval "use $_ ()"; push @missing, $_ if ($@); } if (@missing) { - skip sprintf ('Need %s for %s roundtrip test', - join (', ', @missing), - $args->{name}, - ); + skip sprintf('Need %s for %s roundtrip test', join(', ', @missing), $args->{name},); } use_ok("SQL::Translator::Producer::$args->{engine}"); use_ok("SQL::Translator::Parser::$args->{engine}"); ok(ddl_parser_instance($args->{engine}), 'Got proper parser instance') - unless $args->{no_grammar}; + unless $args->{no_grammar}; - TODO: { +TODO: { local $TODO = $args->{todo} if $args->{todo}; no warnings 'once'; + # silence PR::D from spewing on STDERR local $::RD_ERRORS = 0 if $args->{todo}; - local $::RD_WARN = 0 if $args->{todo}; - local $::RD_HINT = 0 if $args->{todo}; + local $::RD_WARN = 0 if $args->{todo}; + local $::RD_HINT = 0 if $args->{todo}; - lives_ok ( - sub { check_roundtrip ($args, $base_schema, $args->{todo_cmp}) }, + lives_ok( + sub { + check_roundtrip($args, $base_schema, $args->{todo_cmp}); + }, "Round trip for $args->{name} did not throw an exception", ); } } } - sub check_roundtrip { my ($args, $base_schema, $todo_cmp) = @_; my $base_t = $base_schema->translator; -# create some output from the submitted schema - my $base_out = $base_t->translate ( - data => $base_schema, - producer => $args->{engine}, + # create some output from the submitted schema + my $base_out = $base_t->translate( + data => $base_schema, + producer => $args->{engine}, producer_args => $args->{producer_args}, ); - like ( + like( $base_out, - $string_re->{$args->{engine}} || $string_re->{SQL}, + $string_re->{ $args->{engine} } || $string_re->{SQL}, "Received some meaningful output from the first $args->{name} production", - ) or do { - diag ( _gen_diag ($base_t->error) ); - return; - }; + ) + or do { + diag(_gen_diag($base_t->error)); + return; + }; -# parse the sql back + # parse the sql back my $parser_t = SQL::Translator->new; - $parser_t->$_ (1) for qw/add_drop_table no_comments quote_identifiers/; - my $mid_schema = $parser_t->translate ( - data => $base_out, - parser => $args->{engine}, + $parser_t->$_(1) for qw/add_drop_table no_comments quote_identifiers/; + my $mid_schema = $parser_t->translate( + data => $base_out, + parser => $args->{engine}, parser_args => $args->{parser_args}, ); - isa_ok ($mid_schema, 'SQL::Translator::Schema', "First $args->{name} parser pass produced a schema:") - or do { - diag (_gen_diag ( $parser_t->error, $base_out ) ); - my $i; - note join ("\n" . ( '=' x 76) . "\n", - 'Unparseable DDL:', - (join ("\n", map { ++$i . ":\t$_" } split /\n/, $base_out) ), - '' - ); - return; - }; - -# schemas should be comparable at least as far as table/field numbers go - is_deeply ( - _get_table_info ($mid_schema->get_tables), - _get_table_info ($base_schema->get_tables), + isa_ok($mid_schema, 'SQL::Translator::Schema', "First $args->{name} parser pass produced a schema:") + or do { + diag(_gen_diag($parser_t->error, $base_out)); + my $i; + note join( + "\n" . ('=' x 76) . "\n", + 'Unparseable DDL:', + (join("\n", map { ++$i . ":\t$_" } split /\n/, $base_out)), '' + ); + return; + }; + + # schemas should be comparable at least as far as table/field numbers go + is_deeply( + _get_table_info($mid_schema->get_tables), + _get_table_info($base_schema->get_tables), "Schema tables generally match afer $args->{name} parser trip", ) or (diag(explain _get_table_info($mid_schema->get_tables)), return); -# and produce sql once again + # and produce sql once again # Producing a schema with a Translator different from the one the schema was generated # from does not work. This is arguably a bug, 61translator_agnostic.t works with that # my $producer_t = SQL::Translator->new; # $producer_t->$_ (1) for qw/add_drop_table no_comments/; -# my $rt_sql = $producer_t->translate ( -# data => $mid_schema, -# producer => $args->{engine}, -# producer_args => $args->{producer_args}, -# ); + # my $rt_sql = $producer_t->translate ( + # data => $mid_schema, + # producer => $args->{engine}, + # producer_args => $args->{producer_args}, + # ); - my $rt_out = $parser_t->translate ( - data => $mid_schema, - producer => $args->{engine}, + my $rt_out = $parser_t->translate( + data => $mid_schema, + producer => $args->{engine}, producer_args => $args->{producer_args}, ); - like ( + like( $rt_out, - $string_re->{$args->{engine}} || $string_re->{SQL}, + $string_re->{ $args->{engine} } || $string_re->{SQL}, "Received some meaningful output from the second $args->{name} production", - ) or do { - diag ( _gen_diag ( $parser_t->error ) ); - return; - }; + ) + or do { + diag(_gen_diag($parser_t->error)); + return; + }; local $TODO = $todo_cmp; -# the two sql strings should be identical + + # the two sql strings should be identical my $msg = "$args->{name} SQL roundtrip successful - SQL statements match"; $ENV{SQLTTEST_RT_DEBUG} - ? eq_or_diff ($rt_out, $base_out, $msg) - : ok ($rt_out eq $base_out, $msg) - ; + ? eq_or_diff($rt_out, $base_out, $msg) + : ok($rt_out eq $base_out, $msg); } sub _get_table_info { @@ -245,12 +243,11 @@ sub _get_table_info { my @info; for my $t (@tables) { - push @info, { - name => $t->name, - fields => [ - map { $_->name } ($t->get_fields), - ], - }; + push @info, + { + name => $t->name, + fields => [ map { $_->name } ($t->get_fields), ], + }; } return \@info; @@ -264,17 +261,13 @@ sub _gen_diag { return 'Unknown error' unless $err; - if ($out and $ENV{SQLTTEST_RT_DEBUG}) { my @lines; for (split /\n/, $out) { - push @lines, sprintf ('%03d: %s', - scalar @lines + 1, - $_, - ); + push @lines, sprintf('%03d: %s', scalar @lines + 1, $_,); } - return "$err\n\n" . join ("\n", @lines); + return "$err\n\n" . join("\n", @lines); } return $err; diff --git a/t/61translator_agnostic.t b/t/61translator_agnostic.t index 88cd06d57..25727f4e7 100644 --- a/t/61translator_agnostic.t +++ b/t/61translator_agnostic.t @@ -7,8 +7,7 @@ use Test::SQL::Translator; use FindBin qw/$Bin/; BEGIN { - maybe_plan(1, 'SQL::Translator::Parser::XML', - 'SQL::Translator::Producer::XML'); + maybe_plan(1, 'SQL::Translator::Parser::XML', 'SQL::Translator::Producer::XML'); } use SQL::Translator; @@ -16,32 +15,32 @@ use SQL::Translator; # Producing a schema with a Translator different from the one the schema was # generated should just work. After all the $schema object is just data. - my $base_file = "$Bin/data/xml/schema.xml"; -my $base_t = SQL::Translator->new; -$base_t->$_ (1) for qw/add_drop_table no_comments/; +my $base_t = SQL::Translator->new; +$base_t->$_(1) for qw/add_drop_table no_comments/; # create a base schema attached to $base_t -my $base_schema = $base_t->translate ( +my $base_schema = $base_t->translate( parser => 'XML', - file => $base_file, + file => $base_file, ) or die $base_t->error; # now create a new translator and try to feed it the same schema my $new_t = SQL::Translator->new; -$new_t->$_ (1) for qw/add_drop_table no_comments/; +$new_t->$_(1) for qw/add_drop_table no_comments/; -my $sql = $new_t->translate ( - data => $base_schema, +my $sql = $new_t->translate( + data => $base_schema, producer => 'SQLite' ); TODO: { local $TODO = 'This will probably not work before the rewrite'; - like ( + like( $sql, - qr/^\s*CREATE TABLE/m, #assume there is at least one create table statement + qr/^\s*CREATE TABLE/m + , #assume there is at least one create table statement "Received some meaningful output from the producer", ); } diff --git a/t/62roundtrip_datacheck.t b/t/62roundtrip_datacheck.t index ffcb9dae1..9a27a4953 100644 --- a/t/62roundtrip_datacheck.t +++ b/t/62roundtrip_datacheck.t @@ -5,8 +5,7 @@ use Test::Differences; use FindBin qw/$Bin/; BEGIN { - maybe_plan(1, 'SQL::Translator::Parser::XML', - 'SQL::Translator::Producer::XML'); + maybe_plan(1, 'SQL::Translator::Parser::XML', 'SQL::Translator::Producer::XML'); } # It's very hard to read and modify YAML by hand. Thus we @@ -17,23 +16,23 @@ BEGIN { use SQL::Translator; -my $base_xml_fn = "$Bin/data/roundtrip.xml"; +my $base_xml_fn = "$Bin/data/roundtrip.xml"; my $autogen_yaml_fn = "$Bin/data/roundtrip_autogen.yaml"; -my $orig_xml = _parse_to_xml ($base_xml_fn, 'XML'); -my $new_xml = _parse_to_xml ($autogen_yaml_fn, 'YAML'); +my $orig_xml = _parse_to_xml($base_xml_fn, 'XML'); +my $new_xml = _parse_to_xml($autogen_yaml_fn, 'YAML'); -eq_or_diff ("$new_xml", "$orig_xml", 'YAML test schema matches original XML schema'); +eq_or_diff("$new_xml", "$orig_xml", 'YAML test schema matches original XML schema'); sub _parse_to_xml { my ($fn, $type) = @_; my $tr = SQL::Translator->new; - $tr->no_comments (1); # this will drop the XML header + $tr->no_comments(1); # this will drop the XML header - my $xml = $tr->translate ( - parser => $type, - file => $fn, + my $xml = $tr->translate( + parser => $type, + file => $fn, producer => 'XML', ) or die $tr->error; diff --git a/t/63-spacial-pgsql.t b/t/63-spacial-pgsql.t index cf7c24b4f..0ee46a51f 100644 --- a/t/63-spacial-pgsql.t +++ b/t/63-spacial-pgsql.t @@ -14,33 +14,32 @@ use FindBin qw/$Bin/; #============================================================================= BEGIN { - maybe_plan(10, - 'SQL::Translator::Producer::PostgreSQL', - 'Test::Differences', - ) + maybe_plan(10, 'SQL::Translator::Producer::PostgreSQL', 'Test::Differences',); } use Test::Differences; use SQL::Translator; my $options = { quote_identifiers => 1 }; -my $schema = SQL::Translator::Schema->new( name => 'myschema' ); - -my $table = SQL::Translator::Schema::Table->new( name => 'my\'table', schema => $schema ); - -my $field1 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'geometry', - extra => { - dimensions => 2, - geometry_type => 'POINT', - srid => -1 - }, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); +my $schema = SQL::Translator::Schema->new(name => 'myschema'); + +my $table = SQL::Translator::Schema::Table->new(name => 'my\'table', schema => $schema); + +my $field1 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'geometry', + extra => { + dimensions => 2, + geometry_type => 'POINT', + srid => -1 + }, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 +); my $field1_sql = SQL::Translator::Producer::PostgreSQL::create_field($field1, $options); @@ -48,78 +47,98 @@ is($field1_sql, '"myfield" geometry', 'Create geometry field works'); my $field1_geocol = SQL::Translator::Producer::PostgreSQL::add_geometry_column($field1, $options); -is($field1_geocol, "INSERT INTO geometry_columns VALUES ('','myschema','my''table','myfield','2','-1','POINT')", 'Add geometry column works'); +is( + $field1_geocol, + "INSERT INTO geometry_columns VALUES ('','myschema','my''table','myfield','2','-1','POINT')", + 'Add geometry column works' +); my $field1_geocon = SQL::Translator::Producer::PostgreSQL::add_geometry_constraints($field1, $options); -is($field1_geocon, qq[ALTER TABLE "my'table" ADD CONSTRAINT "enforce_dims_myfield" CHECK ((ST_NDims("myfield") = 2)); +is( + $field1_geocon, + qq[ALTER TABLE "my'table" ADD CONSTRAINT "enforce_dims_myfield" CHECK ((ST_NDims("myfield") = 2)); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_srid_myfield" CHECK ((ST_SRID("myfield") = -1)); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_geotype_myfield" CHECK ((GeometryType("myfield") = 'POINT'::text OR "myfield" IS NULL))], - 'Add geometry constraints works'); - -my $field2 = SQL::Translator::Schema::Field->new( name => 'myfield', - table => $table, - data_type => 'VARCHAR', - size => 25, - default_value => undef, - is_auto_increment => 0, - is_nullable => 0, - is_foreign_key => 0, - is_unique => 0 ); - -my $alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field1, - $field2, $options); -is($alter_field, qq[DELETE FROM geometry_columns WHERE f_table_schema = 'myschema' AND f_table_name = 'my''table' AND f_geometry_column = 'myfield'; + 'Add geometry constraints works' +); + +my $field2 = SQL::Translator::Schema::Field->new( + name => 'myfield', + table => $table, + data_type => 'VARCHAR', + size => 25, + default_value => undef, + is_auto_increment => 0, + is_nullable => 0, + is_foreign_key => 0, + is_unique => 0 +); + +my $alter_field = SQL::Translator::Producer::PostgreSQL::alter_field($field1, $field2, $options); +is( + $alter_field, + qq[DELETE FROM geometry_columns WHERE f_table_schema = 'myschema' AND f_table_name = 'my''table' AND f_geometry_column = 'myfield'; ALTER TABLE "my'table" DROP CONSTRAINT "enforce_dims_myfield"; ALTER TABLE "my'table" DROP CONSTRAINT "enforce_srid_myfield"; ALTER TABLE "my'table" DROP CONSTRAINT "enforce_geotype_myfield"; ALTER TABLE "my'table" ALTER COLUMN "myfield" SET NOT NULL; ALTER TABLE "my'table" ALTER COLUMN "myfield" TYPE character varying(25)], - 'Alter field geometry to non geometry works'); + 'Alter field geometry to non geometry works' +); -my $alter_field2 = SQL::Translator::Producer::PostgreSQL::alter_field($field2, - $field1, $options); -is($alter_field2, qq[ALTER TABLE "my'table" ALTER COLUMN "myfield" DROP NOT NULL; +my $alter_field2 = SQL::Translator::Producer::PostgreSQL::alter_field($field2, $field1, $options); +is( + $alter_field2, + qq[ALTER TABLE "my'table" ALTER COLUMN "myfield" DROP NOT NULL; ALTER TABLE "my'table" ALTER COLUMN "myfield" TYPE geometry; INSERT INTO geometry_columns VALUES ('','myschema','my''table','myfield','2','-1','POINT'); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_dims_myfield" CHECK ((ST_NDims("myfield") = 2)); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_srid_myfield" CHECK ((ST_SRID("myfield") = -1)); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_geotype_myfield" CHECK ((GeometryType("myfield") = 'POINT'::text OR "myfield" IS NULL))], - 'Alter field non geometry to geometry works'); + 'Alter field non geometry to geometry works' +); $field1->name('field3'); my $add_field = SQL::Translator::Producer::PostgreSQL::add_field($field1, $options); -is($add_field, qq[ALTER TABLE "my'table" ADD COLUMN "field3" geometry; +is( + $add_field, qq[ALTER TABLE "my'table" ADD COLUMN "field3" geometry; INSERT INTO geometry_columns VALUES ('','myschema','my''table','field3','2','-1','POINT'); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_dims_field3" CHECK ((ST_NDims("field3") = 2)); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_srid_field3" CHECK ((ST_SRID("field3") = -1)); ALTER TABLE "my'table" ADD CONSTRAINT "enforce_geotype_field3" CHECK ((GeometryType("field3") = 'POINT'::text OR "field3" IS NULL))], - 'Add geometry field works'); + 'Add geometry field works' +); my $drop_field = SQL::Translator::Producer::PostgreSQL::drop_field($field1, $options); -is($drop_field, qq[ALTER TABLE "my'table" DROP COLUMN "field3"; +is( + $drop_field, qq[ALTER TABLE "my'table" DROP COLUMN "field3"; DELETE FROM geometry_columns WHERE f_table_schema = 'myschema' AND f_table_name = 'my''table' AND f_geometry_column = 'field3'], - 'Drop geometry field works'); + 'Drop geometry field works' +); $table->add_field($field1); -my $field4 = SQL::Translator::Schema::Field->new( name => 'field4', - table => $table, - data_type => 'geography', - extra => { - geography_type => 'POINT', - srid => -1 - }, - default_value => undef, - is_auto_increment => 0, - is_nullable => 1, - is_foreign_key => 0, - is_unique => 0 ); +my $field4 = SQL::Translator::Schema::Field->new( + name => 'field4', + table => $table, + data_type => 'geography', + extra => { + geography_type => 'POINT', + srid => -1 + }, + default_value => undef, + is_auto_increment => 0, + is_nullable => 1, + is_foreign_key => 0, + is_unique => 0 +); $table->add_field($field4); -my ($create_table,$fks) = SQL::Translator::Producer::PostgreSQL::create_table($table, $options); -is($create_table,qq[-- +my ($create_table, $fks) = SQL::Translator::Producer::PostgreSQL::create_table($table, $options); +is( + $create_table, qq[-- -- Table: my'table -- CREATE TABLE "my'table" ( @@ -130,17 +149,22 @@ CREATE TABLE "my'table" ( CONSTRAINT "enforce_geotype_field3" CHECK ((GeometryType("field3") = 'POINT'::text OR "field3" IS NULL)) ); INSERT INTO geometry_columns VALUES ('','myschema','my''table','field3','2','-1','POINT')], - 'Create table with geometry works.'); + 'Create table with geometry works.' +); my $rename_table = SQL::Translator::Producer::PostgreSQL::rename_table($table, "table2", $options); -is($rename_table,qq[ALTER TABLE "my'table" RENAME TO "table2"; +is( + $rename_table, qq[ALTER TABLE "my'table" RENAME TO "table2"; DELETE FROM geometry_columns WHERE f_table_schema = 'myschema' AND f_table_name = 'my''table' AND f_geometry_column = 'field3'; INSERT INTO geometry_columns VALUES ('','myschema','table2','field3','2','-1','POINT')], - 'Rename table with geometry works.'); + 'Rename table with geometry works.' +); $table->name("table2"); my $drop_table = SQL::Translator::Producer::PostgreSQL::drop_table($table, $options); -is($drop_table, qq[DROP TABLE "table2" CASCADE; +is( + $drop_table, qq[DROP TABLE "table2" CASCADE; DELETE FROM geometry_columns WHERE f_table_schema = 'myschema' AND f_table_name = 'table2' AND f_geometry_column = 'field3'], - 'Drop table with geometry works.'); + 'Drop table with geometry works.' +); diff --git a/t/64xml-to-mysql.t b/t/64xml-to-mysql.t index 435fd616c..bdba4a2bd 100644 --- a/t/64xml-to-mysql.t +++ b/t/64xml-to-mysql.t @@ -10,31 +10,29 @@ use Data::Dumper; use SQL::Translator; use SQL::Translator::Schema::Constants; - BEGIN { - maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', - 'SQL::Translator::Producer::MySQL'); + maybe_plan(2, 'SQL::Translator::Parser::XML::SQLFairy', 'SQL::Translator::Producer::MySQL'); } my $xmlfile = "$Bin/data/xml/schema.xml"; my $sqlt; $sqlt = SQL::Translator->new( - no_comments => 1, - show_warnings => 0, - add_drop_table => 1, - producer_args => { - mysql_version => 5.005, - }, + no_comments => 1, + show_warnings => 0, + add_drop_table => 1, + producer_args => { + mysql_version => 5.005, + }, ); die "Can't find test schema $xmlfile" unless -e $xmlfile; my @want = ( - q[SET foreign_key_checks=0], + q[SET foreign_key_checks=0], - q[DROP TABLE IF EXISTS `Basic`], - q[CREATE TABLE `Basic` ( + q[DROP TABLE IF EXISTS `Basic`], + q[CREATE TABLE `Basic` ( `id` integer(10) zerofill NOT NULL auto_increment, `title` varchar(100) NOT NULL DEFAULT 'hello', `description` text NULL DEFAULT '', @@ -52,44 +50,44 @@ my @want = ( CONSTRAINT `Basic_fk` FOREIGN KEY (`another_id`) REFERENCES `Another` (`id`) ) ENGINE=InnoDB], - q[DROP TABLE IF EXISTS `Another`], - q[CREATE TABLE `Another` ( + q[DROP TABLE IF EXISTS `Another`], + q[CREATE TABLE `Another` ( `id` integer(10) NOT NULL auto_increment, `num` numeric(10, 2) NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB], - q[CREATE OR REPLACE + q[CREATE OR REPLACE VIEW `email_list` ( `email` ) AS SELECT email FROM Basic WHERE (email IS NOT NULL) ], - q[DROP TRIGGER IF EXISTS `foo_trigger`], - q[CREATE TRIGGER `foo_trigger` after insert ON `Basic` + q[DROP TRIGGER IF EXISTS `foo_trigger`], + q[CREATE TRIGGER `foo_trigger` after insert ON `Basic` FOR EACH ROW BEGIN update modified=timestamp(); END], - q[DROP TRIGGER IF EXISTS `bar_trigger_insert`], - q[CREATE TRIGGER `bar_trigger_insert` before insert ON `Basic` + q[DROP TRIGGER IF EXISTS `bar_trigger_insert`], + q[CREATE TRIGGER `bar_trigger_insert` before insert ON `Basic` FOR EACH ROW BEGIN update modified2=timestamp(); END], - q[DROP TRIGGER IF EXISTS `bar_trigger_update`], - q[CREATE TRIGGER `bar_trigger_update` before update ON `Basic` + q[DROP TRIGGER IF EXISTS `bar_trigger_update`], + q[CREATE TRIGGER `bar_trigger_update` before update ON `Basic` FOR EACH ROW BEGIN update modified2=timestamp(); END], - q[SET foreign_key_checks=1], + q[SET foreign_key_checks=1], ); my $sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'MySQL', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'MySQL', + filename => $xmlfile, ) or die $sqlt->error; -eq_or_diff($sql, join("", map { "$_;\n\n" } @want)); +eq_or_diff($sql, join("", map {"$_;\n\n"} @want)); my @sql = $sqlt->translate( - from => 'XML-SQLFairy', - to => 'MySQL', - filename => $xmlfile, + from => 'XML-SQLFairy', + to => 'MySQL', + filename => $xmlfile, ) or die $sqlt->error; is_deeply(\@sql, \@want); diff --git a/t/66-postgres-dbi-parser.t b/t/66-postgres-dbi-parser.t index 0c6370281..c3ba1f9a2 100644 --- a/t/66-postgres-dbi-parser.t +++ b/t/66-postgres-dbi-parser.t @@ -10,19 +10,17 @@ use Test::SQL::Translator qw(maybe_plan table_ok); maybe_plan(undef, 'SQL::Translator::Parser::DBI::PostgreSQL'); my $pgsql; -my @dsn = - $ENV{DBICTEST_PG_DSN} ? @ENV{ map { "DBICTEST_PG_$_" } qw/DSN USER PASS/ } -: $ENV{DBI_DSN} ? @ENV{ map { "DBI_$_" } qw/DSN USER PASS/ } -: eval { require Test::PostgreSQL and ($pgsql= Test::PostgreSQL->new()) }? ( $pgsql->dsn, '', '' ) -: plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test, or install Test::PostgreSQL'; - -my $dbh = eval { - DBI->connect(@dsn, {AutoCommit => 1, RaiseError=>1,PrintError => 1} ); -}; - -if (my $err = ($@ || $DBI::err )) { - chomp $err; - plan skip_all => "No connection to test db. DBI says '$err'"; +my @dsn + = $ENV{DBICTEST_PG_DSN} ? @ENV{ map {"DBICTEST_PG_$_"} qw/DSN USER PASS/ } + : $ENV{DBI_DSN} ? @ENV{ map {"DBI_$_"} qw/DSN USER PASS/ } + : eval { require Test::PostgreSQL and ($pgsql = Test::PostgreSQL->new()) } ? ($pgsql->dsn, '', '') + : plan skip_all => 'Set $ENV{DBICTEST_PG_DSN}, _USER and _PASS to run this test, or install Test::PostgreSQL'; + +my $dbh = eval { DBI->connect(@dsn, { AutoCommit => 1, RaiseError => 1, PrintError => 1 }); }; + +if (my $err = ($@ || $DBI::err)) { + chomp $err; + plan skip_all => "No connection to test db. DBI says '$err'"; } # Cleanly shut down Test::PostgreSQL if it is being used @@ -79,131 +77,135 @@ $dbh->begin_work; $dbh->do($sql); my $t = SQL::Translator->new( - trace => 0, - parser => 'DBI', + trace => 0, + parser => 'DBI', parser_args => { dbh => $dbh, deconstruct_enum_types => 1 }, ); $t->translate; my $schema = $t->schema; -isa_ok( $schema, 'SQL::Translator::Schema', 'Schema object' ); +isa_ok($schema, 'SQL::Translator::Schema', 'Schema object'); -ok ($dbh->ping, 'External handle still connected'); +ok($dbh->ping, 'External handle still connected'); my @tables = $schema->get_tables; my $t1 = $schema->get_table("sqlt_test1"); -is( $t1->name, 'sqlt_test1', 'Table sqlt_test1 exists' ); -is( $t1->comments, 'this is a comment on the first table', 'First table has a comment'); +is($t1->name, 'sqlt_test1', 'Table sqlt_test1 exists'); +is($t1->comments, 'this is a comment on the first table', 'First table has a comment'); my @t1_fields = $t1->get_fields; -is( scalar @t1_fields, 5, '5 fields in sqlt_test1' ); +is(scalar @t1_fields, 5, '5 fields in sqlt_test1'); my $f1 = shift @t1_fields; -is( $f1->name, 'f_serial', 'First field is "f_serial"' ); -is( $f1->data_type, 'integer', 'Field is an integer' ); -is( $f1->is_nullable, 0, 'Field cannot be null' ); -is( ${$f1->default_value}, "nextval('sqlt_test1_f_serial_seq'::regclass)", 'Default value is nextval()' ); -is( $f1->is_primary_key, 1, 'Field is PK' ); +is($f1->name, 'f_serial', 'First field is "f_serial"'); +is($f1->data_type, 'integer', 'Field is an integer'); +is($f1->is_nullable, 0, 'Field cannot be null'); +is(${ $f1->default_value }, "nextval('sqlt_test1_f_serial_seq'::regclass)", 'Default value is nextval()'); +is($f1->is_primary_key, 1, 'Field is PK'); + #FIXME: not set to auto-increment? maybe we can guess auto-increment behavior by looking at the default_value (i.e. it call function nextval() ) #is( $f1->is_auto_increment, 1, 'Field is auto increment' ); my $f2 = shift @t1_fields; -is( $f2->name, 'f_varchar', 'Second field is "f_varchar"' ); -is( $f2->data_type, 'character varying', 'Field is a character varying(255)' ); -is( $f2->is_nullable, 1, 'Field can be null' ); -is( $f2->size, 255, 'Size is "255"' ); -is( $f2->default_value, undef, 'Default value is undefined' ); -is( $f2->is_primary_key, 0, 'Field is not PK' ); -is( $f2->is_auto_increment, 0, 'Field is not auto increment' ); -is( $f2->comments, '', 'There is no comment on the second field'); +is($f2->name, 'f_varchar', 'Second field is "f_varchar"'); +is($f2->data_type, 'character varying', 'Field is a character varying(255)'); +is($f2->is_nullable, 1, 'Field can be null'); +is($f2->size, 255, 'Size is "255"'); +is($f2->default_value, undef, 'Default value is undefined'); +is($f2->is_primary_key, 0, 'Field is not PK'); +is($f2->is_auto_increment, 0, 'Field is not auto increment'); +is($f2->comments, '', 'There is no comment on the second field'); my $f3 = shift @t1_fields; -is( $f3->name, 'f_text', 'Third field is "f_text"' ); -is( $f3->data_type, 'text', 'Field is a text' ); -is( $f3->is_nullable, 1, 'Field can be null' ); -is( $f3->size, 0, 'Size is 0' ); -is( $f3->default_value, 'FOO', 'Default value is "FOO"' ); -is( $f3->is_primary_key, 0, 'Field is not PK' ); -is( $f3->is_auto_increment, 0, 'Field is not auto increment' ); -is( $f3->comments, 'this is a comment on a field of the first table', 'There is a comment on the third field'); +is($f3->name, 'f_text', 'Third field is "f_text"'); +is($f3->data_type, 'text', 'Field is a text'); +is($f3->is_nullable, 1, 'Field can be null'); +is($f3->size, 0, 'Size is 0'); +is($f3->default_value, 'FOO', 'Default value is "FOO"'); +is($f3->is_primary_key, 0, 'Field is not PK'); +is($f3->is_auto_increment, 0, 'Field is not auto increment'); +is($f3->comments, 'this is a comment on a field of the first table', 'There is a comment on the third field'); my $f4 = shift @t1_fields; -is( $f4->name, 'f_text2', 'Fouth field is "f_text2"' ); -is( $f4->data_type, 'text', 'Field is a text' ); -is( $f4->is_nullable, 1, 'Field can be null' ); -is( $f4->size, 0, 'Size is 0' ); -is( $f4->default_value, undef, 'No default value' ); -is( $f4->is_primary_key, 0, 'Field is not PK' ); -is( $f4->is_auto_increment, 0, 'Field is not auto increment' ); +is($f4->name, 'f_text2', 'Fouth field is "f_text2"'); +is($f4->data_type, 'text', 'Field is a text'); +is($f4->is_nullable, 1, 'Field can be null'); +is($f4->size, 0, 'Size is 0'); +is($f4->default_value, undef, 'No default value'); +is($f4->is_primary_key, 0, 'Field is not PK'); +is($f4->is_auto_increment, 0, 'Field is not auto increment'); my $f5 = shift @t1_fields; -is( $f5->name, 'f_enum', 'Fifth field is "f_enum"' ); -is( $f5->data_type, 'enum', 'Field is a decomposed enum' ); -is( $f5->default_value, 'alpha', 'Default value "alpha"' ); -is_deeply( { $f5->extra }, { custom_type_name => 'example_enum', list => [ 'alpha', 'beta' ] }, 'Field "extra" enum description' ); +is($f5->name, 'f_enum', 'Fifth field is "f_enum"'); +is($f5->data_type, 'enum', 'Field is a decomposed enum'); +is($f5->default_value, 'alpha', 'Default value "alpha"'); +is_deeply( + { $f5->extra }, + { custom_type_name => 'example_enum', list => [ 'alpha', 'beta' ] }, + 'Field "extra" enum description' +); #TODO: no 'NOT NULL' constraint not set my $t2 = $schema->get_table("sqlt_test2"); -is( $t2->name, 'sqlt_test2', 'Table sqlt_test2 exists' ); -is( $t2->comments, undef, 'No comment on table sqlt_test2'); +is($t2->name, 'sqlt_test2', 'Table sqlt_test2 exists'); +is($t2->comments, undef, 'No comment on table sqlt_test2'); my @t2_fields = $t2->get_fields; -is( scalar @t2_fields, 3, '3 fields in sqlt_test2' ); +is(scalar @t2_fields, 3, '3 fields in sqlt_test2'); my $t2_f1 = shift @t2_fields; -is( $t2_f1->name, 'f_id', 'First field is "f_id"' ); -is( $t2_f1->data_type, 'integer', 'Field is an integer' ); -is( $t2_f1->is_nullable, 0, 'Field cannot be null' ); -is( $t2_f1->size, 0, 'Size is "0"' ); -is( $t2_f1->default_value, undef, 'Default value is undefined' ); -is( $t2_f1->is_primary_key, 1, 'Field is PK' ); - -my $t2_f2= shift @t2_fields; -is( $t2_f2->name, 'f_int', 'Third field is "f_int"' ); -is( $t2_f2->data_type, 'smallint', 'Field is an smallint' ); -is( $t2_f2->is_nullable, 1, 'Field can be null' ); -is( $t2_f2->size, 0, 'Size is "0"' ); -is( $t2_f2->default_value, undef, 'Default value is undefined' ); -is( $t2_f2->is_primary_key, 0, 'Field is not PK' ); +is($t2_f1->name, 'f_id', 'First field is "f_id"'); +is($t2_f1->data_type, 'integer', 'Field is an integer'); +is($t2_f1->is_nullable, 0, 'Field cannot be null'); +is($t2_f1->size, 0, 'Size is "0"'); +is($t2_f1->default_value, undef, 'Default value is undefined'); +is($t2_f1->is_primary_key, 1, 'Field is PK'); + +my $t2_f2 = shift @t2_fields; +is($t2_f2->name, 'f_int', 'Third field is "f_int"'); +is($t2_f2->data_type, 'smallint', 'Field is an smallint'); +is($t2_f2->is_nullable, 1, 'Field can be null'); +is($t2_f2->size, 0, 'Size is "0"'); +is($t2_f2->default_value, undef, 'Default value is undefined'); +is($t2_f2->is_primary_key, 0, 'Field is not PK'); my $t2_f3 = shift @t2_fields; -is( $t2_f3->name, 'f_fk1', 'Third field is "f_fk1"' ); -is( $t2_f3->data_type, 'integer', 'Field is an integer' ); -is( $t2_f3->is_nullable, 0, 'Field cannot be null' ); -is( $t2_f3->size, 0, 'Size is "0"' ); -is( $t2_f3->default_value, undef, 'Default value is undefined' ); -is( $t2_f3->is_primary_key, 1, 'Field is PK' ); -is( $t2_f3->is_foreign_key, 1, 'Field is a FK' ); +is($t2_f3->name, 'f_fk1', 'Third field is "f_fk1"'); +is($t2_f3->data_type, 'integer', 'Field is an integer'); +is($t2_f3->is_nullable, 0, 'Field cannot be null'); +is($t2_f3->size, 0, 'Size is "0"'); +is($t2_f3->default_value, undef, 'Default value is undefined'); +is($t2_f3->is_primary_key, 1, 'Field is PK'); +is($t2_f3->is_foreign_key, 1, 'Field is a FK'); my $fk_ref1 = $t2_f3->foreign_key_reference; -isa_ok( $fk_ref1, 'SQL::Translator::Schema::Constraint', 'FK' ); -is( $fk_ref1->reference_table, 'sqlt_test1', 'FK is to "sqlt_test1" table' ); +isa_ok($fk_ref1, 'SQL::Translator::Schema::Constraint', 'FK'); +is($fk_ref1->reference_table, 'sqlt_test1', 'FK is to "sqlt_test1" table'); my $t3 = $schema->get_table("sqlt_products_1"); -my $t3_f2= $t3->get_field('name'); -is( $t3_f2->data_type, 'text', 'Second field, type "text"' ); -is( $t3_f2->default_value, q{['']}, 'default value is json array of empty string' ); +my $t3_f2 = $t3->get_field('name'); +is($t3_f2->data_type, 'text', 'Second field, type "text"'); +is($t3_f2->default_value, q{['']}, 'default value is json array of empty string'); -my $t3_f3= $t3->get_field('price'); -is( $t3_f3->name, 'price', 'Third field is "price"' ); -is( $t3_f3->data_type, 'numeric', 'Third field type "numeric"' ); -is_deeply( [$t3_f3->size], [8,4], 'Third field size "(8,4)"' ); -is( $t3_f3->default_value, '0.0', 'Third field default "0.0"' ); +my $t3_f3 = $t3->get_field('price'); +is($t3_f3->name, 'price', 'Third field is "price"'); +is($t3_f3->data_type, 'numeric', 'Third field type "numeric"'); +is_deeply([ $t3_f3->size ], [ 8, 4 ], 'Third field size "(8,4)"'); +is($t3_f3->default_value, '0.0', 'Third field default "0.0"'); -my $t3_f4= $t3->get_field('created_at'); -is( $t3_f4->name, 'created_at', 'fourth field is "created_at"' ); -is( $t3_f4->data_type, 'timestamp without time zone', 'type is "timestamp without time zone"' ); -is( $t2_f3->size, 0, 'Size is "0"' ); -is_deeply( $t3_f4->default_value, \"now()", 'default \\"now()"' ); +my $t3_f4 = $t3->get_field('created_at'); +is($t3_f4->name, 'created_at', 'fourth field is "created_at"'); +is($t3_f4->data_type, 'timestamp without time zone', 'type is "timestamp without time zone"'); +is($t2_f3->size, 0, 'Size is "0"'); +is_deeply($t3_f4->default_value, \"now()", 'default \\"now()"'); my @t2_constraints = $t2->get_constraints; -is( scalar @t2_constraints, 1, "One constraint on table" ); +is(scalar @t2_constraints, 1, "One constraint on table"); my $t2_c1 = shift @t2_constraints; -is( $t2_c1->type, FOREIGN_KEY, "Constraint is a FK" ); - +is($t2_c1->type, FOREIGN_KEY, "Constraint is a FK"); $dbh->rollback; $dbh->disconnect; diff --git a/t/70sqlt-diff_script.t b/t/70sqlt-diff_script.t index 14962aab5..94d036ed8 100644 --- a/t/70sqlt-diff_script.t +++ b/t/70sqlt-diff_script.t @@ -4,73 +4,68 @@ use strict; use File::Spec::Functions qw(catfile updir tmpdir); -use FindBin qw($Bin); +use FindBin qw($Bin); use IPC::Open3; use Test::More; use Test::SQL::Translator qw(maybe_plan); -use Text::ParseWords qw(shellwords); +use Text::ParseWords qw(shellwords); -my @script = qw(script sqlt-diff); +my @script = qw(script sqlt-diff); my @create1 = qw(data sqlite create.sql); my @create2 = qw(data sqlite create2.sql); my $sqlt_diff = catfile($Bin, updir, @script); -my $create1 = catfile($Bin, @create1); -my $create2 = catfile($Bin, @create2); +my $create1 = catfile($Bin, @create1); +my $create2 = catfile($Bin, @create2); BEGIN { - maybe_plan(16, - 'SQL::Translator::Parser::MySQL', - ); + maybe_plan(16, 'SQL::Translator::Parser::MySQL',); } my @mysql_create1 = qw(data mysql create.sql); my @mysql_create2 = qw(data mysql create2.sql); -my $mysql_create1 = (-d "t") +my $mysql_create1 + = (-d "t") ? catfile($Bin, @mysql_create1) : catfile($Bin, "t", @mysql_create1); -my $mysql_create2 = (-d "t") +my $mysql_create2 + = (-d "t") ? catfile($Bin, @mysql_create2) : catfile($Bin, "t", @mysql_create2); # Test for differences -my $out = _run_cmd ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL"); +my $out = _run_cmd($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL"); -like($out, qr/CHANGE COLUMN person_id/, "Detected altered 'person_id' field"); -like($out, qr/CHANGE COLUMN iq/, "Detected altered 'iq' field"); -like($out, qr/CHANGE COLUMN name/, "Detected altered 'name' field"); -like($out, qr/CHANGE COLUMN age/, "Detected altered 'age' field"); -like($out, qr/ADD COLUMN is_rock_star/, - "Detected missing rock star field"); -like($out, qr/ADD UNIQUE UC_person_id/, - "Detected missing unique constraint"); -like($out, qr/ADD UNIQUE INDEX unique_name/, - "Detected unique index with different name"); -like($out, qr/DROP FOREIGN KEY FK5302D47D93FE702E/, - "Detected drop foreign key"); -like($out, qr/ADD CONSTRAINT FK5302D47D93FE702E_diff/, - "Detected add constraint"); +like($out, qr/CHANGE COLUMN person_id/, "Detected altered 'person_id' field"); +like($out, qr/CHANGE COLUMN iq/, "Detected altered 'iq' field"); +like($out, qr/CHANGE COLUMN name/, "Detected altered 'name' field"); +like($out, qr/CHANGE COLUMN age/, "Detected altered 'age' field"); +like($out, qr/ADD COLUMN is_rock_star/, "Detected missing rock star field"); +like($out, qr/ADD UNIQUE UC_person_id/, "Detected missing unique constraint"); +like($out, qr/ADD UNIQUE INDEX unique_name/, "Detected unique index with different name"); +like($out, qr/DROP FOREIGN KEY FK5302D47D93FE702E/, "Detected drop foreign key"); +like($out, qr/ADD CONSTRAINT FK5302D47D93FE702E_diff/, "Detected add constraint"); unlike($out, qr/ADD PRIMARY KEY/, "Primary key looks different when it shouldn't"); # Test for quoted output -$out = _run_cmd ($sqlt_diff, '--quote=`', "$mysql_create1=MySQL", "$mysql_create2=MySQL"); +$out = _run_cmd($sqlt_diff, '--quote=`', "$mysql_create1=MySQL", "$mysql_create2=MySQL"); -like($out, qr/ALTER TABLE `person`/, "Quoted table name"); +like($out, qr/ALTER TABLE `person`/, "Quoted table name"); like($out, qr/CHANGE COLUMN `person_id`/, "Quoted 'person_id' field"); -like($out, qr/CHANGE COLUMN `iq`/, "Quoted 'iq' field"); -like($out, qr/CHANGE COLUMN `name`/, "Quoted 'name' field"); -like($out, qr/CHANGE COLUMN `age`/, "Quoted 'age' field"); +like($out, qr/CHANGE COLUMN `iq`/, "Quoted 'iq' field"); +like($out, qr/CHANGE COLUMN `name`/, "Quoted 'name' field"); +like($out, qr/CHANGE COLUMN `age`/, "Quoted 'age' field"); # Test for sameness -$out = _run_cmd ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); +$out = _run_cmd($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); like($out, qr/No differences found/, "Properly detected no differences"); sub _run_cmd { my $out; - my $pid = open3( undef, $out, undef, $^X, shellwords($ENV{HARNESS_PERL_SWITCHES}||''), @_ ); + my $pid = open3(undef, $out, undef, $^X, shellwords($ENV{HARNESS_PERL_SWITCHES} || ''), @_); my $res = do { local $/; <$out> }; waitpid($pid, 0); $res; diff --git a/t/70sqlt-diff_script_old.t b/t/70sqlt-diff_script_old.t index de079b09e..e98ca8c22 100644 --- a/t/70sqlt-diff_script_old.t +++ b/t/70sqlt-diff_script_old.t @@ -4,100 +4,96 @@ use strict; use File::Spec::Functions qw(catfile updir tmpdir); -use FindBin qw($Bin); +use FindBin qw($Bin); use Test::More; use IPC::Open3; use Test::SQL::Translator qw(maybe_plan); -use Text::ParseWords qw(shellwords); +use Text::ParseWords qw(shellwords); -my @script = qw(script sqlt-diff-old); +my @script = qw(script sqlt-diff-old); my @create1 = qw(data sqlite create.sql); my @create2 = qw(data sqlite create2.sql); my $sqlt_diff = catfile($Bin, updir, @script); -my $create1 = catfile($Bin, @create1); -my $create2 = catfile($Bin, @create2); +my $create1 = catfile($Bin, @create1); +my $create2 = catfile($Bin, @create2); BEGIN { - maybe_plan(21, - 'SQL::Translator::Parser::SQLite', - 'SQL::Translator::Parser::MySQL', - 'SQL::Translator::Parser::Oracle', - ); + maybe_plan( + 21, + 'SQL::Translator::Parser::SQLite', + 'SQL::Translator::Parser::MySQL', + 'SQL::Translator::Parser::Oracle', + ); } ok(-e $sqlt_diff, 'Found sqlt-diff script'); -my $out = _run_cmd ($sqlt_diff, "$create1=SQLite", "$create2=SQLite"); +my $out = _run_cmd($sqlt_diff, "$create1=SQLite", "$create2=SQLite"); like($out, qr/-- Target database SQLite is untested/, "Detected 'untested' comment"); -like($out, qr/ALTER TABLE person CHANGE iq/, "Detected altered 'iq' field"); -like($out, qr/ALTER TABLE person ADD is_rock_star/, - "Detected missing rock star field"); +like($out, qr/ALTER TABLE person CHANGE iq/, "Detected altered 'iq' field"); +like($out, qr/ALTER TABLE person ADD is_rock_star/, "Detected missing rock star field"); -$out = _run_cmd ($sqlt_diff, "$create1=SQLite", "$create1=SQLite"); +$out = _run_cmd($sqlt_diff, "$create1=SQLite", "$create1=SQLite"); like($out, qr/There were no differences/, "Properly detected no differences"); my @mysql_create1 = qw(data mysql create.sql); my @mysql_create2 = qw(data mysql create2.sql); -my $mysql_create1 = (-d "t") +my $mysql_create1 + = (-d "t") ? catfile($Bin, @mysql_create1) : catfile($Bin, "t", @mysql_create1); -my $mysql_create2 = (-d "t") +my $mysql_create2 + = (-d "t") ? catfile($Bin, @mysql_create2) : catfile($Bin, "t", @mysql_create2); # Test for differences -$out = _run_cmd ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL"); +$out = _run_cmd($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create2=MySQL"); unlike($out, qr/-- Target database MySQL is untested/, "Did not detect 'untested' comment"); -like($out, qr/ALTER TABLE person CHANGE person_id/, "Detected altered 'person_id' field"); -like($out, qr/ALTER TABLE person CHANGE iq/, "Detected altered 'iq' field"); -like($out, qr/ALTER TABLE person CHANGE name/, "Detected altered 'name' field"); -like($out, qr/ALTER TABLE person CHANGE age/, "Detected altered 'age' field"); -like($out, qr/ALTER TABLE person ADD is_rock_star/, - "Detected missing rock star field"); -like($out, qr/ALTER TABLE person ADD UNIQUE UC_person_id/, - "Detected missing unique constraint"); -like($out, qr/CREATE UNIQUE INDEX unique_name/, - "Detected unique index with different name"); -like($out, qr/ALTER TABLE person ENGINE=InnoDB;/, - "Detected altered table option"); -like($out, qr/ALTER TABLE employee DROP FOREIGN KEY FK5302D47D93FE702E/, - "Detected drop foreign key"); -like($out, qr/ALTER TABLE employee ADD CONSTRAINT FK5302D47D93FE702E_diff/, - "Detected add constraint"); +like($out, qr/ALTER TABLE person CHANGE person_id/, "Detected altered 'person_id' field"); +like($out, qr/ALTER TABLE person CHANGE iq/, "Detected altered 'iq' field"); +like($out, qr/ALTER TABLE person CHANGE name/, "Detected altered 'name' field"); +like($out, qr/ALTER TABLE person CHANGE age/, "Detected altered 'age' field"); +like($out, qr/ALTER TABLE person ADD is_rock_star/, "Detected missing rock star field"); +like($out, qr/ALTER TABLE person ADD UNIQUE UC_person_id/, "Detected missing unique constraint"); +like($out, qr/CREATE UNIQUE INDEX unique_name/, "Detected unique index with different name"); +like($out, qr/ALTER TABLE person ENGINE=InnoDB;/, "Detected altered table option"); +like($out, qr/ALTER TABLE employee DROP FOREIGN KEY FK5302D47D93FE702E/, "Detected drop foreign key"); +like($out, qr/ALTER TABLE employee ADD CONSTRAINT FK5302D47D93FE702E_diff/, "Detected add constraint"); unlike($out, qr/ALTER TABLE employee ADD PRIMARY KEY/, "Primary key looks different when it shouldn't"); # Test for sameness -$out = _run_cmd ($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); +$out = _run_cmd($sqlt_diff, "$mysql_create1=MySQL", "$mysql_create1=MySQL"); like($out, qr/There were no differences/, "Properly detected no differences"); my @oracle_create1 = qw(data oracle create.sql); my @oracle_create2 = qw(data oracle create2.sql); -my $oracle_create1 = (-d "t") +my $oracle_create1 + = (-d "t") ? catfile($Bin, @oracle_create1) : catfile($Bin, "t", @oracle_create1); -my $oracle_create2 = (-d "t") +my $oracle_create2 + = (-d "t") ? catfile($Bin, @oracle_create2) : catfile($Bin, "t", @oracle_create2); -$out = _run_cmd ($sqlt_diff, "$oracle_create1=Oracle", "$oracle_create2=Oracle"); +$out = _run_cmd($sqlt_diff, "$oracle_create1=Oracle", "$oracle_create2=Oracle"); unlike($out, qr/-- Target database Oracle is untested/, "Did not detect 'untested' comment"); -like($out, qr/ALTER TABLE TABLE1 DROP FOREIGN KEY/, - "Detected drop foreign key"); -like($out, qr/ALTER TABLE TABLE1 ADD CONSTRAINT/, - "Detected add constraint"); +like($out, qr/ALTER TABLE TABLE1 DROP FOREIGN KEY/, "Detected drop foreign key"); +like($out, qr/ALTER TABLE TABLE1 ADD CONSTRAINT/, "Detected add constraint"); sub _run_cmd { my $out; - my $pid = open3( undef, $out, undef, $^X, shellwords($ENV{HARNESS_PERL_SWITCHES}||''), @_ ); + my $pid = open3(undef, $out, undef, $^X, shellwords($ENV{HARNESS_PERL_SWITCHES} || ''), @_); my $res = do { local $/; <$out> }; waitpid($pid, 0); $res; diff --git a/t/71-generator-sql_server.t b/t/71-generator-sql_server.t index 9e31ce4ad..57bbd692c 100644 --- a/t/71-generator-sql_server.t +++ b/t/71-generator-sql_server.t @@ -10,29 +10,29 @@ use SQL::Translator::Schema::Table; my $shim = SQL::Translator::Generator::DDL::SQLServer->new(); is $shim->field(SQL::Translator::Schema::Field->new( - name => 'lol', - data_type => 'int', -)), '[lol] int NULL', 'simple field is generated correctly'; + name => 'lol', + data_type => 'int', + )), + '[lol] int NULL', 'simple field is generated correctly'; is $shim->field(SQL::Translator::Schema::Field->new( - name => 'nice', - data_type => 'varchar', - size => 10, -)), '[nice] varchar(10) NULL', 'sized field is generated correctly'; + name => 'nice', + data_type => 'varchar', + size => 10, + )), + '[nice] varchar(10) NULL', 'sized field is generated correctly'; -my $table = SQL::Translator::Schema::Table->new( - name => 'mytable', -); +my $table = SQL::Translator::Schema::Table->new(name => 'mytable',); $table->add_field( - name => 'myenum', - data_type => 'enum', - extra => { list => [qw(foo ba'r)] }, + name => 'myenum', + data_type => 'enum', + extra => { list => [qw(foo ba'r)] }, ); like $shim->table($table), - qr/\b\QCONSTRAINT [myenum_chk] CHECK ([myenum] IN ('foo','ba''r'))\E/, - 'enum constraint is generated and escaped correctly'; + qr/\b\QCONSTRAINT [myenum_chk] CHECK ([myenum] IN ('foo','ba''r'))\E/, + 'enum constraint is generated and escaped correctly'; done_testing; diff --git a/t/72-sqlite-add-drop-fields.t b/t/72-sqlite-add-drop-fields.t index 1fb0ab30c..6502af446 100644 --- a/t/72-sqlite-add-drop-fields.t +++ b/t/72-sqlite-add-drop-fields.t @@ -9,9 +9,7 @@ use SQL::Translator; use SQL::Translator::Parser::SQLite; use SQL::Translator::Diff; - -ok my $version1 = SQL::Translator->new(from=>'SQLite') - ->translate(\<new(from => 'SQLite')->translate(\<new(from=>'SQLite') - ->translate(\<new(from => 'SQLite')->translate(\< 1, - from => 'SQLite', - to => 'SQLite'); + from => 'SQLite', + to => 'SQLite' +); -my $unquoted = SQL::Translator - ->new(%common_args) - ->translate(\$ddl); +my $unquoted = SQL::Translator->new(%common_args)->translate(\$ddl); eq_or_diff($unquoted, <<'DDL', 'DDL with default quoting'); BEGIN TRANSACTION; @@ -39,13 +38,17 @@ CREATE TABLE Foo ( COMMIT; DDL -dies_ok { SQL::Translator - ->new(%common_args, quote_table_names=>0, quote_field_names => 1) - ->translate(\$ddl) } 'mix and match quotes is asinine'; +dies_ok { + SQL::Translator->new( + %common_args, + quote_table_names => 0, + quote_field_names => 1 + )->translate(\$ddl) +} +'mix and match quotes is asinine'; -my $quoteall = SQL::Translator - ->new(%common_args, quote_identifiers=>1) - ->translate(\$ddl); +my $quoteall = SQL::Translator->new(%common_args, quote_identifiers => 1) + ->translate(\$ddl); eq_or_diff($quoteall, <<'DDL', 'DDL with quoting'); BEGIN TRANSACTION; @@ -98,4 +101,3 @@ COMMIT; =cut - diff --git a/t/74-filename-arrayref.t b/t/74-filename-arrayref.t index e07672b69..635281561 100644 --- a/t/74-filename-arrayref.t +++ b/t/74-filename-arrayref.t @@ -10,7 +10,7 @@ use SQL::Translator; use Test::More tests => 2; my $datafile = "t/data/mysql/Apache-Session-MySQL.sql"; -my $tr0 = SQL::Translator->new(filename => $datafile); -my $tr1 = SQL::Translator->new(filename => [$datafile]); +my $tr0 = SQL::Translator->new(filename => $datafile); +my $tr1 = SQL::Translator->new(filename => [$datafile]); ok($tr0, "filename takes a Str"); ok($tr1, "filename takes an ArrayRef"); diff --git a/t/75-sqlserver-producer.t b/t/75-sqlserver-producer.t index 18ca9c7fb..97c24e6b8 100644 --- a/t/75-sqlserver-producer.t +++ b/t/75-sqlserver-producer.t @@ -8,11 +8,7 @@ use Test::SQL::Translator qw(maybe_plan); use FindBin qw/$Bin/; BEGIN { - maybe_plan(2, - 'YAML', - 'SQL::Translator::Producer::SQLServer', - 'Test::Differences', - ) + maybe_plan(2, 'YAML', 'SQL::Translator::Producer::SQLServer', 'Test::Differences',); } use Test::Differences; use SQL::Translator; @@ -80,33 +76,33 @@ schema: EOSCHEMA my @stmts = ( -"CREATE TABLE [some].[thing2] ( + "CREATE TABLE [some].[thing2] ( [id] int NOT NULL, [foo] int NOT NULL, [foo2] int NULL, [bar_set] set NULL, CONSTRAINT [some].[thing2_pk] PRIMARY KEY ([id], [foo]) -);\n", # New line to match generator +);\n", # New line to match generator -"CREATE INDEX [index_1] ON [some].[thing2] ([id]);\n", # Where does the new line come from? + "CREATE INDEX [index_1] ON [some].[thing2] ([id]);\n", # Where does the new line come from? -"CREATE INDEX [really_long_name_bigger_than_64_chars_aaaaaaaaaaaaaaaaaaaaaaaaaaa] ON [some].[thing2] ([id]);", -"ALTER TABLE [some].[thing2] ADD CONSTRAINT [fk_thing] FOREIGN KEY ([foo]) REFERENCES [thing] ();", -"ALTER TABLE [some].[thing2] ADD CONSTRAINT [fk_thing] FOREIGN KEY ([foo2]) REFERENCES [thing] ();", + "CREATE INDEX [really_long_name_bigger_than_64_chars_aaaaaaaaaaaaaaaaaaaaaaaaaaa] ON [some].[thing2] ([id]);", + "ALTER TABLE [some].[thing2] ADD CONSTRAINT [fk_thing] FOREIGN KEY ([foo]) REFERENCES [thing] ();", + "ALTER TABLE [some].[thing2] ADD CONSTRAINT [fk_thing] FOREIGN KEY ([foo2]) REFERENCES [thing] ();", ); my $sqlt = SQL::Translator->new( - show_warnings => 1, - no_comments => 1, - from => "YAML", - to => "SQLServer", - quote_table_names => 1, - quote_field_names => 1 + show_warnings => 1, + no_comments => 1, + from => "YAML", + to => "SQLServer", + quote_table_names => 1, + quote_field_names => 1 ); my $generator = $sqlt->translate(\$yaml_in) - or die "Translate error:".$sqlt->error; -ok $generator ne "", "Produced something!"; + or die "Translate error:" . $sqlt->error; +ok $generator ne "", "Produced something!"; my $correct = join("\n", @stmts); -eq_or_diff $correct, $generator, "Scalar output looks correct"; +eq_or_diff $correct, $generator, "Scalar output looks correct"; diff --git a/t/lib/Producer/BaseTest.pm b/t/lib/Producer/BaseTest.pm index 57cf39c10..d51b2d54e 100644 --- a/t/lib/Producer/BaseTest.pm +++ b/t/lib/Producer/BaseTest.pm @@ -7,14 +7,14 @@ package Producer::BaseTest; use base qw/SQL::Translator::Producer::TT::Base/; # Make sure we use our new class as the producer -sub produce { return __PACKAGE__->new( translator => shift )->run; }; +sub produce { return __PACKAGE__->new(translator => shift)->run; } # Note: we don't need to impliment tt_schema as the default will use the DATA # section by default. -sub tt_vars { ( foo => "bar" ); } +sub tt_vars { (foo => "bar"); } -sub tt_config { ( INTERPOLATE => 1 ); } +sub tt_config { (INTERPOLATE => 1); } 1; diff --git a/t/mysql-sqlite-translate.t b/t/mysql-sqlite-translate.t index 8d96ff657..59acc77b9 100644 --- a/t/mysql-sqlite-translate.t +++ b/t/mysql-sqlite-translate.t @@ -2,9 +2,9 @@ use warnings; use strict; use Test::More; -use_ok( "SQL::Translator" ); -use_ok( "SQL::Translator::Parser::MySQL" ); -use_ok( "SQL::Translator::Producer::SQLite" ); +use_ok("SQL::Translator"); +use_ok("SQL::Translator::Parser::MySQL"); +use_ok("SQL::Translator::Producer::SQLite"); # This test reproduces a bug in SQL::Translator::Producer::SQLite. # @@ -14,36 +14,33 @@ use_ok( "SQL::Translator::Producer::SQLite" ); # SQL::Translator::Producer::SQLite version 1.59. # compliments of SymKat - - -my $output = SQL::Translator - ->new( data => do { local $/; }) - ->translate( from => 'MySQL', to => 'SQLite' ); +my $output = SQL::Translator->new(data => do { local $/; }) + ->translate(from => 'MySQL', to => 'SQLite'); sub find_table_names { - my ( $content ) = @_; - my @tables; + my ($content) = @_; + my @tables; - for my $line ( split /\n/, $content ) { - if ($content =~ /CREATE (?:INDEX|UNIQUE|TABLE| ){0,6} ([^\s]+)/gc) { - push @tables, $1; - } + for my $line (split /\n/, $content) { + if ($content =~ /CREATE (?:INDEX|UNIQUE|TABLE| ){0,6} ([^\s]+)/gc) { + push @tables, $1; } - return @tables; + } + return @tables; } sub has_dupes { - my ( @list ) = @_; - my %hist; + my (@list) = @_; + my %hist; - for my $elem ( @list ) { - return 0 if exists $hist{$elem}; - $hist{$elem} = 1; - } - return 1; + for my $elem (@list) { + return 0 if exists $hist{$elem}; + $hist{$elem} = 1; + } + return 1; } -ok ( has_dupes( find_table_names( $output ) ) ); +ok(has_dupes(find_table_names($output))); done_testing; diff --git a/t/postgresql-rename-table-and-field.t b/t/postgresql-rename-table-and-field.t index 564f7ad49..86f963da2 100644 --- a/t/postgresql-rename-table-and-field.t +++ b/t/postgresql-rename-table-and-field.t @@ -11,17 +11,16 @@ use SQL::Translator::Diff; maybe_plan(undef, 'DBD::Pg'); -my ( $pg_tst, $ddl, $ret, $dsn, $user, $pass ); +my ($pg_tst, $ddl, $ret, $dsn, $user, $pass); if ($ENV{DBICTEST_PG_DSN}) { - ($dsn, $user, $pass) = map { $ENV{"DBICTEST_PG_$_"} } qw(DSN USER PASS); + ($dsn, $user, $pass) = map { $ENV{"DBICTEST_PG_$_"} } qw(DSN USER PASS); +} else { + no warnings 'once'; + maybe_plan(undef, 'Test::PostgreSQL'); + $pg_tst = eval { Test::PostgreSQL->new } + or plan skip_all => "Can't create test database: $Test::PostgreSQL::errstr"; + $dsn = $pg_tst->dsn; } -else { - no warnings 'once'; - maybe_plan(undef, 'Test::PostgreSQL'); - $pg_tst = eval { Test::PostgreSQL->new } - or plan skip_all => "Can't create test database: $Test::PostgreSQL::errstr"; - $dsn = $pg_tst->dsn; -}; my $dbh = DBI->connect($dsn, $user, $pass, { RaiseError => 1, AutoCommit => 1 }); $dbh->do('SET client_min_messages=warning'); @@ -33,11 +32,11 @@ CREATE TABLE sqlt_test_foo ( ); DDL -ok( $ret = $dbh->do($source_ddl), "create table" ); +ok($ret = $dbh->do($source_ddl), "create table"); -ok( $ret = $dbh->do(q| INSERT INTO sqlt_test_foo (bar) VALUES ('buzz') |), "insert data" ); +ok($ret = $dbh->do(q| INSERT INTO sqlt_test_foo (bar) VALUES ('buzz') |), "insert data"); -cmp_ok( $ret, '==', 1, "one row inserted" ); +cmp_ok($ret, '==', 1, "one row inserted"); my $target_ddl = <new( - no_comments => 1, - parser => 'SQL::Translator::Parser::PostgreSQL', + no_comments => 1, + parser => 'SQL::Translator::Parser::PostgreSQL', )->translate(\$source_ddl); my $target_sqlt = SQL::Translator->new( - no_comments => 1, - parser => 'SQL::Translator::Parser::PostgreSQL', + no_comments => 1, + parser => 'SQL::Translator::Parser::PostgreSQL', )->translate(\$target_ddl); my $table = $target_sqlt->get_table('sqlt_test_fluff'); -$table->extra( renamed_from => 'sqlt_test_foo' ); +$table->extra(renamed_from => 'sqlt_test_foo'); my $field = $table->get_field('biff'); -$field->extra( renamed_from => 'bar' ); +$field->extra(renamed_from => 'bar'); my @diff = SQL::Translator::Diff->new({ - output_db => 'PostgreSQL', - source_schema => $source_sqlt, - target_schema => $target_sqlt, + output_db => 'PostgreSQL', + source_schema => $source_sqlt, + target_schema => $target_sqlt, })->compute_differences->produce_diff_sql; foreach my $line (@diff) { - $line =~ s/\n//g; - next if $line =~ /^--/; - lives_ok { $dbh->do($line) } "$line"; + $line =~ s/\n//g; + next if $line =~ /^--/; + lives_ok { $dbh->do($line) } "$line"; } -ok ( $ret = $dbh->selectall_arrayref(q(SELECT biff FROM sqlt_test_fluff), { Slice => {} }), "query DB for data" ); +ok($ret = $dbh->selectall_arrayref(q(SELECT biff FROM sqlt_test_fluff), { Slice => {} }), "query DB for data"); -cmp_ok( scalar(@$ret), '==', 1, "Got 1 row"); +cmp_ok(scalar(@$ret), '==', 1, "Got 1 row"); -cmp_ok( $ret->[0]->{biff}, 'eq', 'buzz', "col biff has value buzz" ); +cmp_ok($ret->[0]->{biff}, 'eq', 'buzz', "col biff has value buzz"); # Make sure Test::PostgreSQL can kill Pg undef $dbh if $pg_tst; END { - if ($dbh && !$pg_tst) { - $dbh->do("drop table if exists sqlt_test_$_") foreach qw(foo fluff); - } - elsif( $pg_tst ) { - # do the teardown ourselves, work around RT#108460 - local $?; - $pg_tst->stop; - 1; - } + if ($dbh && !$pg_tst) { + $dbh->do("drop table if exists sqlt_test_$_") foreach qw(foo fluff); + } elsif ($pg_tst) { + + # do the teardown ourselves, work around RT#108460 + local $?; + $pg_tst->stop; + 1; + } } done_testing; diff --git a/t/sqlite-rename-field.t b/t/sqlite-rename-field.t index 63f52a409..c468f91f9 100644 --- a/t/sqlite-rename-field.t +++ b/t/sqlite-rename-field.t @@ -13,9 +13,9 @@ use SQL::Translator::Diff; eval "use DBD::SQLite"; plan skip_all => "DBD::SQLite required" if $@; -my ( $dbh , $ddl, $ret ); +my ($dbh, $ddl, $ret); -lives_ok { $dbh = DBI->connect("dbi:SQLite:dbname=:memory:")} "dbi connect"; +lives_ok { $dbh = DBI->connect("dbi:SQLite:dbname=:memory:") } "dbi connect"; my $source_ddl = <do($source_ddl) } "create table"; -lives_ok { $ret = $dbh->do(q| INSERT INTO Foo (bar) VALUES ('buzz') |) } "insert data"; +lives_ok { $ret = $dbh->do(q| INSERT INTO Foo (bar) VALUES ('buzz') |) } +"insert data"; -cmp_ok( $ret, '==', 1, "one row inserted" ); +cmp_ok($ret, '==', 1, "one row inserted"); my $target_ddl = <new( - no_comments => 1, - parser => 'SQL::Translator::Parser::SQLite', + no_comments => 1, + parser => 'SQL::Translator::Parser::SQLite', )->translate(\$source_ddl); my $target_sqlt = SQL::Translator->new( - no_comments => 1, - parser => 'SQL::Translator::Parser::SQLite', + no_comments => 1, + parser => 'SQL::Translator::Parser::SQLite', )->translate(\$target_ddl); my $table = $target_sqlt->get_table('Foo'); my $field = $table->get_field('biff'); -$field->extra( renamed_from => 'bar' ); +$field->extra(renamed_from => 'bar'); my @diff = SQL::Translator::Diff->new({ - output_db => 'SQLite', - source_schema => $source_sqlt, - target_schema => $target_sqlt, + output_db => 'SQLite', + source_schema => $source_sqlt, + target_schema => $target_sqlt, })->compute_differences->produce_diff_sql; foreach my $line (@diff) { - $line =~ s/\n//g; - lives_ok { $dbh->do($line) || die } "$line"; + $line =~ s/\n//g; + lives_ok { $dbh->do($line) || die } "$line"; } -lives_ok { $ret = $dbh->selectall_arrayref(q(SELECT biff FROM Foo), { Slice => {} }) } "query DB for data"; +lives_ok { + $ret = $dbh->selectall_arrayref(q(SELECT biff FROM Foo), { Slice => {} }) +} +"query DB for data"; -cmp_ok( scalar(@$ret), '==', 1, "Got 1 row"); +cmp_ok(scalar(@$ret), '==', 1, "Got 1 row"); -cmp_ok( $ret->[0]->{biff}, 'eq', 'buzz', "col biff has value buzz" ); +cmp_ok($ret->[0]->{biff}, 'eq', 'buzz', "col biff has value buzz"); done_testing; diff --git a/tidyall.ini b/tidyall.ini new file mode 100644 index 000000000..187152c0c --- /dev/null +++ b/tidyall.ini @@ -0,0 +1,4 @@ +[PerlTidy] +select = **/*.{pl,pm,t} +select = script/* +ignore = **/local/**/* diff --git a/xt/eol.t b/xt/eol.t index 349e099dd..abbf3ef7b 100644 --- a/xt/eol.t +++ b/xt/eol.t @@ -5,9 +5,7 @@ use Test::More; eval "use Test::EOL 1.1"; plan skip_all => 'Test::EOL 1.1 required' if $@; -Test::EOL::all_perl_files_ok({ trailing_whitespace => 1}, - qw|lib t xt script share/DiaUml|, -); +Test::EOL::all_perl_files_ok({ trailing_whitespace => 1 }, qw|lib t xt script share/DiaUml|,); # FIXME - Test::EOL declares 'no_plan' which conflicts with done_testing # https://github.com/schwern/test-more/issues/14 diff --git a/xt/notabs.t b/xt/notabs.t index 9de9721f6..b3e8049f2 100644 --- a/xt/notabs.t +++ b/xt/notabs.t @@ -6,9 +6,7 @@ use Test::More; eval "use Test::NoTabs 1.1"; plan skip_all => 'Test::NoTabs 1.1 required' if $@; -Test::NoTabs::all_perl_files_ok( - qw|lib t xt script share/DiaUml|, -); +Test::NoTabs::all_perl_files_ok(qw|lib t xt script share/DiaUml|,); # FIXME - Test::NoTabs declares 'no_plan' which conflicts with done_testing # https://github.com/schwern/test-more/issues/14