| 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
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 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
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 56 | 0 | ▶ | if (defined($val)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 57 | 0 | $cond = '!='; | |||||||||||||||||||
| 58 | 0 | ▶ | if ($bind) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 59 | 0 | ▶ | return wantarray ? ($cond, '?') : $cond; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | else { | ||||||||||||||||||||
| 62 | 0 | my $rv = $self->{_dbh}->quote($val); | |||||||||||||||||||
| 63 | 0 | ▶ | return wantarray ? ($cond, $rv) : $cond; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | else { | ||||||||||||||||||||
| 68 | 0 | $cond = 'IS NOT NULL'; | |||||||||||||||||||
| 69 | 0 | ▶ | return wantarray ? ($cond, undef) : $cond; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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 | |||||||||||||||||||||