blib/lib/DBIO/SQLite/Adapter.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 6 / 6 Conditioncond 85.7% 6 / 7 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 93.8% 46 / 49 CC 7 SCAR 15.0
CC
7
Cov
97%
to_native
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.5
« blib/lib/DBIO/SQLite/Extension.pm ↑ Summary blib/lib/DBIO/SQLite/Extension/VirtualTable.pm »
1 package DBIO::SQLite::Adapter;
2 # ABSTRACT: SQLite base->native type resolver
3  
4 191 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 191 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 191 our $VERSION = '0.900007';
8  
9 191 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 191 ▶use base 'DBIO::Adapter::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 191 my %NATIVE = (
13 integer => 'INTEGER',
14 text => 'TEXT',
15 boolean => 'BOOLEAN',
16 double => 'REAL',
17 blob => 'BLOB',
18 timestamp => 'TEXT',
19 );
20  
21 42511 ▶sub to_native {
Subroutine to_native: called CC=7 SCAR=19.5
Pod documented
22 42511 my ($self, $col) = @_;
23 42511 my $b = $col->{base_type};
24 42511 ▶ return 'CHAR(' . ($col->{size} // 255) . ')' if $b eq 'char';
Branch: 1 branch
BranchTrueFalseTotal
if $b eq "char" 716 41795 42511
Condition100%2/2
$col->{"size"} // 255
l!l
7151
MC/DC100%1/1
$col->{"size"} // 255
$col->{"size"}
Truth table100%2/2
A
A= $col->{"size"}
Aresult
11
00
25 41795 ▶ if ($b eq 'numeric') {
Branch: 1 branch
BranchTrueFalseTotal
if ($b eq "numeric") 9 41786 41795
26 9 my ($p, $s) = @{$col}{qw/precision scale/};
27 9 ▶ return (defined $p && defined $s) ? "NUMERIC($p,$s)" : 'NUMERIC';
Branch: 1 branch
BranchTrueFalseTotal
defined $p && defined $s ? : 7 2 9
Condition66%2/3
defined $p and defined $s
!ll&&!rl&&r
207
MC/DC50%1/2
defined $p and defined $s
defined $p defined $s
Truth table66%2/3
A and B
A= defined $pB= defined $s
ABresult
0X0
100
111
28 }
29 41786 ▶ return $NATIVE{$b} // croak "no SQLite native type for base '$b'";
Condition100%2/2
$NATIVE{$b} // croak("no SQLite native type for base '${b}'")
l!l
417851
MC/DC0%0/1
$NATIVE{$b} // croak("no SQLite native type for base '${b}'")
$NATIVE{$b}
Truth table50%1/2
A
A= $NATIVE{$b}
Aresult
11
00
30 }
31  
32 1 ▶sub capabilities { return { supports_alter_column_type => 0 } }
Subroutine capabilities: called CC=1 SCAR=0.0
Pod documented
33  
34 191 1;
35  
36 __END__
« blib/lib/DBIO/SQLite/Extension.pm ↑ Summary blib/lib/DBIO/SQLite/Extension/VirtualTable.pm »