ObjectDriver/BaseView.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 45 CC 3 SCAR 17.5
CC
3
Cov
0%
search
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.8
1 # $Id$
2  
3 package Data::ObjectDriver::BaseView;
4 use strict;
5 use warnings;
6  
7 use base qw( Data::ObjectDriver::BaseObject );
8  
9 use Carp ();
10 use Storable;
11  
12 sub search {
13 my $class = shift;
14 my($terms, $args) = @_;
15 $args->{sql_statement} = $class->base_statement($terms, $args);
16 $args = Storable::dclone($args);
17  
18 # quick hack: don't use HAVING if view class has datasource
19 if (! $class->properties->{datasource}) {
20 my %cols = map { $_ => 1 } @{ $class->properties->{columns} };
21 my %having;
22 for my $key (keys %$terms) {
23 if ($cols{$key} && ! $args->{sql_statement}->has_where($key)) {
24 # Don't need to delete from $term, because D::OD ignores
25 # it anyway when used as View class
26 $having{$key} = $terms->{$key};
27 }
28 }
29 $args->{having} = \%having;
30 }
31  
32 $class->_proxy('search', $terms, $args)
33 }
34  
35 1;