| 1 | package DBIO::Firebird::Diff::Table; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Diff operations for Firebird tables | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 13 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 13 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 13 | our $VERSION = '0.900007'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 13 | ▶ | use base 'DBIO::Diff::Op'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 13 | ▶ | use DBIO::Exception (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 13 | ▶ | use DBIO::Firebird::Diff::Constraint (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 13 | ▶ | use DBIO::Firebird::DDL qw(_firebird_quote_ident _firebird_column_clauses); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 13 | ▶ | use DBIO::Firebird::Type qw(render_size); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | # new() and the action accessor come from DBIO::Diff::Op. | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 13 | __PACKAGE__->mk_diff_accessors(qw/table_name table_info columns foreign_keys old_info/); | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 152 | ▶ | sub diff { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
diff: called CC=30 SCAR=34.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 152 | my ($class, $source, $target, $target_columns, $target_fks, $source_columns, $source_fks) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 152 | ▶ | $source_fks //= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$source_fks //= {}
MC/DC100%1/1
$source_fks //= {}
$source_fks
Truth table100%2/2
A
A= $source_fks
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 152 | ▶ | $target_columns //= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$target_columns //= {}
MC/DC100%1/1
$target_columns //= {}
$target_columns
Truth table100%2/2
A
A= $target_columns
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 152 | ▶ | $target_fks //= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$target_fks //= {}
MC/DC100%1/1
$target_fks //= {}
$target_fks
Truth table100%2/2
A
A= $target_fks
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 152 | my @ops; | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 152 | for my $name (sort keys %$target) { | |||||||||||||||||||||||||||||||||||||||||
| 30 | 181 | ▶ | next if exists $source->{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 32 | ▶ | next if ($target->{$name}{kind} // 'table') eq 'view'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$target->{$name}{"kind"} // "table"
MC/DC100%1/1
$target->{$name}{"kind"} // "table"
$target->{$name}{"kind"}
Truth table100%2/2
A
A= $target->{$name}{"kind"}
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | push @ops, $class->new( | ||||||||||||||||||||||||||||||||||||||||||
| 33 | action => 'create', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | table_name => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 35 | table_info => $target->{$name}, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | columns => $target_columns->{$name} // [], | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 25 | ▶ | foreign_keys => $target_fks->{$name} // [], | ||||||||||||||||||||||||||||||||||||||||
|
Condition75%3/4
$target_columns->{$name} // []
$target_fks->{$name} // []
MC/DC0%0/1
$target_columns->{$name} // []
$target_columns->{$name}
MC/DC100%1/1
$target_fks->{$name} // []
$target_fks->{$name}
Truth table50%1/2
A
A= $target_columns->{$name}
Truth table100%2/2
A
A= $target_fks->{$name}
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | # DROP TABLE of a table another table's foreign key points at is refused, so | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # the tables go child before parent (karr k34). Only keys between tables | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # dropped here count. Where tables point at each other no order exists: the | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # keys among the rest are dropped first (ALTER TABLE ... DROP CONSTRAINT), | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # then the tables. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 152 | ▶ | my %gone = map { $_ => 1 } grep { !exists $target->{$_} && ($source->{$_}{kind} // 'table') ne 'view' } keys %$source; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
!exists $target->{$_} && ($source->{$_}{'kind'} // 'table') ne 'view'
$source->{$_}{"kind"} // "table"
MC/DC100%2/2
!exists $target->{$_} && ($source->{$_}{'kind'} // 'table') ne 'view'
!exists $target->{$_}
$source->{$_}{"kind"}
Truth table100%3/3
not(A) && B
A= !exists $target->{$_}B= $source->{$_}{"kind"}
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 152 | my %refs; # parent => { child => [ fk, ... ] } | |||||||||||||||||||||||||||||||||||||||||
| 48 | 152 | for my $child (keys %gone) { | |||||||||||||||||||||||||||||||||||||||||
| 49 | 24 | ▶ | for my $fk (@{ $source_fks->{$child} // [] }) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$source_fks->{$child} // []
MC/DC100%1/1
$source_fks->{$child} // []
$source_fks->{$child}
Truth table100%2/2
A
A= $source_fks->{$child}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 6 | my $parent = $fk->{to_table}; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 6 | ▶ | next unless defined $parent && $gone{$parent} && $parent ne $child; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $parent and $gone{$parent} and $parent ne $child
defined $parent and $gone{$parent}
MC/DC33%1/3
defined $parent and $gone{$parent} and $parent ne $child
defined $parent
$gone{$parent}
$parent ne $child
Truth table50%2/4
A and B and C
A= defined $parentB= $gone{$parent}C= $parent ne $child
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 5 | push @{ $refs{$parent}{$child} }, $fk; | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | 152 | my %left = %gone; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 152 | ▶ | while (%left) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | # droppable now: no table still left points at it | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 22 | ▶ | my @now = sort grep { my $p = $_; !grep { $left{$_} } keys %{ $refs{$p} // {} } } keys %left; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$refs{$p} // {}
MC/DC100%1/1
$refs{$p} // {}
$refs{$p}
Truth table100%2/2
A
A= $refs{$p}
| |||||||||||||||||||||||||||||||||||||||||||
| 59 | 22 | ▶ | unless (@now) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | # a cycle: drop every key among the tables left, then they are all free | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | for my $parent (sort keys %left) { | |||||||||||||||||||||||||||||||||||||||||
| 62 | 2 | ▶ | for my $child (sort grep { $left{$_} } keys %{ $refs{$parent} // {} }) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$refs{$parent} // {}
MC/DC0%0/1
$refs{$parent} // {}
$refs{$parent}
Truth table50%1/2
A
A= $refs{$parent}
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | push @ops, DBIO::Firebird::Diff::Constraint->new( | ||||||||||||||||||||||||||||||||||||||||||
| 64 | action => 'drop', kind => 'fk', table_name => $child, | ||||||||||||||||||||||||||||||||||||||||||
| 65 | constraint_name => $_->{constraint_name}, info => $_, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | ) for @{ $refs{$parent}{$child} }; | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 1 | %refs = map { $_ => {} } keys %left; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | next; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 21 | for my $name (@now) { | |||||||||||||||||||||||||||||||||||||||||
| 73 | push @ops, $class->new( | ||||||||||||||||||||||||||||||||||||||||||
| 74 | action => 'drop', | ||||||||||||||||||||||||||||||||||||||||||
| 75 | table_name => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 24 | table_info => $source->{$name}, | |||||||||||||||||||||||||||||||||||||||||
| 77 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 24 | delete $left{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | # A name that is a table on one side and a view on the other: the data of | ||||||||||||||||||||||||||||||||||||||||||
| 83 | # the table or the definition of the view would be lost, so no statement is | ||||||||||||||||||||||||||||||||||||||||||
| 84 | # written (refusal). A view on both sides is Diff::View's. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 152 | for my $name (sort keys %$target) { | |||||||||||||||||||||||||||||||||||||||||
| 86 | 181 | ▶ | next unless exists $source->{$name}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | 149 | ▶ | my ($was, $is) = map { ($_->{$name}{kind} // 'table') } $source, $target; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$_->{$name}{"kind"} // "table"
MC/DC100%1/1
$_->{$name}{"kind"} // "table"
$_->{$name}{"kind"}
Truth table100%2/2
A
A= $_->{$name}{"kind"}
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 149 | ▶ | next if $was eq $is; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | push @ops, $class->new( | ||||||||||||||||||||||||||||||||||||||||||
| 90 | action => 'change', | ||||||||||||||||||||||||||||||||||||||||||
| 91 | table_name => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | table_info => $target->{$name}, | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 2 | old_info => $source->{$name}, | |||||||||||||||||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 152 | return @ops; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 61 | ▶ | sub refusal { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refusal: called CC=8 SCAR=21.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 61 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 61 | ▶ | my ($is, $was) = map { $_ // '' } (($self->table_info // {})->{kind}, ($self->{old_info} // {})->{kind}); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$_ // ""
$self->table_info // {}
$self->{"old_info"} // {}
MC/DC100%1/1
$_ // ""
$_
MC/DC100%1/1
$self->table_info // {}
$self->table_info
MC/DC100%1/1
$self->{"old_info"} // {}
$self->{"old_info"}
Truth table100%2/2
A
A= $_
Truth table100%2/2
A
A= $self->table_info
Truth table100%2/2
A
A= $self->{"old_info"}
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 61 | ▶ | return unless $self->action eq 'change' && $is ne $was; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->action eq "change" and $is ne $was
MC/DC50%1/2
$self->action eq "change" and $is ne $was
$self->action eq "change"
$is ne $was
Truth table66%2/3
A and B
A= $self->action eq "change"B= $is ne $was
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 4 | ▶ | return sprintf 'the database has a %s and the schema a %s under this name', $was || 'table', $is || 'table'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$was || 'table'
$is || 'table'
MC/DC0%0/1
$was || 'table'
$was
MC/DC0%0/1
$is || 'table'
$is
Truth table50%1/2
A
A= $was
Truth table50%1/2
A
A= $is
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 2 | ▶ | sub refusal_error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refusal_error: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 2 | my ($class, @ops) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 111 | return join "\n", | ||||||||||||||||||||||||||||||||||||||||||
| 112 | sprintf('refusing to diff %d name%s that change%s between table and view', | ||||||||||||||||||||||||||||||||||||||||||
| 113 | scalar @ops, (@ops == 1 ? '' : 's'), (@ops == 1 ? 's' : '')), | ||||||||||||||||||||||||||||||||||||||||||
| 114 | '', | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 2 | ▶ | (map { sprintf ' %s: %s', _firebird_quote_ident($_->table_name), $_->refusal } @ops), | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | '', | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 'Turning a table into a view (or a view into a table) would drop the one to', | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 'create the other. Drop it yourself, then run the diff again. No statement was', | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 'generated. The difference is still reported by diff, has_changes and summary.', | ||||||||||||||||||||||||||||||||||||||||||
| 120 | '', ''; | ||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 35 | ▶ | sub as_sql { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_sql: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 35 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 35 | ▶ | DBIO::Exception->throw(ref($self)->refusal_error($self)) if $self->refusal; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 35 | ▶ | if ($self->action eq 'drop') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 16 | return sprintf 'DROP TABLE %s;', _firebird_quote_ident($self->table_name); | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 19 | my @col_defs; | |||||||||||||||||||||||||||||||||||||||||
| 134 | my @pk_cols; | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 19 | for my $col (@{ $self->columns }) { | |||||||||||||||||||||||||||||||||||||||||
| 137 | 34 | ▶ | push @pk_cols, $col->{column_name} if $col->{is_pk}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 34 | ▶ | my $type = $col->{data_type} || 'VARCHAR'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$col->{'data_type'} || 'VARCHAR'
MC/DC0%0/1
$col->{'data_type'} || 'VARCHAR'
$col->{'data_type'}
Truth table50%1/2
A
A= $col->{'data_type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | my $def = sprintf ' %s %s%s', _firebird_quote_ident($col->{column_name}), $type, | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 34 | render_size($col->{size}); | |||||||||||||||||||||||||||||||||||||||||
| 142 | # IDENTITY, DEFAULT, NOT NULL: the one order of the column clause, shared | ||||||||||||||||||||||||||||||||||||||||||
| 143 | # with install_ddl (karr k46). | ||||||||||||||||||||||||||||||||||||||||||
| 144 | $def .= _firebird_column_clauses( | ||||||||||||||||||||||||||||||||||||||||||
| 145 | identity => $col->{is_auto_increment}, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | default => $col->{default_value}, | ||||||||||||||||||||||||||||||||||||||||||
| 147 | not_null => $col->{not_null}, | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 34 | ); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 34 | push @col_defs, $def; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | 19 | ▶ | if (@pk_cols) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 153 | push @col_defs, sprintf ' PRIMARY KEY (%s)', | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 8 | join(', ', map { _firebird_quote_ident($_) } @pk_cols); | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | # No foreign key here: they are ALTER TABLE ... ADD CONSTRAINT after every | ||||||||||||||||||||||||||||||||||||||||||
| 158 | # table of the diff (DBIO::Firebird::Diff::Constraint, karr k34), so the | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # order of the tables and a cycle between them do not matter. | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 19 | return sprintf "CREATE TABLE %s (\n%s\n);", | |||||||||||||||||||||||||||||||||||||||||
| 162 | _firebird_quote_ident($self->table_name), join(",\n", @col_defs); | ||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 10 | ▶ | sub summary { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 10 | ▶ | my $kind = (($self->table_info // {})->{kind} // '') eq 'view' ? 'view' : 'table'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
+($self->table_info // {})->{"kind"} // ""
$self->table_info // {}
MC/DC0%0/1
+($self->table_info // {})->{"kind"} // ""
$self->table_info
Truth table50%1/2
A
A= $self->table_info
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 10 | return sprintf '%s %s: %s', $self->summary_prefix, $kind, $self->table_name; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 13 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | __END__ | ||||||||||||||||||||||||||||||||||||||||||