line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MySQL::Partition::Handle; |
2
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
70
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
116
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
6
|
3
|
|
|
|
|
25
|
new => 1, |
7
|
|
|
|
|
|
|
ro => [qw/mysql_partition statement/], |
8
|
|
|
|
|
|
|
rw => [qw/_executed/], |
9
|
3
|
|
|
3
|
|
1551
|
); |
|
3
|
|
|
|
|
2320
|
|
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__ |