blib/lib/DBD/BlackHole.pm

filter: Statementstmt 97.5% 79 / 81 Branchbran 70.0% 7 / 10 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 91.1% 31 / 34 Podpod 0.0% 0 / 1 totaltotal 86.3% 120 / 139 CC 9 SCAR 5.0
CC
9
Cov
90%
STORE
4.2
get_info
3.0
driver
2.3
CRAP 1.7
↑ Summary
1 package DBD::BlackHole;
2 7 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 our $VERSION = "0.04";
7  
8 7 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 7 our $drh = undef;
11 7 our $err = '';
12 7 our $errstr = '';
13  
14 6 ▶sub driver {
Subroutine driver: called CC=2 SCAR=8.1
Pod undocumented
15 6 my ($class, $attr) = @_;
16 6 ▶ return $drh ||= DBI::_new_drh("${class}::dr", {
Condition33%1/3
$DBD::BlackHole::drh ||= DBI::_new_drh("${class}::dr", {"Name", "BlackHole", "Version", $DBD::BlackHole::VERSION, "Attribution", "BlackHole DBD driver", "Err", \$DBD::BlackHole::err, "Errstr", \$DBD::BlackHole::errstr})
l!l&&r!l&&!r
060
MC/DC0%0/2
$DBD::BlackHole::drh ||= DBI::_new_drh("${class}::dr", {"Name", "BlackHole", "Version", $DBD::BlackHole::VERSION, "Attribution", "BlackHole DBD driver", "Err", \$DBD::BlackHole::err, "Errstr", \$DBD::BlackHole::errstr})
$DBD::BlackHole::drh DBI::_new_drh("${class}::dr", {"Name", "BlackHole", "Version", $DBD::BlackHole::VERSION, "Attribution", "BlackHole DBD driver", "Err", \$DBD::BlackHole::err, "Errstr", \$DBD::BlackHole::errstr})
Truth table33%1/3
A ||= B
A= $DBD::BlackHole::drhB= DBI::_new_drh("${class}::dr", {"Name", "BlackHole", "Version", $DBD::BlackHole::VERSION, "Attribution", "BlackHole DBD driver", "Err", \$DBD::BlackHole::err, "Errstr", \$DBD::BlackHole::errstr})
ABresult
1X1
011
000
17 Name => 'BlackHole',
18 Version => $VERSION,
19 Attribution => 'BlackHole DBD driver',
20 Err => \$err,
21 Errstr => \$errstr,
22 });
23 }
24  
25 0 ▶sub CLONE {
Subroutine CLONE: not called CC=1 SCAR=6.9
26 0 undef $drh;
27 }
28  
29 package DBD::BlackHole::dr;
30 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 7 our $imp_data_size = 0;
34  
35 6 ▶sub connect {
Subroutine connect: called CC=2 SCAR=7.1
36 6 ▶ my $dbh = shift->SUPER::connect(@_)
Branch: 1 branch
BranchTrueFalseTotal
my $dbh = (shift())->SUPER::connect(@_) or return 6 0 6
37 or return;
38 6 $dbh->STORE(Active => 1);
39 6 return $dbh;
40 }
41  
42 0 ▶sub data_sources { qw/dbi:BlackHole:/ }
Subroutine data_sources: not called CC=1 SCAR=6.9
43  
44 package DBD::BlackHole::db;
45 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 7 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 7 ▶use constant DEFAULT_IDENTIFIER => '`';
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 7 our $imp_data_size = 0;
53  
54 3 ▶sub get_info {
Subroutine get_info: called CC=3 SCAR=11.1
55 3 my ($dbh, $type) = @_;
56 # identifier quote
57 3 ▶ return $dbh->FETCH('blackhole_identifier') || DEFAULT_IDENTIFIER if $type == 29;
Branch: 1 branch
BranchTrueFalseTotal
if $type == 29 1 2 3
Condition50%1/2
$dbh->FETCH('blackhole_identifier') || '`'
l!l
01
MC/DC0%0/1
$dbh->FETCH('blackhole_identifier') || '`'
$dbh->FETCH('blackhole_identifier')
Truth table50%1/2
A
A= $dbh->FETCH('blackhole_identifier')
Aresult
11
00
58 2 return;
59 }
60  
61 16 ▶sub prepare {
Subroutine prepare: called CC=1 SCAR=0.0
62 16 my ($dbh, $statement) = @_;
63  
64 16 my $sth = DBI::_new_sth($dbh, {
65 Statement => $statement,
66 NAME => ['dummy'],
67 NUM_OF_FIELDS => -1,
68 });
69  
70 16 return $sth;
71 }
72  
73 2 ▶sub ping { shift->FETCH('Active') }
Subroutine ping: called CC=1 SCAR=0.0
74  
75 7 ▶sub disconnect { shift->STORE(Active => 0) }
Subroutine disconnect: called CC=1 SCAR=0.0
76  
77 2 ▶sub begin_work { 1 }
Subroutine begin_work: called CC=1 SCAR=0.0
78 1 ▶sub commit { 1 }
Subroutine commit: called CC=1 SCAR=0.0
79 1 ▶sub rollback { 1 }
Subroutine rollback: called CC=1 SCAR=0.0
80 0 ▶sub tables {}
Subroutine tables: not called CC=1 SCAR=0.0
81  
82 5 ▶sub FETCH {
Subroutine FETCH: called CC=2 SCAR=7.0
83 5 my $dbh = shift;
84 5 my $key = shift;
85 5 ▶ return 1 if $key eq 'AutoCommit';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "AutoCommit" 0 5 5
86 5 return $dbh->SUPER::FETCH($key);
87 }
88  
89 38 ▶sub STORE {
Subroutine STORE: called CC=4 SCAR=14.3
90 38 my $dbh = shift;
91 38 my ($key, $value) = @_;
92  
93 38 ▶ if ($key eq 'AutoCommit') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "AutoCommit") 6 32 38
94 6 ▶ croak 'Cannot disable AutoCommit' if !$value && $dbh->FETCH('AutoCommit');
Branch: 1 branch
BranchTrueFalseTotal
if not $value and $dbh->FETCH("AutoCommit") 0 6 6
Condition33%1/3
not $value and $dbh->FETCH("AutoCommit")
!ll&&!rl&&r
600
MC/DC0%0/2
not $value and $dbh->FETCH("AutoCommit")
not $value $dbh->FETCH("AutoCommit")
Truth table33%1/3
not(A) and B
A= not $valueB= $dbh->FETCH("AutoCommit")
ABresult
0X0
100
111
95 6 return $value;
96 }
97 32 return $dbh->SUPER::STORE($key, $value);
98 }
99  
100 6 ▶sub DESTROY { shift->disconnect }
Subroutine DESTROY: called CC=1 SCAR=0.0
101  
102 package DBD::BlackHole::st;
103 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
104 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
105  
106 7 our $imp_data_size = 0;
107  
108 4 ▶sub bind_col { 1 }
Subroutine bind_col: called CC=1 SCAR=0.0
109 3 ▶sub bind_columns { 1 }
Subroutine bind_columns: called CC=1 SCAR=0.0
110 2 ▶sub bind_param { 1 }
Subroutine bind_param: called CC=1 SCAR=0.0
111  
112 14 ▶sub execute {
Subroutine execute: called CC=1 SCAR=0.0
113 14 my $sth = shift;
114 14 $sth->STORE(NUM_OF_FIELDS => 1);
115 14 $sth->STORE(NUM_OF_PARAMS => 0);
116 14 1;
117 }
118  
119 5 ▶sub rows { 0 }
Subroutine rows: called CC=1 SCAR=0.0
120  
121 15 ▶sub fetch {}
Subroutine fetch: called CC=1 SCAR=0.0
122  
123 1 ▶sub fetchall_hashref { +{} }
Subroutine fetchall_hashref: called CC=1 SCAR=0.0
124  
125 7 1;
126 __END__
↑ Summary