1Class::DBI::Plugin::RetUrsieerveCAolnlt(r3i)buted Perl DColcausmse:n:tDaBtIi:o:nPlugin::RetrieveAll(3)
2
3
4

NAME

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

SYNOPSIS

10               use base 'Class::DBI';
11               use Class::DBI::Plugin::RetrieveAll;
12
13               my @by_date = My::Class->retrieve_all_sorted_by("date");
14
15               # or
16
17               __PACKAGE__->retrieve_all_sort_field('date');
18
19               my @by_date = My::Class->retrieve_all;
20

DESCRIPTION

22       This is a simple plugin to a Class::DBI subclass that allows for simple
23       sorting of the results of a retrieve_all().
24
25       There are two main ways to use this.
26
27       Firstly, we create a new method 'retrieve_all_sorted_by' which takes an
28       argument of how to sort.
29
30       We also add a method for 'retrieve_all_sort_field' that sets a default
31       field that any retrieve_all() will use for sorting.
32

METHODS

34   retrieve_all_sorted_by
35               my @by_date = My::Class->retrieve_all_sorted_by("date");
36
37       This method will be exported into the calling class, and allows for
38       retrieving all the objects of the class, sorted by the given column.
39
40       The argument given will be passed straight through to the database 'as
41       is', and is not checked in any way, so an error here will usually in an
42       error from the database, rather than Class::DBI itself.
43
44       This makes it possible to pass more complex ORDER BY clauses through:
45
46               my @by_date = My::Class->retrieve_all_sorted_by("date DESC, reference_no");
47
48   retrieve_all_sort_field
49         __PACKAGE__->retrieve_all_sort_field('date');
50
51       This method changes the default retrieve_all() in the Class to be auto-
52       sorted by the field given. Again this will be passed through directly,
53       so you can have complex ORDER BY clauses.
54

AUTHOR

56       Tony Bowden
57

BUGS and QUERIES

59       Please direct all correspondence regarding this module to:
60         bug-Class-DBI-Plugin-RetrieveAll@rt.cpan.org
61
63       Copyright (C) 2004-2006 Kasei. All rights reserved.
64
65       This module is free software; you can redistribute it and/or modify it
66       under the same terms as Perl itself.
67
68
69
70perl v5.12.0                      2006-01-16Class::DBI::Plugin::RetrieveAll(3)
Impressum