blib/lib/DBD/BlackHole.pm

filter: Statementstmt 96.2% 77 / 80 Branchbran 70.0% 7 / 10 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 87.8% 29 / 33 Podpod 0.0% 0 / 1 totaltotal 84.6% 116 / 137 CC 9 SCAR 5.3
CC
9
Cov
89%
STORE
4.2
get_info
3.0
driver
2.3
CRAP 1.7
↑ Summary Build »
1 package DBD::BlackHole;
2 6 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 our $VERSION = "0.02";
7  
8 6 ▶use DBI;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 6 our $drh = undef;
11 6 our $err = '';
12 6 our $errstr = '';
13  
14 sub driver {
15 5 ▶ my ($class, $attr) = @_;
Subroutine driver: called CC=2 SCAR=8.1
Pod undocumented
16 5 ▶ 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
050
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 sub CLONE {
26 0 ▶ undef $drh;
Subroutine CLONE: not called CC=1 SCAR=6.9
27 }
28  
29 package DBD::BlackHole::dr;
30 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 6 our $imp_data_size = 0;
34  
35 sub connect {
36 5 ▶ my $dbh = shift->SUPER::connect(@_)
Subroutine connect: called CC=2 SCAR=7.1
Branch: 1 branch
BranchTrueFalseTotal
my $dbh = (shift())->SUPER::connect(@_) or return 0 5 5
37 or return;
38 5 $dbh->STORE(Active => 1);
39 5 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 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 6 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
49  
50 6 ▶use constant DEFAULT_IDENTIFIER => '`';
Subroutine BEGIN: called CC=1 SCAR=0.0
51  
52 6 our $imp_data_size = 0;
53  
54 sub get_info {
55 3 ▶ my ($dbh, $type) = @_;
Subroutine get_info: called CC=3 SCAR=11.1
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 sub prepare {
62 11 ▶ my ($dbh, $statement)= @_;
Subroutine prepare: called CC=1 SCAR=0.0
63  
64 11 my $sth = DBI::_new_sth($dbh, {
65 Statement => $statement,
66 });
67 11 return $sth;
68 }
69  
70 2 ▶sub ping { shift->FETCH('Active') }
Subroutine ping: called CC=1 SCAR=0.0
71  
72 6 ▶sub disconnect { shift->STORE(Active => 0) }
Subroutine disconnect: called CC=1 SCAR=0.0
73  
74 2 ▶sub begin_work { 1 }
Subroutine begin_work: called CC=1 SCAR=0.0
75 1 ▶sub commit { 1 }
Subroutine commit: called CC=1 SCAR=0.0
76 1 ▶sub rollback { 1 }
Subroutine rollback: called CC=1 SCAR=0.0
77 ▶sub tables {}
Subroutine tables: not called CC=1 SCAR=0.0
78  
79 sub FETCH {
80 5 ▶ my $dbh = shift;
Subroutine FETCH: called CC=2 SCAR=7.0
81 5 my $key = shift;
82 5 ▶ return 1 if $key eq 'AutoCommit';
Branch: 1 branch
BranchTrueFalseTotal
if $key eq "AutoCommit" 0 5 5
83 5 return $dbh->SUPER::FETCH($key);
84 }
85  
86 sub STORE {
87 32 ▶ my $dbh = shift;
Subroutine STORE: called CC=4 SCAR=14.3
88 32 my ($key, $value) = @_;
89  
90 32 ▶ if ($key eq 'AutoCommit') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "AutoCommit") 5 27 32
91 5 ▶ croak 'Cannot disable AutoCommit' if !$value && $dbh->FETCH('AutoCommit');
Branch: 1 branch
BranchTrueFalseTotal
if not $value and $dbh->FETCH("AutoCommit") 0 5 5
Condition33%1/3
not $value and $dbh->FETCH("AutoCommit")
!ll&&!rl&&r
500
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
92 5 return $value;
93 }
94 27 return $dbh->SUPER::STORE($key, $value);
95 }
96  
97 5 ▶sub DESTROY { shift->disconnect }
Subroutine DESTROY: called CC=1 SCAR=0.0
98  
99 package DBD::BlackHole::st;
100 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
101 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
102  
103 6 our $imp_data_size = 0;
104  
105 1 ▶sub bind_col { 1 }
Subroutine bind_col: called CC=1 SCAR=0.0
106 0 ▶sub bind_param { 1 }
Subroutine bind_param: not called CC=1 SCAR=6.9
107  
108 sub execute {
109 11 ▶ my $sth = shift;
Subroutine execute: called CC=1 SCAR=0.0
110 11 $sth->STORE(NUM_OF_FIELDS => 0);
111 11 $sth->STORE(NUM_OF_PARAMS => 0);
112 11 1;
113 }
114  
115 5 ▶sub rows { '0E0' }
Subroutine rows: called CC=1 SCAR=0.0
116  
117 ▶sub fetch {}
Subroutine fetch: called CC=1 SCAR=0.0
118  
119 1 ▶sub fetchall_hashref { +{} }
Subroutine fetchall_hashref: called CC=1 SCAR=0.0
120  
121 6 1;
122 __END__
↑ Summary Build »