| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Geoffrey::Action::Constraint::PrimaryKey; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
21691
|
use utf8; |
|
|
6
|
|
|
|
|
27
|
|
|
|
6
|
|
|
|
|
34
|
|
|
4
|
6
|
|
|
6
|
|
234
|
use 5.016; |
|
|
6
|
|
|
|
|
24
|
|
|
5
|
6
|
|
|
6
|
|
39
|
use strict; |
|
|
6
|
|
|
|
|
14
|
|
|
|
6
|
|
|
|
|
120
|
|
|
6
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
197
|
|
|
7
|
6
|
|
|
6
|
|
3436
|
use Time::HiRes qw/ time /; |
|
|
6
|
|
|
|
|
8435
|
|
|
|
6
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Geoffrey::Action::Constraint::PrimaryKey::VERSION = '0.000205'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
6
|
|
|
6
|
|
1631
|
use parent 'Geoffrey::Role::Action'; |
|
|
6
|
|
|
|
|
306
|
|
|
|
6
|
|
|
|
|
32
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub add { |
|
14
|
2
|
|
|
2
|
1
|
1746
|
my ( $self, $s_table_name, $hr_params ) = @_; |
|
15
|
2
|
50
|
|
|
|
12
|
if ( !$self->converter->primary_key ) { |
|
16
|
0
|
|
|
|
|
0
|
require Geoffrey::Exception::NotSupportedException; |
|
17
|
0
|
|
|
|
|
0
|
Geoffrey::Exception::NotSupportedException::throw_primarykey( 'add', $self->converter ); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
2
|
|
|
|
|
10
|
my $gentime = time; |
|
20
|
2
|
|
|
|
|
27
|
$gentime =~ s/\.//g; |
|
21
|
2
|
|
33
|
|
|
11
|
$hr_params->{name} ||= q~pk_~ . $s_table_name . q~_~ . $gentime; |
|
22
|
2
|
|
|
|
|
11
|
require Geoffrey::Utils; |
|
23
|
|
|
|
|
|
|
return Geoffrey::Utils::replace_spare( $self->converter->primary_key->add, |
|
24
|
2
|
|
|
|
|
7
|
[ $hr_params->{name}, ( join q/,/, @{ $hr_params->{columns} } ) ] ); |
|
|
2
|
|
|
|
|
12
|
|
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub alter { |
|
28
|
1
|
|
|
1
|
1
|
1368
|
my ( $self, $s_table_name, $hr_params ) = @_; |
|
29
|
1
|
50
|
|
|
|
9
|
if ( !$self->converter->primary_key ) { |
|
30
|
0
|
|
|
|
|
0
|
require Geoffrey::Exception::NotSupportedException; |
|
31
|
0
|
|
|
|
|
0
|
Geoffrey::Exception::NotSupportedException::throw_primarykey( 'alter', $self->converter ); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
return [ |
|
34
|
1
|
|
|
|
|
6
|
$self->drop( $s_table_name, $hr_params ), |
|
35
|
|
|
|
|
|
|
$self->add( $s_table_name, $hr_params ), |
|
36
|
|
|
|
|
|
|
]; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub drop { |
|
40
|
2
|
|
|
2
|
1
|
2275
|
my ( $self, $table, $name, $schema ) = @_; |
|
41
|
2
|
50
|
|
|
|
7
|
if ( !$self->converter->primary_key ) { |
|
42
|
0
|
|
|
|
|
0
|
require Geoffrey::Exception::NotSupportedException; |
|
43
|
0
|
|
|
|
|
0
|
Geoffrey::Exception::NotSupportedException::throw_primarykey( 'drop', $self->converter ); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
2
|
|
|
|
|
495
|
require Geoffrey::Utils; |
|
46
|
2
|
|
|
|
|
10
|
return Geoffrey::Utils::replace_spare( $self->converter->primary_key->drop($schema), |
|
47
|
|
|
|
|
|
|
[ $table, $name ] ); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub list_from_schema { |
|
51
|
3
|
|
|
3
|
1
|
1719
|
my ( $self, $schema ) = @_; |
|
52
|
3
|
50
|
|
|
|
16
|
if ( !$self->converter->primary_key ) { |
|
53
|
0
|
|
|
|
|
0
|
require Geoffrey::Exception::NotSupportedException; |
|
54
|
0
|
|
|
|
|
0
|
Geoffrey::Exception::NotSupportedException::throw_primarykey( 'list', $self->converter ); |
|
55
|
|
|
|
|
|
|
} |
|
56
|
3
|
|
|
|
|
12
|
return $self->converter->primary_key_information( |
|
57
|
|
|
|
|
|
|
$self->do_arrayref( $self->converter->primary_key->list($schema), [] ), |
|
58
|
|
|
|
|
|
|
); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |