line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::ResultSourceProxy::Table; |
2
|
|
|
|
|
|
|
|
3
|
379
|
|
|
379
|
|
184306
|
use strict; |
|
379
|
|
|
|
|
1288
|
|
|
379
|
|
|
|
|
11316
|
|
4
|
379
|
|
|
379
|
|
2173
|
use warnings; |
|
379
|
|
|
|
|
1294
|
|
|
379
|
|
|
|
|
10985
|
|
5
|
|
|
|
|
|
|
|
6
|
379
|
|
|
379
|
|
2241
|
use base qw/DBIx::Class::ResultSourceProxy/; |
|
379
|
|
|
|
|
1096
|
|
|
379
|
|
|
|
|
175788
|
|
7
|
|
|
|
|
|
|
|
8
|
379
|
|
|
379
|
|
173399
|
use DBIx::Class::ResultSource::Table; |
|
379
|
|
|
|
|
1566
|
|
|
379
|
|
|
|
|
14562
|
|
9
|
379
|
|
|
379
|
|
2999
|
use Scalar::Util 'blessed'; |
|
379
|
|
|
|
|
1188
|
|
|
379
|
|
|
|
|
18794
|
|
10
|
379
|
|
|
379
|
|
2570
|
use namespace::clean; |
|
379
|
|
|
|
|
1280
|
|
|
379
|
|
|
|
|
2054
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata(table_class => 'DBIx::Class::ResultSource::Table'); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
__PACKAGE__->mk_classdata('table_alias'); # FIXME: Doesn't actually do |
15
|
|
|
|
|
|
|
# anything yet! |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _init_result_source_instance { |
18
|
0
|
|
|
0
|
|
0
|
my $class = shift; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
0
|
$class->mk_classdata('result_source_instance') |
21
|
|
|
|
|
|
|
unless $class->can('result_source_instance'); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
my $table = $class->result_source_instance; |
24
|
0
|
|
0
|
|
|
0
|
my $class_has_table_instance = ($table and $table->result_class eq $class); |
25
|
0
|
0
|
|
|
|
0
|
return $table if $class_has_table_instance; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
my $table_class = $class->table_class; |
28
|
0
|
|
|
|
|
0
|
$class->ensure_class_loaded($table_class); |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
0
|
if( $table ) { |
31
|
0
|
|
|
|
|
0
|
$table = $table_class->new({ |
32
|
|
|
|
|
|
|
%$table, |
33
|
|
|
|
|
|
|
result_class => $class, |
34
|
|
|
|
|
|
|
source_name => undef, |
35
|
|
|
|
|
|
|
schema => undef |
36
|
|
|
|
|
|
|
}); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
0
|
|
|
|
|
0
|
$table = $table_class->new({ |
40
|
|
|
|
|
|
|
name => undef, |
41
|
|
|
|
|
|
|
result_class => $class, |
42
|
|
|
|
|
|
|
source_name => undef, |
43
|
|
|
|
|
|
|
}); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
$class->result_source_instance($table); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
0
|
return $table; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
DBIx::Class::ResultSourceProxy::Table - provides a classdata table |
54
|
|
|
|
|
|
|
object and method proxies |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SYNOPSIS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__->table('cd'); |
59
|
|
|
|
|
|
|
__PACKAGE__->add_columns(qw/cdid artist title year/); |
60
|
|
|
|
|
|
|
__PACKAGE__->set_primary_key('cdid'); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 add_columns |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__PACKAGE__->add_columns(qw/cdid artist title year/); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Adds columns to the current class and creates accessors for them. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 table |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__PACKAGE__->table('tbl_name'); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Gets or sets the table name. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub table { |
81
|
16210
|
|
|
16210
|
1
|
9947064
|
my ($class, $table) = @_; |
82
|
16210
|
100
|
|
|
|
67764
|
return $class->result_source_instance->name unless $table; |
83
|
|
|
|
|
|
|
|
84
|
15558
|
50
|
33
|
|
|
61780
|
unless (blessed $table && $table->isa($class->table_class)) { |
85
|
|
|
|
|
|
|
|
86
|
15558
|
|
|
|
|
510538
|
my $table_class = $class->table_class; |
87
|
15558
|
|
|
|
|
2112146
|
$class->ensure_class_loaded($table_class); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
$table = $table_class->new({ |
90
|
|
|
|
|
|
|
$class->can('result_source_instance') |
91
|
15558
|
50
|
|
|
|
374145
|
? %{$class->result_source_instance||{}} |
|
15041
|
100
|
|
|
|
345892
|
|
92
|
|
|
|
|
|
|
: () |
93
|
|
|
|
|
|
|
, |
94
|
|
|
|
|
|
|
name => $table, |
95
|
|
|
|
|
|
|
result_class => $class, |
96
|
|
|
|
|
|
|
}); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
15558
|
100
|
|
|
|
104862
|
$class->mk_classdata('result_source_instance') |
100
|
|
|
|
|
|
|
unless $class->can('result_source_instance'); |
101
|
|
|
|
|
|
|
|
102
|
15558
|
|
|
|
|
351062
|
$class->result_source_instance($table); |
103
|
|
|
|
|
|
|
|
104
|
15558
|
|
|
|
|
588781
|
return $class->result_source_instance->name; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 table_class |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__PACKAGE__->table_class('DBIx::Class::ResultSource::Table'); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Gets or sets the table class used for construction and validation. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 has_column |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
if ($obj->has_column($col)) { ... } |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Returns 1 if the class has a column of this name, 0 otherwise. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 column_info |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $info = $obj->column_info($col); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Returns the column metadata hashref for a column. For a description of |
124
|
|
|
|
|
|
|
the various types of column data in this hashref, see |
125
|
|
|
|
|
|
|
L<DBIx::Class::ResultSource/add_column> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 columns |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
my @column_names = $obj->columns; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 FURTHER QUESTIONS? |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE> |
138
|
|
|
|
|
|
|
by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can |
139
|
|
|
|
|
|
|
redistribute it and/or modify it under the same terms as the |
140
|
|
|
|
|
|
|
L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
1; |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|