Wrapper/SQLCommand.pm

filter: Statementstmt 29.2% 12 / 41 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 25.0% 2 / 8 Podpod 0.0% 0 / 6 totaltotal 17.7% 14 / 79 CC 10 SCAR 35.8
CC
10
Cov
20%
get_condition
72.0
new
6.0
new_cond
6.0
CRAP 35.8
« Wrapper.pm ↑ Summary Wrapper/SelectExecLoop.pm »
1 # -*-perl-*-
2 # Creation date: 2003-03-30 16:26:50
3 # Authors: Don
4 # Change log:
5 # $Revision: 1963 $
6  
7 # Copyright (c) 2003-2012 Don Owens
8 #
9 # All rights reserved. This program is free software; you can
10 # redistribute it and/or modify it under the same terms as Perl
11 # itself.
12  
13 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 { package DBIx::Wrapper::SQLCommand;
16  
17 2 ▶ use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 $VERSION = do { my @r=(q$Revision: 1963 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r };
19  
20 0 ▶ sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
21 0 my $proto = shift;
22 0 my $str = shift;
23
24 0 ▶ my $self = bless { _str => $str }, ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
25 0 return $self;
26 }
27  
28 0 ▶ sub new_cond {
Subroutine new_cond: not called CC=2 SCAR=17.9
Pod undocumented
29 0 my ($proto, $dbh, $cond, $val) = @_;
30 0 ▶ my $self = bless { _cond => $cond, _dbh => $dbh, _val => $val }, ref($proto) || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
31 0 return $self;
32  
33 }
34  
35 0 ▶ sub asString {
Subroutine asString: not called CC=1 SCAR=6.9
Pod undocumented
36 0 my $self = shift;
37 0 my $str = $self->{_str};
38 0 return $str;
39 }
40 2 *as_string = \&asString;
41  
42 0 ▶ sub get_condition {
Subroutine get_condition: not called CC=8 SCAR=42.8
Pod undocumented
43 0 my $self = shift;
44 0 my $bind = shift;
45
46 0 my $cond_str = $self->{_cond};
47  
48 0 ▶ unless (defined($cond_str)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $cond_str) 0 0 0
49 0 return;
50 }
51  
52 0 my $val = $self->{_val};
53  
54 0 my $cond = '';
55 0 ▶ if ($cond_str eq 'not') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond_str eq "not") 0 0 0
56 0 ▶ if (defined($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $val) { } 0 0 0
57 0 $cond = '!=';
58 0 ▶ if ($bind) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind) { } 0 0 0
59 0 ▶ return wantarray ? ($cond, '?') : $cond;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
60 }
61 else {
62 0 my $rv = $self->{_dbh}->quote($val);
63 0 ▶ return wantarray ? ($cond, $rv) : $cond;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
64 }
65
66 }
67 else {
68 0 $cond = 'IS NOT NULL';
69 0 ▶ return wantarray ? ($cond, undef) : $cond;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
70 }
71 }
72
73 }
74  
75 0 ▶ sub has_condition {
Subroutine has_condition: not called CC=1 SCAR=6.9
Pod undocumented
76 0 my $self = shift;
77 0 return defined($self->{_cond});
78 }
79  
80 0 ▶ sub get_val {
Subroutine get_val: not called CC=1 SCAR=6.9
Pod undocumented
81 0 return shift()->{_val};
82 }
83
84 }
85  
86 2 1;
87  
88  
« Wrapper.pm ↑ Summary Wrapper/SelectExecLoop.pm »