ORM/Filter/Interval.pm

filter: Statementstmt 33.3% 7 / 21 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 40.0% 2 / 5 Podpod 0.0% 0 / 1 totaltotal 27.2% 9 / 33 CC 4 SCAR 18.7
CC
4
Cov
26%
new
12.0
_tjoin
6.0
_sql_str
2.0
CRAP 6.5
« ORM/Meta/Array.pm ↑ Summary ORM/Date.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::Interval;
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 0 ▶{
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
42 0 my $class = shift;
43 0 my $self = { interval => (shift @_), arg => (shift @_) };
44  
45 0 ▶ if( ref $self->{arg} )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{"arg"}) 0 0 0
46 {
47 0 ▶ unless( UNIVERSAL::isa( $self->{arg}, 'ORM::Expr' ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (UNIVERSAL::isa($self->{"arg"}, "ORM::Expr")) 0 0 0
48 {
49 0 $self->{arg} = $self->{arg}->__ORM_db_value;
50 }
51 }
52  
53 0 return bless $self, $class;
54 }
55  
56 ##
57 ## PROPERTIES
58 ##
59  
60 sub _sql_str
61 0 ▶{
Subroutine _sql_str: not called CC=1 SCAR=6.9
62 0 my $self = shift;
63 0 my %arg = @_;
64 0 my $sql;
65  
66 0 return 'INTERVAL '.$self->scalar2sql( $self->{arg}, $arg{tjoin} ).' '.$self->{interval};
67 }
68  
69 sub _tjoin
70 0 ▶{
Subroutine _tjoin: not called CC=2 SCAR=17.9
71 0 my $self = shift;
72 0 my $tjoin = ORM::Tjoin->new;
73  
74 0 ▶ $tjoin->merge( $self->{arg}->_tjoin ) if( ref $self->{arg} );
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"arg"} 0 0 0
75  
76 0 return $tjoin;
77 }
« ORM/Meta/Array.pm ↑ Summary ORM/Date.pm »