File Coverage

blib/lib/DBR/Query/Part.pm
Criterion Covered Total %
statement 32 34 94.1
branch 3 6 50.0
condition n/a
subroutine 10 12 83.3
pod 0 2 0.0
total 45 54 83.3


line stmt bran cond sub pod time code
1             # the contents of this file are Copyright (c) 2009 Daniel Norman
2             # This program is free software; you can redistribute it and/or
3             # modify it under the terms of the GNU General Public License as
4             # published by the Free Software Foundation.
5              
6             ###########################################
7             package DBR::Query::Part;
8              
9 18     18   97 use strict;
  18         34  
  18         790  
10 18     18   183 use base 'DBR::Common';
  18         33  
  18         1525  
11 18     18   9595 use DBR::Query::Part::AndOr;
  18         81  
  18         730  
12 18     18   11199 use DBR::Query::Part::Compare;
  18         139  
  18         1022  
13 18     18   12834 use DBR::Query::Part::Join;
  18         53  
  18         555  
14 18     18   10008 use DBR::Query::Part::Set;
  18         50  
  18         794  
15 18     18   9381 use DBR::Query::Part::Subquery;
  18         52  
  18         703  
16 18     18   109 use Carp;
  18         35  
  18         14038  
17              
18             sub validate{
19 1020     1020 0 1571 my $self = shift;
20 1020         1839 my $query = shift;
21              
22 1020 50       11011 croak('Query object is required') unless ref($query) =~/^DBR::Query::/;
23              
24 1020 50       4352 $self->_validate_self($query) or return $self->_error('Failed to validate ' . ref($self) );
25              
26 1020         4408 for ($self->children){
27 407 50       1816 return undef unless $_->validate($query)
28             }
29              
30 1020         4026 return 1;
31             }
32              
33 0     0   0 sub _session { undef }
34 0     0   0 sub _validate_self{ 0 } # I'm not valid unless I'm overridden
35              
36 3     3 0 24 sub children{ return () }
37              
38              
39             1;