1Class::DBI::AbstractSeaUrscehr(3C)ontributed Perl DocumeCnltaastsi:o:nDBI::AbstractSearch(3)
2
3
4
6 Class::DBI::AbstractSearch - Abstract Class::DBI's SQL with
7 SQL::Abstract::Limit
8
10 package CD::Music;
11 use Class::DBI::AbstractSearch;
12
13 package main;
14 my @music = CD::Music->search_where(
15 artist => [ 'Ozzy', 'Kelly' ],
16 status => { '!=', 'outdated' },
17 );
18
19 my @misc = CD::Music->search_where(
20 { artist => [ 'Ozzy', 'Kelly' ],
21 status => { '!=', 'outdated' } },
22 { order_by => "reldate DESC",
23 limit_dialect => 'LimitOffset',
24 limit => 1
25 offset => 2 });
26
28 Class::DBI::AbstractSearch is a Class::DBI plugin to glue
29 SQL::Abstract::Limit into Class::DBI.
30
32 Using this module adds following methods into your data class.
33
34 search_where
35 $class->search_where(%where);
36
37 Takes a hash to specify WHERE clause. See SQL::Abstract for hash
38 options.
39
40 $class->search_where(\%where,\%attrs);
41
42 Takes hash reference to specify WHERE clause. See SQL::Abstract for
43 hash options. Takes a hash reference to specify additional query
44 attributes. Class::DBI::AbstractSearch uses these attributes:
45
46 · order_by
47
48 Array reference of fields that will be used to order the
49 results of your query.
50
51 · limit_dialect
52
53 Scalar, DBI handle, object class, etc. that describes the
54 syntax model for a LIMIT/OFFSET SQL clause. Please see
55 SQL::Abstract::Limit for more information.
56
57 · limit
58
59 Scalar value that will be used for LIMIT argument in a query.
60
61 · offset
62
63 Scalar value that will be used for OFFSET argument in a query.
64
65 Any other attributes are passed to the SQL::Abstract::Limit
66 constructor, and can be used to control how queries are created.
67 For example, to use 'AND' instead of 'OR' by default, use:
68
69 $class->search_where(\%where, { logic => 'AND' });
70
72 Tatsuhiko Miyagawa <miyagawa@bulknews.net> with some help from cdbi-
73 talk mailing list, especially:
74
75 Tim Bunce
76 Simon Wilcox
77 Tony Bowden
78
79 This library is free software; you can redistribute it and/or modify it
80 under the same terms as Perl itself.
81
83 Class::DBI, SQL::Abstract, SQL::Abstract::Limit
84
86 Hey! The above document had some coding errors, which are explained
87 below:
88
89 Around line 123:
90 You forgot a '=back' before '=head1'
91
92
93
94perl v5.32.0 2020-07-28 Class::DBI::AbstractSearch(3)