1Class::DBI::Search::BasUisce(r3)Contributed Perl DocumenCtlaatsiso:n:DBI::Search::Basic(3)
2
3
4
6 Class::DBI::Search::Basic - Simple Class::DBI search
7
9 my $searcher = Class::DBI::Search::Basic->new(
10 $cdbi_class, @search_args
11 );
12
13 my @results = $searcher->run_search;
14
15 # Over in your Class::DBI subclass:
16
17 __PACKAGE__->add_searcher(
18 search => "Class::DBI::Search::Basic",
19 isearch => "Class::DBI::Search::Plugin::CaseInsensitive",
20 );
21
23 This is the start of a pluggable Search infrastructure for Class::DBI.
24
25 At the minute Class::DBI::Search::Basic doubles up as both the default
26 search within Class::DBI as well as the search base class. We will
27 probably need to tease this apart more later and create an abstract
28 base class for search plugins.
29
31 new
32 my $searcher = Class::DBI::Search::Basic->new(
33 $cdbi_class, @search_args
34 );
35
36 A Searcher is created with the class to which the results will belong,
37 and the arguments passed to the search call by the user.
38
39 opt
40 if (my $order = $self->opt('order_by')) { ... }
41
42 The arguments passed to search may contain an options hash. This will
43 return the value of a given option.
44
45 run_search
46 my @results = $searcher->run_search;
47 my $iterator = $searcher->run_search;
48
49 Actually run the search.
50
52 sql / bind / fragment
53 The actual mechanics of generating the SQL and executing it split up
54 into a variety of methods for you to override.
55
56 run_search() is implemented as:
57
58 return $cdbi->sth_to_objects($self->sql, $self->bind);
59
60 Where sql() is
61
62 $cdbi->sql_Retrieve($self->fragment);
63
64 There are also a variety of private methods underneath this that could
65 be overriden in a pinch, but if you need to do this I'd rather you let
66 me know so that I can make them public, or at least so that I don't
67 remove them from under your feet.
68
69
70
71perl v5.36.0 2023-01-20 Class::DBI::Search::Basic(3)