From: Nigel Metheringham Date: Tue, 24 Feb 2009 18:28:54 +0000 (+0000) Subject: Merge 'column_attr' into 'trunk' X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b95f66d0e42dac7d62b845e1ccfe84b9da697339;p=dbsrgits%2FDBIx-Class-Historic.git Merge 'column_attr' into 'trunk' r10954@hex: nigel | 2009-02-24 12:28:54 +0000 Merged in column_attr branch:- Resultset attributes now include the following items to specify "select" and "as" values:- columns - list of columns (specifies both select and as) +columns - list of extra columns (specifies both select and as) select - list of select values only +select - list of extra select values only as - list of as values only +as - list of extra as values only include_columns - deprecated alias for +columns The values for columns/+columns/include_columns may include hashrefs, in which case the hash is interpreted as {as => select}, allowing queries involving functions to be specified without needing the information to be split into 2 separate places. --- b95f66d0e42dac7d62b845e1ccfe84b9da697339 diff --cc t/60core.t index d9d0191,0c7d434..011675b --- a/t/60core.t +++ b/t/60core.t @@@ -228,9 -240,9 +240,9 @@@ cmp_ok($or_rs->count, '==', 5, 'Search my $distinct_rs = $schema->resultset("CD")->search($search, { join => 'tags', distinct => 1 }); cmp_ok($distinct_rs->all, '==', 4, 'DISTINCT search with OR ok'); -#SKIP: { -# skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 2 -# if $is_broken_sqlite; +SKIP: { - skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 1 ++ skip "SQLite < 3.2.6 doesn't understand COUNT(DISTINCT())", 2 + if $is_broken_sqlite; my $tcount = $schema->resultset("Track")->search( {}, @@@ -241,7 -253,15 +253,15 @@@ ); cmp_ok($tcount->next->get_column('count'), '==', 13, 'multiple column COUNT DISTINCT ok'); + $tcount = $schema->resultset("Track")->search( + {}, + { + columns => {count => {count => {distinct => ['position', 'title']}}}, + } + ); + cmp_ok($tcount->next->get_column('count'), '==', 13, 'multiple column COUNT DISTINCT using column syntax ok'); +} + -#} my $tag_rs = $schema->resultset('Tag')->search( [ { 'me.tag' => 'Cheesy' }, { 'me.tag' => 'Blue' } ]);