From: Ken Youens-Clark Date: Tue, 28 Feb 2012 22:11:29 +0000 (-0500) Subject: Some aesthetic changes X-Git-Tag: v0.11011~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9a2a1d9f8ab219877ccdea0adb610943e804357;p=dbsrgits%2FSQL-Translator.git Some aesthetic changes --- diff --git a/lib/SQL/Translator/Parser/MySQL.pm b/lib/SQL/Translator/Parser/MySQL.pm index 9de9ada..e830df8 100644 --- a/lib/SQL/Translator/Parser/MySQL.pm +++ b/lib/SQL/Translator/Parser/MySQL.pm @@ -891,10 +891,12 @@ 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. - + # 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; diff --git a/lib/SQL/Translator/Schema/View.pm b/lib/SQL/Translator/Schema/View.pm index 9ff84cc..462a9e8 100644 --- a/lib/SQL/Translator/Schema/View.pm +++ b/lib/SQL/Translator/Schema/View.pm @@ -73,15 +73,16 @@ names and keep them in order by the first occurrence of a field name. if ( @$fields ) { my ( %unique, @unique ); for my $f ( @$fields ) { - next if $unique{ $f }; - $unique{ $f } = 1; + next if $unique{ $f }++; push @unique, $f; } $self->{'fields'} = \@unique; } - return wantarray ? @{ $self->{'fields'} || [] } : ($self->{'fields'} || ''); + my @flds = @{ $self->{'fields'} || [] }; + + return wantarray ? @flds : \@flds; } sub is_valid { diff --git a/t/24yaml.t b/t/24yaml.t index 273a750..4e54988 100644 --- a/t/24yaml.t +++ b/t/24yaml.t @@ -211,7 +211,7 @@ schema: perform_action_when: after views: person_pet: - fields: '' + fields: [] name: person_pet order: 1 sql: |