File Coverage

blib/lib/DBR/Query/Part/Set.pm
Criterion Covered Total %
statement 16 18 88.8
branch 2 4 50.0
condition n/a
subroutine 6 8 75.0
pod 0 5 0.0
total 24 35 68.5


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::Set;
8              
9 18     18   99 use strict;
  18         35  
  18         806  
10 18     18   90 use base 'DBR::Query::Part';
  18         35  
  18         6619  
11              
12             sub new{
13 2088     2088 0 3310 my( $package ) = shift;
14 2088         3471 my ($field,$value) = @_;
15              
16 2088 50       8951 return $package->_error('field must be a Field object') unless ref($field) =~ /^DBR::Config::Field/; # Could be ::Anon
17 2088 50       7212 return $package->_error('value must be a Value object') unless ref($value) eq 'DBR::Query::Part::Value';
18              
19 2088         4851 my $self = [ $field, $value ];
20              
21 2088         10838 bless( $self, $package );
22 2088         8939 return $self;
23             }
24              
25              
26              
27 4134     4134 0 28272 sub field { return $_[0]->[0] }
28 2099     2099 0 36520 sub value { return $_[0]->[1] }
29 58     58 0 242 sub sql { return $_[0]->field->sql($_[1]) . ' = ' . $_[0]->value->sql($_[1]) }
30 0     0     sub _validate_self{ 1 }
31              
32 0     0 0   sub validate{ 1 }
33              
34             1;