GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Jifty::DBI::Collection::Unique(3) User Contributed Perl Documentation Jifty::DBI::Collection::Unique(3)

Overrides add_record to ensure uniqueness.

Jifty::DBI::Collection::Unique - Ensure uniqueness of records in a collection

    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
    }

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.

Simon Cozens.

Copyright 2005 Best Practical Solutions, LLC

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2014-05-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.