File Coverage

blib/lib/MySQL/Partition/Handle.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 10 0.0
condition 0 3 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 39 33.3


line stmt bran cond sub pod time code
1             package MySQL::Partition::Handle;
2 2     2   11 use strict;
  2         4  
  2         71  
3 2     2   11 use warnings;
  2         3  
  2         77  
4              
5             use Class::Accessor::Lite (
6 2         16 new => 1,
7             ro => [qw/mysql_partition statement/],
8             rw => [qw/_executed/],
9 2     2   2041 );
  2         2285  
10              
11             sub execute {
12 0     0 1   my $self = shift;
13 0 0         die 'statement is already executed' if $self->_executed;
14              
15 0           my $mysql_partition = $self->mysql_partition;
16 0           my $sql = $self->statement;
17 0 0 0       if ($mysql_partition->verbose || $mysql_partition->dry_run) {
18 0 0         printf "Following SQL statement to be executed%s.\n", ($mysql_partition->dry_run ? ' (dry-run)' : '');
19 0           print "$sql\n";
20             }
21 0 0         if (!$mysql_partition->dry_run) {
22 0           $mysql_partition->dbh->do($sql);
23 0 0         print "done.\n" if $mysql_partition->verbose;
24 0           delete $mysql_partition->{partitions};
25             }
26 0           $self->_executed(1);
27             }
28              
29             1;
30             __END__