FusqlFS/Backend/SQLite/Table/Struct.pm

filter: Statementstmt 48.5% 17 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 71.4% 5 / 7 Podpod 100% 3 / 3 totaltotal 35.7% 25 / 70 CC 9 SCAR 31.1
CC
9
Cov
32%
get
42.0
list
20.0
BEGIN
1.0
CRAP 22.5
« FusqlFS.pm ↑ Summary FusqlFS/Backend/PgSQL/Sequences.pm »
1 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package FusqlFS::Backend::SQLite::Table::Struct;
5 2 ▶use FusqlFS::Version;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 our $VERSION = $FusqlFS::Version::VERSION;
7 2 ▶use parent 'FusqlFS::Artifact';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub init
10 4 ▶{
Subroutine init: called CC=1 SCAR=0.0
Pod documented
11 4 my $self = shift;
12  
13 4 $self->{list_expr} = "PRAGMA table_info(%s)";
14 4 $self->{get_create_expr} = $self->expr('SELECT sql FROM sqlite_master WHERE type = "table" AND name = ?');
15  
16 4 $self->{tables_cache} = {};
17 }
18  
19 sub list
20 0 ▶{
Subroutine list: not called CC=4 SCAR=30.0
Pod documented
21 0 my $self = shift;
22 0 my ($table) = @_;
23 0 my $list = $self->all_row($self->{list_expr}, [$table]);
24 0 ▶ return unless $list && @$list;
Branch: 1 branch
BranchTrueFalseTotal
unless $list and @$list 0 0 0
Condition0%0/3
$list and @$list
!ll&&!rl&&r
000
MC/DC0%0/2
$list and @$list
$list @$list
Truth table0%0/3
A and B
A= $listB= @$list
ABresult
0X0
100
111
25  
26 0 my %table_info = map { $_->{name}, {
27 nullable => !$_->{notnull},
28 type => $_->{type},
29 default => $_->{dflt_value},
30 order => $_->{cid},
31 pk => !!$_->{pk},
32 0 } } @$list;
33 0 my @columns = keys %table_info;
34  
35 0 ▶ $table_info{'create.sql'} = $self->one_col($self->{get_create_expr}, $table) || '';
Condition0%0/2
$self->one_col($self->{'get_create_expr'}, $table) || ''
l!l
00
MC/DC0%0/1
$self->one_col($self->{'get_create_expr'}, $table) || ''
$self->one_col($self->{'get_create_expr'}, $table)
Truth table0%0/2
A
A= $self->one_col($self->{'get_create_expr'}, $table)
Aresult
11
00
36  
37 0 $self->{tables_cache}->{$table} = \%table_info;
38  
39 0 return \@columns;
40 }
41  
42 sub get
43 0 ▶{
Subroutine get: not called CC=6 SCAR=37.4
Pod documented
44 0 my $self = shift;
45 0 my ($table, $name) = @_;
46 0 ▶ my $result = $self->{tables_cache}->{$table} || undef;
Condition0%0/2
$self->{'tables_cache'}{$table} || undef
l!l
00
MC/DC0%0/1
$self->{'tables_cache'}{$table} || undef
$self->{'tables_cache'}{$table}
Truth table0%0/2
A
A= $self->{'tables_cache'}{$table}
Aresult
11
00
47  
48 0 ▶ unless ($result) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($result) 0 0 0
49 0 $self->list($table);
50 0 ▶ $result = $self->{tables_cache}->{$table} || undef;
Condition0%0/2
$self->{'tables_cache'}{$table} || undef
l!l
00
MC/DC0%0/1
$self->{'tables_cache'}{$table} || undef
$self->{'tables_cache'}{$table}
Truth table0%0/2
A
A= $self->{'tables_cache'}{$table}
Aresult
11
00
51 }
52  
53 0 ▶ return unless $result && $result->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless $result and $result->{$name} 0 0 0
Condition0%0/3
$result and $result->{$name}
!ll&&!rl&&r
000
MC/DC0%0/2
$result and $result->{$name}
$result $result->{$name}
Truth table0%0/3
A and B
A= $resultB= $result->{$name}
ABresult
0X0
100
111
54 0 return $self->dump($result->{$name});
55 }
56  
57 2 1;
58  
59 __END__
« FusqlFS.pm ↑ Summary FusqlFS/Backend/PgSQL/Sequences.pm »