1DBIx::SearchBuilder::UnUisqeure(C3o)ntributed Perl DocumDeBnItxa:t:iSoenarchBuilder::Unique(3)
2
3
4
6 DBIx::SearchBuilder::Unique - Ensure uniqueness of records in a
7 collection
8
10 package Foo::Collection;
11 use base 'DBIx::SearchBuilder';
12
13 use DBIx::SearchBuilder::Unique; # mixin
14
15 my $collection = Foo::Collection->New();
16 $collection->SetupComplicatedJoins;
17 $collection->OrderByMagic;
18
19 while (my $thing = $collection->Next) {
20 # $thing is going to be distinct
21 }
22
24 Currently, DBIx::SearchBuilder makes exceptions for databases which
25 cannot handle both "SELECT DISTINCT" and ordering in the same
26 statement; it drops the "DISTINCT" requirement. This, of course, means
27 that you can get the same row twice, which you might not want. If
28 that's the case, use this module as a mix-in, and it will provide you
29 with an "AddRecord" method which ensures that a record will not appear
30 twice in the same search.
31
32
33
34perl v5.36.3 2023-12-04 DBIx::SearchBuilder::Unique(3)