| 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
Condition0%0/3
$list and @$list
MC/DC0%0/2
$list and @$list
$list
@$list
Truth table0%0/3
A and B
A= $listB= @$list
| |||||||||||||||||||||||||||||
| 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) || ''
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)
| |||||||||||||||||||||||||||||
| 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
MC/DC0%0/1
$self->{'tables_cache'}{$table} || undef
$self->{'tables_cache'}{$table}
Truth table0%0/2
A
A= $self->{'tables_cache'}{$table}
| |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | unless ($result) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | $self->list($table); | |||||||||||||||||||||||||||
| 50 | 0 | ▶ | $result = $self->{tables_cache}->{$table} || undef; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'tables_cache'}{$table} || undef
MC/DC0%0/1
$self->{'tables_cache'}{$table} || undef
$self->{'tables_cache'}{$table}
Truth table0%0/2
A
A= $self->{'tables_cache'}{$table}
| |||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | ▶ | return unless $result && $result->{$name}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$result and $result->{$name}
MC/DC0%0/2
$result and $result->{$name}
$result
$result->{$name}
Truth table0%0/3
A and B
A= $resultB= $result->{$name}
| |||||||||||||||||||||||||||||
| 54 | 0 | return $self->dump($result->{$name}); | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 2 | 1; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | __END__ | ||||||||||||||||||||||||||||