SQLEngine/Criteria.pm

filter: Statementstmt 82.1% 23 / 28 Branchbran 70.0% 7 / 10 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 75.0% 6 / 8 Podpod 100% 4 / 4 totaltotal 78.1% 43 / 55 CC 7 SCAR 16.0
CC
7
Cov
78%
auto
8.6
sql_comparator
2.0
sql_comparator
2.0
CRAP 4.9
« SQLEngine/Criteria/Compound.pm ↑ Summary SQLEngine/Record/Cache.pm »
1 package DBIx::SQLEngine::Criteria;
2 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 ########################################################################
5  
6 12 ▶use Class::MakeMethods (
Subroutine BEGIN: called CC=1 SCAR=0.0
7 12 'Standard::Universal:abstract' => 'new',
8 'Template::ClassName:subclass_name --require' => 'type',
9 12 );
10  
11 100 ▶sub type_new {
Subroutine type_new: called CC=1 SCAR=0.0
Pod documented
12 100 (shift)->type( shift )->new( @_ );
13 }
14  
15 ########################################################################
16  
17 50 ▶sub auto {
Subroutine auto: called CC=7 SCAR=21.5
Pod documented
18 50 my $package = shift;
19 50 local $_ = shift;
20 50 ▶ if ( ! $_ ) {
Branch: 5 branches
BranchTrueFalseTotal
if (not $_) { } 0 50 50
elsif (not ref $_ and length $_) { } 4 46 50
elsif (UNIVERSAL::can($_, 'sql_where')) { } 0 46 46
elsif (ref $_ eq 'ARRAY') { } 1 45 46
elsif (ref $_ eq 'HASH') { } 45 0 45
21 0 ();
22 ▶ } elsif ( ! ref( $_ ) and length( $_ ) ) {
Condition66%2/3
not ref $_ and length $_
!ll&&!rl&&r
4604
MC/DC50%1/2
not ref $_ and length $_
not ref $_ length $_
Truth table66%2/3
not(A) and B
A= not ref $_B= length $_
ABresult
0X0
100
111
23 4 $package->type_new('LiteralSQL', $_ );
24 } elsif ( UNIVERSAL::can($_, 'sql_where') ) {
25 0 $_;
26 } elsif ( ref($_) eq 'ARRAY' ) {
27 1 $package->type_new('LiteralSQL', @$_ );
28 } elsif ( ref($_) eq 'HASH' ) {
29 45 $package->type_new('HashGroup', %$_ );
30 } else {
31 0 confess("Unsupported criteria spec '$_'");
32 }
33 }
34  
35 50 ▶sub auto_and {
Subroutine auto_and: called CC=1 SCAR=0.0
Pod documented
36 50 my $package = shift;
37 50 $package->type_new('And', map { $package->auto( $_ ) } @_ )
38 }
39  
40 50 ▶sub auto_where {
Subroutine auto_where: called CC=1 SCAR=0.0
Pod documented
41 50 my $package = shift;
42 50 $package->auto_and( @_ )->sql_where;
43 }
44  
45 ########################################################################
46  
47 package DBIx::SQLEngine::Criteria::StringEquality;
48 12 require DBIx::SQLEngine::Criteria::Equality;
49 12 @DBIx::SQLEngine::Criteria::StringEquality::ISA =
50 'DBIx::SQLEngine::Criteria::Equality';
51 0 ▶sub sql_comparator { DBIx::SQLEngine::Criteria::Equality->sql_comparator }
Subroutine sql_comparator: not called CC=1 SCAR=6.9
52  
53 ########################################################################
54  
55 package DBIx::SQLEngine::Criteria::NumericLesser;
56 12 require DBIx::SQLEngine::Criteria::Lesser;
57 12 @DBIx::SQLEngine::Criteria::NumericLesser::ISA =
58 'DBIx::SQLEngine::Criteria::Lesser';
59 0 ▶sub sql_comparator { DBIx::SQLEngine::Criteria::Lesser->sql_comparator }
Subroutine sql_comparator: not called CC=1 SCAR=6.9
60  
61 ########################################################################
62  
63 12 1;
64  
65 __END__
« SQLEngine/Criteria/Compound.pm ↑ Summary SQLEngine/Record/Cache.pm »