1SearchBuilder::Unique(3U)ser Contributed Perl DocumentatiSoenarchBuilder::Unique(3)
2
3
4
6 DBIx::SearchBuilder::Unique - Ensure uniqueness of records in a collec‐
7 tion
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 state‐
26 ment; it drops the "DISTINCT" requirement. This, of course, means that
27 you can get the same row twice, which you might not want. If that's the
28 case, use this module as a mix-in, and it will provide you with an
29 "AddRecord" method which ensures that a record will not appear twice in
30 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.8.8 2007-02-17 SearchBuilder::Unique(3)