abstract search method
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 8 Jul 2005 18:19:07 +0000 (18:19 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 8 Jul 2005 18:19:07 +0000 (18:19 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1103 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher.pm

index a46f2fe..9176210 100644 (file)
@@ -1,6 +1,7 @@
 package OpenILS::Application::Storage::CDBI;
 use base qw/Class::DBI/;
 use Class::DBI;
+use Class::DBI::AbstractSearch;
 
 use OpenILS::Application::Storage::CDBI::actor;
 use OpenILS::Application::Storage::CDBI::action;
index 923c004..23486ab 100644 (file)
@@ -125,24 +125,30 @@ sub retrieve_node {
        return undef;
 }
 
+sub search_where {
+       my $self = shift;
+       my $client = shift;
+       my @args = @_;
+
+       my $cdbi = $self->{cdbi};
+
+       for my $obj ($cdbi->search_where(@args)) {
+               next unless ref($obj);
+               $client->respond( $obj->to_fieldmapper );
+       }
+       return undef;
+}
+
 sub search {
        my $self = shift;
        my $client = shift;
        my @args = @_;
-       #my $searches = shift;
-       #my $options = shift;
 
        my $cdbi = $self->{cdbi};
 
        (my $search_type = $self->api_name) =~ s/.*\.(search[^.]*).*/$1/o;
 
-       #$log->debug("Searching $cdbi for { ".
-       #       join(',', map { "$_ => $$searches{$_}" } keys %$searches).
-       #       " } using $search_type",DEBUG);
-
-       #for my $obj ($cdbi->$search_type($searches, $options)) {
        for my $obj ($cdbi->$search_type(@args)) {
-               warn "$obj -> ".ref($obj);
                next unless ref($obj);
                $client->respond( $obj->to_fieldmapper );
        }
@@ -329,6 +335,17 @@ for my $fmclass ( (Fieldmapper->classes) ) {
                );
        }
 
+       unless ( __PACKAGE__->is_registered( $api_prefix.'.search_where' ) ) {
+               __PACKAGE__->register_method(
+                       api_name        => $api_prefix.'.search_where',
+                       method          => 'search_where',
+                       api_level       => 1,
+                       stream          => 1,
+                       cdbi            => $cdbi,
+                       cachable        => 1,
+               );
+       }
+
        unless ( __PACKAGE__->is_registered( $api_prefix.'.search_like' ) ) {
                __PACKAGE__->register_method(
                        api_name        => $api_prefix.'.search_like',