| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::Model::FK; |
|
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
0
|
|
|
|
1
|
|
|
|
|
22
|
|
|
4
|
1
|
|
|
1
|
|
2
|
use Scalar::Util qw/weaken/; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
38
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use Moo; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
6
|
1
|
|
|
1
|
|
188
|
use Types::Standard qw/ArrayRef/; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.0.1_1'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has _columns => ( |
|
11
|
|
|
|
|
|
|
is => 'ro', |
|
12
|
|
|
|
|
|
|
isa => ArrayRef, |
|
13
|
|
|
|
|
|
|
init_arg => 'columns', |
|
14
|
|
|
|
|
|
|
required => 1, |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has table => ( |
|
18
|
|
|
|
|
|
|
is => 'ro', |
|
19
|
|
|
|
|
|
|
required => 1, |
|
20
|
|
|
|
|
|
|
weak_ref => 1, |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has _to_columns => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
isa => ArrayRef, |
|
26
|
|
|
|
|
|
|
init_arg => 'to_columns', |
|
27
|
|
|
|
|
|
|
required => 1, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has to_table => ( |
|
31
|
|
|
|
|
|
|
is => 'ro', |
|
32
|
|
|
|
|
|
|
required => 1, |
|
33
|
|
|
|
|
|
|
weak_ref => 1, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub BUILD { |
|
37
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my @list = @{ $self->_columns }; |
|
|
0
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
foreach my $i ( 0 .. $#list ) { |
|
41
|
0
|
|
|
|
|
|
weaken( $self->_columns->[$i] ); |
|
42
|
0
|
|
|
|
|
|
$self->_columns->[$i]->bump_ref_count; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
@list = @{ $self->_to_columns }; |
|
|
0
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
foreach my $i ( 0 .. $#list ) { |
|
47
|
0
|
|
|
|
|
|
weaken( $self->_to_columns->[$i] ); |
|
48
|
0
|
|
|
|
|
|
$self->_to_columns->[$i]->bump_target_count; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub as_string { |
|
53
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
54
|
0
|
|
|
|
|
|
my $prefix = shift; |
|
55
|
|
|
|
|
|
|
my $str = |
|
56
|
|
|
|
|
|
|
$prefix |
|
57
|
|
|
|
|
|
|
. "FOREIGN KEY(" |
|
58
|
0
|
|
|
|
|
|
. join( ',', map { $_->name } $self->columns ) |
|
59
|
|
|
|
|
|
|
. ') REFERENCES ' |
|
60
|
|
|
|
|
|
|
. $self->to_table->name . '(' |
|
61
|
0
|
|
|
|
|
|
. join( ',', map { $_->name } $self->to_columns ) . ')'; |
|
|
0
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return $str; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub columns { |
|
67
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
68
|
0
|
0
|
|
|
|
|
return @{ $self->_columns } if wantarray; |
|
|
0
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
return $self->_columns; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub to_columns { |
|
73
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
74
|
0
|
0
|
|
|
|
|
return @{ $self->_to_columns } if wantarray; |
|
|
0
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return $self->_to_columns; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |