From: Richard W. Norton Date: Tue, 8 Mar 2011 05:15:22 +0000 (-0500) Subject: Added tests for long relationship names using group_by and join. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3881ef4abbc7b068bbca58a812335148cab196d8;p=dbsrgits%2FDBIx-Class-Historic.git Added tests for long relationship names using group_by and join. --- diff --git a/t/73oracle.t b/t/73oracle.t index 45f6152..6506a4e 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -220,6 +220,49 @@ sub _run_tests { is $query->first->cds_very_very_very_long_relationship_name->first->cdid, 1 } 'query with rel name over 30 chars survived and worked'; +# test rel names over the 30 char limit using group_by and join + { + my @group_cols = ( 'me.name' ); + my $query = $schema->resultset('Artist')->search({ + artistid => 1 + }, { + select => \@group_cols, + as => [map { /^\w+\.(\w+)$/ } @group_cols], + join => [qw( cds_very_very_very_long_relationship_name )], + group_by => \@group_cols, + }); + + lives_and { + my @got = $query->get_column('name')->all(); + is_deeply \@got, [$new_artist->name]; + } 'query with rel name over 30 chars worked on join, group_by for me col'; + + lives_and { + is $query->count(), 1 + } 'query with rel name over 30 chars worked on join, group_by, count for me col'; + } + { + local $TODO = 'group_by on rel longer than 30 chars for long rel cols'; + my @group_cols = ( 'cds_very_very_very_long_relationship_name.title' ); + my $query = $schema->resultset('Artist')->search({ + artistid => 1 + }, { + select => \@group_cols, + as => [map { /^\w+\.(\w+)$/ } @group_cols], + join => [qw( cds_very_very_very_long_relationship_name )], + group_by => \@group_cols, + }); + + lives_and { + my @got = $query->get_column('title')->all(); + is_deeply \@got, [$new_cd->title]; + } 'query with rel name over 30 chars worked on join, group_by for long rel col'; + + lives_and { + is $query->count(), 1 + } 'query with rel name over 30 chars worked on join, group_by, count for long rel col'; + } + # rel name over 30 char limit with user condition # This requires walking the SQLA data structure. {