DB2/Diff/Reorg.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 100% 41 / 41 CC 4 SCAR 7.9
CC
4
Cov
100%
diff
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« DB2/Introspect.pm ↑ Summary DB2/SQLMaker.pm »
1 package DBIO::DB2::Diff::Reorg;
2 # ABSTRACT: Diff operation for the REORG a DB2 table needs after some column changes
3  
4 45 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 45 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 45 our $VERSION = '0.900007';
8  
9 45 ▶use base 'DBIO::Diff::Op';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 45 ▶use DBIO::DB2::DDL qw(_db2_quote_ident _db2_quote_table);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 45 __PACKAGE__->mk_diff_accessors(qw/table_name/);
15  
16  
17 138 ▶sub diff {
Subroutine diff: called CC=4 SCAR=13.9
Pod documented
18 138 my ($class, @column_ops) = @_;
19 138 my (%seen, @ops);
20  
21 138 for my $op (@column_ops) {
22 108 ▶ next unless $op->reorg_recommended;
Branch: 1 branch
BranchTrueFalseTotal
unless $op->reorg_recommended 55 53 108
23 53 ▶ next if $seen{ $op->table_name }++;
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$op->table_name}++ 3 50 53
24 50 push @ops, $class->new(action => 'reorg', table_name => $op->table_name);
25 }
26  
27 138 return @ops;
28 }
29  
30  
31 35 ▶sub as_sql {
Subroutine as_sql: called CC=1 SCAR=0.0
Pod documented
32 35 my ($self) = @_;
33 35 (my $command = 'REORG TABLE ' . _db2_quote_table($self->table_name)) =~ s/'/''/g;
34 35 return "CALL SYSPROC.ADMIN_CMD('$command');";
35 }
36  
37  
38 6 ▶sub summary {
Subroutine summary: called CC=1 SCAR=0.0
Pod documented
39 6 my ($self) = @_;
40 6 return sprintf ' %sreorg: %s', $self->summary_prefix, $self->table_name;
41 }
42  
43 45 1;
44  
45 __END__
« DB2/Introspect.pm ↑ Summary DB2/SQLMaker.pm »