Tony Bowden > Class-DBI-Plugin-RetrieveAll-1 > Class::DBI::Plugin::RetrieveAll

Download:
Class-DBI-Plugin-RetrieveAll-1.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 1   Source   Latest Release: Class-DBI-Plugin-RetrieveAll-1.04

NAME ^

Class::DBI::Plugin::RetrieveAll - more complex retrieve_all() for Class::DBI

SYNOPSIS ^

        use base 'Class::DBI';
        use Class::DBI::Plugin::RetrieveAll;

        my @by_date = My::Class->retrieve_all_sorted_by("date");

DESCRIPTION ^

This is a simple plugin to a Class::DBI subclass which provides a 'retrieve_all_sorted_by' method.

METHODS ^

retrieve_all_sorted_by

        my @by_date = My::Class->retrieve_all_sorted_by("date");

This method will be exported into the calling class, and allows for retrieving all the objects of the class, sorted by the given column.

The argument given will be passed straight through to the database 'as is', and is not checked in any way, so an error here will probably result in an error from the database, rather than Class::DBI itself. However, because of this it is possible to pass more complex ORDER BY clauses through:

        my @by_date = My::Class->retrieve_all_sorted_by("date DESC, reference_no");

AUTHOR ^

Tony Bowden, <kasei@tmtm.com>.

COPYRIGHT ^

Copyright (C) 2004 Kasei. All rights reserved.

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