| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::QuickORM::Schema::Table::Column; |
|
2
|
24
|
|
|
24
|
|
169
|
use strict; |
|
|
24
|
|
|
|
|
63
|
|
|
|
24
|
|
|
|
|
1062
|
|
|
3
|
24
|
|
|
24
|
|
135
|
use warnings; |
|
|
24
|
|
|
|
|
81
|
|
|
|
24
|
|
|
|
|
2090
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.000019'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
24
|
|
|
24
|
|
187
|
use Carp qw/croak confess/; |
|
|
24
|
|
|
|
|
94
|
|
|
|
24
|
|
|
|
|
3097
|
|
|
8
|
24
|
|
|
24
|
|
179
|
use Scalar::Util qw/blessed/; |
|
|
24
|
|
|
|
|
51
|
|
|
|
24
|
|
|
|
|
1792
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
24
|
|
|
|
|
2266
|
use DBIx::QuickORM::Affinity qw{ |
|
11
|
|
|
|
|
|
|
validate_affinity |
|
12
|
|
|
|
|
|
|
affinity_from_type |
|
13
|
24
|
|
|
24
|
|
172
|
}; |
|
|
24
|
|
|
|
|
68
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
24
|
|
|
|
|
291
|
use DBIx::QuickORM::Util::HashBase qw{ |
|
16
|
|
|
|
|
|
|
+name |
|
17
|
|
|
|
|
|
|
<sql_default |
|
18
|
|
|
|
|
|
|
<perl_default |
|
19
|
|
|
|
|
|
|
<omit |
|
20
|
|
|
|
|
|
|
<order |
|
21
|
|
|
|
|
|
|
<nullable |
|
22
|
|
|
|
|
|
|
<identity |
|
23
|
|
|
|
|
|
|
+affinity |
|
24
|
|
|
|
|
|
|
<type |
|
25
|
|
|
|
|
|
|
<created |
|
26
|
|
|
|
|
|
|
<compiled |
|
27
|
24
|
|
|
24
|
|
184
|
}; |
|
|
24
|
|
|
|
|
71
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
99
|
|
|
99
|
0
|
517
|
sub name { $_[0]->{+NAME} } |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub init { |
|
32
|
233
|
|
|
233
|
0
|
417
|
my $self = shift; |
|
33
|
|
|
|
|
|
|
|
|
34
|
233
|
100
|
|
|
|
817
|
my $debug = $self->{+CREATED} ? " (defined in $self->{+CREATED})" : ""; |
|
35
|
|
|
|
|
|
|
|
|
36
|
233
|
50
|
|
|
|
675
|
croak "A 'name' is a required${debug}" unless $self->{+NAME}; |
|
37
|
233
|
50
|
|
|
|
763
|
croak "Column must have an order number${debug}" unless $self->{+ORDER}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub affinity { |
|
41
|
239
|
|
|
239
|
0
|
533
|
my $self = shift; |
|
42
|
239
|
|
|
|
|
644
|
my ($dialect) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
239
|
100
|
|
|
|
1576
|
return $self->{+AFFINITY} if $self->{+AFFINITY}; |
|
45
|
|
|
|
|
|
|
|
|
46
|
2
|
50
|
|
|
|
10
|
my $debug = $self->{+CREATED} ? " (defined in $self->{+CREATED})" : ""; |
|
47
|
2
|
50
|
|
|
|
15
|
my $type = $self->{+TYPE} or croak "No affinity specified, and no type provided${debug}"; |
|
48
|
|
|
|
|
|
|
|
|
49
|
2
|
50
|
|
|
|
8
|
if (ref($type) eq 'SCALAR') { |
|
50
|
0
|
|
0
|
|
|
0
|
$self->{+AFFINITY} //= affinity_from_type($$type); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
croak "'affinity' was not provided, and could not be derived from type '$$type'${debug}" |
|
53
|
0
|
0
|
|
|
|
0
|
unless $self->{+AFFINITY}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
croak "'$self->{+AFFINITY}' is not a valid affinity${debug}" |
|
56
|
0
|
0
|
|
|
|
0
|
unless validate_affinity($self->{+AFFINITY}); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
2
|
50
|
|
|
|
18
|
croak "'$type' is not a valid type${debug}" unless $type->DOES('DBIx::QuickORM::Role::Type'); |
|
60
|
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
50
|
return $self->{+AFFINITY} = $type->qorm_affinity(column => $self, dialect => $dialect); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub merge { |
|
65
|
3
|
|
|
3
|
0
|
7
|
my $self = shift; |
|
66
|
3
|
|
|
|
|
8
|
my ($other, %params) = @_; |
|
67
|
|
|
|
|
|
|
|
|
68
|
3
|
|
|
|
|
61
|
return ref($self)->new(%$self, %$other, %params); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub clone { |
|
72
|
88
|
|
|
88
|
0
|
184
|
my $self = shift; |
|
73
|
88
|
|
|
|
|
200
|
my %params = @_; |
|
74
|
|
|
|
|
|
|
|
|
75
|
88
|
|
|
|
|
599
|
return ref($self)->new(%$self, %params); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |