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
33 my $searcher = Class::DBI::Search::Basic->new(
34 $cdbi_class, @search_args
35 );
36
37 A Searcher is created with the class to which the results will belong,
38 and the arguments passed to the search call by the user.
39
40 opt
41
42 if (my $order = $self->opt('order_by')) { ... }
43
44 The arguments passed to search may contain an options hash. This will
45 return the value of a given option.
46
47 run_search
48
49 my @results = $searcher->run_search;
50 my $iterator = $searcher->run_search;
51
52 Actually run the search.
53
55 sql / bind / fragment
56
57 The actual mechanics of generating the SQL and executing it split up
58 into a variety of methods for you to override.
59
60 run_search() is implemented as:
61
62 return $cdbi->sth_to_objects($self->sql, $self->bind);
63
64 Where sql() is
65
66 $cdbi->sql_Retrieve($self->fragment);
67
68 There are also a variety of private methods underneath this that could
69 be overriden in a pinch, but if you need to do this I'd rather you let
70 me know so that I can make them public, or at least so that I don't
71 remove them from under your feet.
72
73
74
75perl v5.8.8 2006-11-05 Class::DBI::Search::Basic(3)