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
33 Simon Cozens.
34
36 Copyright 2005 Best Practical Solutions, LLC
37
38 This library is free software; you can redistribute it and/or modify it
39 under the same terms as Perl itself.
40
41
42
43perl v5.32.0 2020-07-28 DBIx::SearchBuilder::Unique(3)