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

AUTHOR

58       Tony Bowden
59

BUGS and QUERIES

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