ORM/Filter/Cmp.pm

filter: Statementstmt 91.6% 22 / 24 Branchbran 41.6% 5 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 76.1% 32 / 42 CC 7 SCAR 14.3
CC
7
Cov
75%
new
6.7
_tjoin
3.1
BEGIN
1.0
CRAP 4.2
« ORM/Error.pm ↑ Summary ORM/ResultSet.pm »
1 #
2 # DESCRIPTION
3 # PerlORM - Object relational mapper (ORM) for Perl. PerlORM is Perl
4 # library that implements object-relational mapping. Its features are
5 # much similar to those of Java's Hibernate library, but interface is
6 # much different and easier to use.
7 #
8 # AUTHOR
9 # Alexey V. Akimov <akimov_alexey@sourceforge.net>
10 #
11 # COPYRIGHT
12 # Copyright (C) 2005-2006 Alexey V. Akimov
13 #
14 # This library is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU Lesser General Public
16 # License as published by the Free Software Foundation; either
17 # version 2.1 of the License, or (at your option) any later version.
18 #
19 # This library is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 # Lesser General Public License for more details.
23 #
24 # You should have received a copy of the GNU Lesser General Public
25 # License along with this library; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #
28  
29 package ORM::Filter::Cmp;
30  
31 5 $VERSION=0.8;
32  
33 5 ▶use overload 'fallback' => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 5 ▶use base 'ORM::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 ##
37 ## CONSTRUCTORS
38 ##
39  
40 sub new
41 12 ▶{
Subroutine new: called CC=5 SCAR=19.1
Pod undocumented
42 12 my $class = shift;
43 12 my $self = { op => $_[0] };
44  
45 12 ▶ if( UNIVERSAL::isa( $_[1], 'ORM::Expr' ) )
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($_[1], 'ORM::Expr')) { } 12 0 12
46 {
47 12 $self->{arg1} = $_[1];
48 }
49 else
50 {
51 0 ▶ $self->{arg1} = ( ref $_[1] ? $_[1]->__ORM_db_value : $_[1] );
Branch: 1 branch
BranchTrueFalseTotal
ref $_[1] ? : 0 0 0
52 }
53  
54 12 ▶ if( UNIVERSAL::isa( $_[2], 'ORM::Expr' ) )
Branch: 1 branch
BranchTrueFalseTotal
if (UNIVERSAL::isa($_[2], 'ORM::Expr')) { } 0 12 12
55 {
56 0 $self->{arg2} = $_[2];
57 }
58 else
59 {
60 12 ▶ $self->{arg2} = ( ref $_[2] ? $_[2]->__ORM_db_value : $_[2] );
Branch: 1 branch
BranchTrueFalseTotal
ref $_[2] ? : 0 12 12
61 }
62  
63 12 return bless $self, $class;
64 }
65  
66 sub _sql_str
67 12 ▶{
Subroutine _sql_str: called CC=1 SCAR=0.0
68 12 my $self = shift;
69 12 my %arg = @_;
70  
71 return
72 '(' . $self->scalar2sql( $self->{arg1}, $arg{tjoin} )
73 . " $self->{op} "
74 12 . $self->scalar2sql( $self->{arg2}, $arg{tjoin} ) . ')';
75 }
76  
77 sub _tjoin
78 6 ▶{
Subroutine _tjoin: called CC=3 SCAR=11.3
79 6 my $self = shift;
80 6 my $tjoin = ORM::Tjoin->new;
81  
82 6 ▶ $tjoin->merge( $self->{arg1}->_tjoin ) if( ref $self->{arg1} );
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"arg1"} 6 0 6
83 6 ▶ $tjoin->merge( $self->{arg2}->_tjoin ) if( ref $self->{arg2} );
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"arg2"} 0 6 6
84  
85 6 return $tjoin;
86 }
« ORM/Error.pm ↑ Summary ORM/ResultSet.pm »