95024211e4c5938682cbb7c44e015ebfa3b16485
[dbsrgits/DBIx-Class.git] / t / prefetch / manual.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6 use lib qw(t/lib);
7 use DBICTest;
8
9 my $schema = DBICTest->init_schema();
10
11 my $rs = $schema->resultset ('CD')->search ({}, {
12   join => [ 'tracks', { single_track => { cd => { artist => { cds => 'tracks' } } } }  ],
13   collapse => 1,
14   columns => [
15     { 'year'                                    => 'me.year' },               # non-unique
16     { 'genreid'                                 => 'me.genreid' },            # nullable
17     { 'tracks.title'                            => 'tracks.title' },          # non-unique (no me.id)
18     { 'single_track.cd.artist.cds.cdid'         => 'cds.cdid' },              # to give uniquiness to ...tracks.title below
19     { 'single_track.cd.artist.artistid'         => 'artist.artistid' },       # uniqufies entire parental chain
20     { 'single_track.cd.artist.cds.year'         => 'cds.year' },              # non-unique
21     { 'single_track.cd.artist.cds.genreid'      => 'cds.genreid' },           # nullable
22     { 'single_track.cd.artist.cds.tracks.title' => 'tracks_2.title' },        # unique when combined with ...cds.cdid above
23     { 'latest_cd'                               => { max => 'cds.year' } },   # random function
24     { 'title'                                   => 'me.title' },              # uniquiness for me
25     { 'artist'                                  => 'me.artist' },             # uniquiness for me
26   ],
27   result_class => 'DBIx::Class::ResultClass::HashRefInflator',
28 });
29
30 use Data::Dumper::Concise;
31 die Dumper [$rs->all];
32
33