DBIC_TRACE_PROFILE
[dbsrgits/DBIx-Class.git] / t / search / distinct.t
CommitLineData
d955e938 1use strict;
2use warnings;
3
4use Test::More;
5use Test::Exception;
6
7use lib qw(t/lib);
8use DBIC::SqlMakerTest;
9use DBICTest;
10
11my $schema = DBICTest->init_schema();
12
13# make sure order + distinct do not double-inject group criteria
14my $year_rs = $schema->resultset ('CD')->search ({}, {
15 distinct => 1,
16 columns => [qw/year/],
17 order_by => 'year',
18});
19
20is_same_sql_bind (
21 $year_rs->as_query,
22 '(
23 SELECT me.year
24 FROM cd me
25 GROUP BY me.year
26 ORDER BY year
27 )',
28 [],
29 'Correct GROUP BY',
30);
31
32done_testing;