9 my $schema = DBICTest->init_schema(no_populate => 1);
11 $schema->resultset('CD')->create({
14 artist => { name => 'JMJ' },
15 genre => { name => 'electro' },
30 title => 'Magnetic Fields',
32 genre => { name => 'electro' },
43 { title => 'o2', position => 2}, # the position should not be here, bug in MC
49 my $rs = $schema->resultset ('CD')->search ({}, {
50 join => [ 'tracks', { single_track => { cd => { artist => { cds => 'tracks' } } } } ],
53 { 'year' => 'me.year' }, # non-unique
54 { 'genreid' => 'me.genreid' }, # nullable
55 { 'tracks.title' => 'tracks.title' }, # non-unique (no me.id)
56 { 'single_track.cd.artist.cds.cdid' => 'cds.cdid' }, # to give uniquiness to ...tracks.title below
57 { 'single_track.cd.artist.artistid' => 'artist.artistid' }, # uniqufies entire parental chain
58 { 'single_track.cd.artist.cds.year' => 'cds.year' }, # non-unique
59 { 'single_track.cd.artist.cds.genreid' => 'cds.genreid' }, # nullable
60 { 'single_track.cd.artist.cds.tracks.title' => 'tracks_2.title' }, # unique when combined with ...cds.cdid above
61 { 'latest_cd' => \ "(SELECT MAX(year) FROM cd)" }, # random function
62 { 'title' => 'me.title' }, # uniquiness for me
63 { 'artist' => 'me.artist' }, # uniquiness for me
65 order_by => [{ -desc => 'cds.year' }, { -desc => 'me.title'} ],
68 my $hri_rs = $rs->search({}, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' });
152 single_track => undef,
168 single_track => undef,
169 title => "Magnetic Fields",
187 'W00T, manual prefetch with collapse works'
193 local $TODO = 'Something is wrong with filter type rels, they throw on incomplete objects >.<';
197 { $row->single_track->get_columns },
199 'empty intermediate object ok',
204 is ($rs->cursor->next, undef, 'cursor exhausted');