Jifty::DBI::Collection::Unique(3pm)

Jifty::DBI::Collection::Unique3pm

Ensure uniqueness of records in a collection

Usage

    package Foo::Collection;
    use base 'Jifty::DBI::Collection';
    use Jifty::DBI::Collection::Unique; # mixin
    my $collection = Foo::Collection->New();
    $collection->SetupComplicatedJoins;
    $collection->OrderByMagic;
    
    while (my $thing = $collection->Next) {
        # $thing is going to be distinct
    }

add_record

Overrides add_record to ensure uniqueness.

Overview

Currently, Jifty::DBI makes exceptions for databases which cannot handle both "SELECT DISTINCT" and ordering in the same statement; it drops the "DISTINCT" requirement. This, of course, means that you can get the same row twice, which you might not want. If that's the case, use this module as a mix-in, and it will provide you with an "AddRecord" method which ensures that a record will not appear twice in the same search.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 5 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9–11
  6. 12–13

Author

Simon Cozens.

From libjifty-dbi-perl 0.78-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.