| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::Class::Schema::Loader::DBObject; |
|
2
|
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
139
|
use strict; |
|
|
17
|
|
|
|
|
38
|
|
|
|
17
|
|
|
|
|
497
|
|
|
4
|
17
|
|
|
17
|
|
103
|
use warnings; |
|
|
17
|
|
|
|
|
43
|
|
|
|
17
|
|
|
|
|
434
|
|
|
5
|
17
|
|
|
17
|
|
91
|
use base 'Class::Accessor::Grouped'; |
|
|
17
|
|
|
|
|
39
|
|
|
|
17
|
|
|
|
|
2064
|
|
|
6
|
17
|
|
|
17
|
|
134
|
use mro 'c3'; |
|
|
17
|
|
|
|
|
51
|
|
|
|
17
|
|
|
|
|
94
|
|
|
7
|
17
|
|
|
17
|
|
523
|
use Carp::Clan qw/^DBIx::Class/; |
|
|
17
|
|
|
|
|
53
|
|
|
|
17
|
|
|
|
|
161
|
|
|
8
|
17
|
|
|
17
|
|
1921
|
use Scalar::Util 'weaken'; |
|
|
17
|
|
|
|
|
48
|
|
|
|
17
|
|
|
|
|
982
|
|
|
9
|
17
|
|
|
17
|
|
148
|
use namespace::clean; |
|
|
17
|
|
|
|
|
50
|
|
|
|
17
|
|
|
|
|
119
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
DBIx::Class::Schema::Loader::DBObject - Base Class for Database Objects Such as |
|
14
|
|
|
|
|
|
|
Tables and Views in L |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 loader |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
The loader object this object is associated with, this is a required parameter |
|
21
|
|
|
|
|
|
|
to L. |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head2 name |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Name of the object. The object stringifies to this value. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__PACKAGE__->mk_group_accessors(simple => qw/ |
|
30
|
|
|
|
|
|
|
loader |
|
31
|
|
|
|
|
|
|
name |
|
32
|
|
|
|
|
|
|
_schema |
|
33
|
|
|
|
|
|
|
ignore_schema |
|
34
|
|
|
|
|
|
|
/); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
use overload |
|
37
|
19921
|
|
|
19921
|
|
1166938
|
'""' => sub { $_[0]->name }, |
|
38
|
321
|
|
|
321
|
|
1182
|
'@{}' => sub { $_[0]->name_parts }, |
|
39
|
17
|
|
|
17
|
|
5978
|
fallback => 1; |
|
|
17
|
|
|
|
|
51
|
|
|
|
17
|
|
|
|
|
251
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 new |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
The constructor, takes L, L, L, and L |
|
44
|
|
|
|
|
|
|
as key-value parameters. |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
|
49
|
2010
|
|
|
2010
|
1
|
5187
|
my $class = shift; |
|
50
|
|
|
|
|
|
|
|
|
51
|
2010
|
|
|
|
|
8356
|
my $self = { @_ }; |
|
52
|
|
|
|
|
|
|
|
|
53
|
2010
|
50
|
|
|
|
6511
|
croak "loader is required" unless ref $self->{loader}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
2010
|
|
|
|
|
7696
|
weaken $self->{loader}; |
|
56
|
|
|
|
|
|
|
|
|
57
|
2010
|
|
|
|
|
5169
|
$self->{_schema} = delete $self->{schema}; |
|
58
|
|
|
|
|
|
|
|
|
59
|
2010
|
|
|
|
|
24739
|
return bless $self, $class; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 clone |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Make a shallow copy of the object. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub clone { |
|
69
|
3736
|
|
|
3736
|
1
|
9650
|
my $self = shift; |
|
70
|
|
|
|
|
|
|
|
|
71
|
3736
|
|
|
|
|
33075
|
return bless { %$self }, ref $self; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 schema |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The schema (or owner) of the object. Returns nothing if L is |
|
77
|
|
|
|
|
|
|
true. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 ignore_schema |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Set to true to make L and L not use the defined L. |
|
82
|
|
|
|
|
|
|
Does not affect L (for |
|
83
|
|
|
|
|
|
|
L testing on |
|
84
|
|
|
|
|
|
|
SQLite.) |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub schema { |
|
89
|
32657
|
|
|
32657
|
1
|
278611
|
my $self = shift; |
|
90
|
|
|
|
|
|
|
|
|
91
|
32657
|
100
|
|
|
|
145485
|
return $self->_schema(@_) unless $self->ignore_schema; |
|
92
|
|
|
|
|
|
|
|
|
93
|
429
|
|
|
|
|
1543
|
return undef; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _quote { |
|
97
|
24197
|
|
|
24197
|
|
54230
|
my ($self, $identifier) = @_; |
|
98
|
|
|
|
|
|
|
|
|
99
|
24197
|
50
|
|
|
|
51089
|
$identifier = '' if not defined $identifier; |
|
100
|
|
|
|
|
|
|
|
|
101
|
24197
|
|
50
|
|
|
66184
|
my $qt = $self->loader->quote_char || ''; |
|
102
|
|
|
|
|
|
|
|
|
103
|
24197
|
50
|
|
|
|
53455
|
if (length $qt > 1) { |
|
104
|
0
|
|
|
|
|
0
|
my @qt = split //, $qt; |
|
105
|
0
|
|
|
|
|
0
|
return $qt[0] . $identifier . $qt[1]; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
24197
|
|
|
|
|
134877
|
return "${qt}${identifier}${qt}"; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 sql_name |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Returns the properly quoted full identifier with L and L. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub sql_name { |
|
118
|
23843
|
|
|
23843
|
0
|
1243723
|
my $self = shift; |
|
119
|
|
|
|
|
|
|
|
|
120
|
23843
|
|
|
|
|
65364
|
my $name_sep = $self->loader->name_sep; |
|
121
|
|
|
|
|
|
|
|
|
122
|
23843
|
100
|
|
|
|
53083
|
if ($self->schema) { |
|
123
|
354
|
|
|
|
|
824
|
return $self->_quote($self->schema) |
|
124
|
|
|
|
|
|
|
. $name_sep |
|
125
|
|
|
|
|
|
|
. $self->_quote($self->name); |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
|
|
128
|
23489
|
|
|
|
|
66874
|
return $self->_quote($self->name); |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 dbic_name |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Returns a value suitable for the C<< __PACKAGE__->table >> call in L Result files. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub dbic_name { |
|
138
|
2979
|
|
|
2979
|
0
|
6445
|
my $self = shift; |
|
139
|
|
|
|
|
|
|
|
|
140
|
2979
|
|
|
|
|
10248
|
my $name_sep = $self->loader->name_sep; |
|
141
|
|
|
|
|
|
|
|
|
142
|
2979
|
100
|
66
|
|
|
12724
|
if ($self->loader->qualify_objects && $self->_schema) { |
|
143
|
32
|
50
|
33
|
|
|
312
|
if ($self->_schema =~ /\W/ || $self->name =~ /\W/) { |
|
144
|
0
|
|
|
|
|
0
|
return \ $self->sql_name; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
32
|
|
|
|
|
372
|
return $self->_schema . $name_sep . $self->name; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
2947
|
50
|
|
|
|
16884
|
if ($self->name =~ /\W/) { |
|
151
|
0
|
|
|
|
|
0
|
return \ $self->_quote($self->name); |
|
152
|
|
|
|
|
|
|
} |
|
153
|
|
|
|
|
|
|
|
|
154
|
2947
|
|
|
|
|
18889
|
return $self->name; |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 name_parts |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Returns an arrayref of the values returned by the methods specified in |
|
160
|
|
|
|
|
|
|
the L of |
|
161
|
|
|
|
|
|
|
the L object. The object arrayrefifies to this value. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=cut |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub name_parts { |
|
166
|
1320
|
|
|
1320
|
1
|
3397
|
my ($self) = shift; |
|
167
|
1320
|
|
|
|
|
2431
|
return [ map { $self->$_ } @{$self->loader->moniker_parts} ]; |
|
|
1327
|
|
|
|
|
9742
|
|
|
|
1320
|
|
|
|
|
5442
|
|
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
L, L, |
|
174
|
|
|
|
|
|
|
L |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 AUTHORS |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
See L. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 LICENSE |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
|
183
|
|
|
|
|
|
|
the same terms as Perl itself. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
1; |
|
188
|
|
|
|
|
|
|
# vim:et sts=4 sw=4 tw=0: |