line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rose::DB::Object::Metadata::ColumnList; |
2
|
|
|
|
|
|
|
|
3
|
61
|
|
|
61
|
|
437
|
use strict; |
|
61
|
|
|
|
|
149
|
|
|
61
|
|
|
|
|
2002
|
|
4
|
|
|
|
|
|
|
|
5
|
61
|
|
|
61
|
|
1297
|
use Rose::DB::Object::Metadata::Object; |
|
61
|
|
|
|
|
148
|
|
|
61
|
|
|
|
|
8352
|
|
6
|
|
|
|
|
|
|
our @ISA = qw(Rose::DB::Object::Metadata::Object); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use overload |
11
|
|
|
|
|
|
|
( |
12
|
|
|
|
|
|
|
'""' => sub |
13
|
|
|
|
|
|
|
{ |
14
|
0
|
|
|
0
|
|
0
|
my($self) = shift; |
15
|
0
|
|
0
|
|
|
0
|
return join($", map { "$_" } @{$self->{'columns'} ||= $self->auto_init_columns}); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
16
|
|
|
|
|
|
|
}, |
17
|
61
|
|
|
|
|
740
|
fallback => 1, |
18
|
61
|
|
|
61
|
|
508
|
); |
|
61
|
|
|
|
|
180
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub columns |
21
|
|
|
|
|
|
|
{ |
22
|
309
|
|
|
309
|
0
|
456
|
my($self) = shift; |
23
|
|
|
|
|
|
|
|
24
|
309
|
|
|
|
|
705
|
my $meta = $self->parent; |
25
|
|
|
|
|
|
|
|
26
|
309
|
100
|
|
|
|
640
|
if(@_) |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
# Force stringification in case they're column objects |
29
|
|
|
|
|
|
|
# instead of just column names. |
30
|
1
|
50
|
33
|
|
|
9
|
if(@_ == 1 && ref $_[0] eq 'ARRAY') |
31
|
|
|
|
|
|
|
{ |
32
|
1
|
|
|
|
|
2
|
$self->{'columns'} = [ map { "$_" } @{$_[0]} ]; |
|
3
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
4
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
else |
35
|
|
|
|
|
|
|
{ |
36
|
0
|
|
|
|
|
0
|
$self->{'columns'} = [ map { "$_" } @_ ]; |
|
0
|
|
|
|
|
0
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
309
|
100
|
|
|
|
623
|
return unless(defined wantarray); |
41
|
|
|
|
|
|
|
|
42
|
308
|
50
|
|
|
|
574
|
unless($meta) |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
0
|
0
|
|
|
0
|
return wantarray ? @{$self->{'columns'} ||= []} : ($self->{'columns'} ||= []); |
|
0
|
|
0
|
|
|
0
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
308
|
100
|
50
|
|
|
403
|
unless(@{$self->{'columns'} ||= []}) |
|
308
|
|
|
|
|
838
|
|
48
|
|
|
|
|
|
|
{ |
49
|
77
|
|
|
|
|
258
|
$self->{'columns'} = $self->auto_init_columns; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Expand into columns on return |
53
|
237
|
100
|
50
|
|
|
523
|
return wantarray ? map { $meta->column($_) || $_ } @{$self->{'columns'} ||= []} : |
|
231
|
|
|
|
|
486
|
|
54
|
308
|
50
|
50
|
|
|
648
|
[ map { $meta->column($_) || $_ } @{$self->{'columns'} ||= []} ]; |
|
77
|
100
|
|
|
|
215
|
|
|
77
|
|
|
|
|
222
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
0
|
0
|
sub auto_init_columns { [] } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub column_names |
60
|
|
|
|
|
|
|
{ |
61
|
645
|
|
|
645
|
0
|
3640
|
my($self) = shift; |
62
|
|
|
|
|
|
|
|
63
|
645
|
100
|
100
|
|
|
758
|
if(@{$self->{'columns'} ||= []}) |
|
645
|
|
|
|
|
2035
|
|
64
|
|
|
|
|
|
|
{ |
65
|
568
|
100
|
|
|
|
1195
|
return wantarray ? @{$self->{'columns'}} : $self->{'columns'}; |
|
448
|
|
|
|
|
1253
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# This call with auto-init the columns if necessary |
69
|
77
|
|
|
|
|
275
|
my $columns = $self->columns; |
70
|
|
|
|
|
|
|
|
71
|
77
|
50
|
|
|
|
372
|
return wantarray ? @$columns : $columns; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub add_columns |
75
|
|
|
|
|
|
|
{ |
76
|
3
|
|
|
3
|
0
|
9
|
my($self) = shift; |
77
|
|
|
|
|
|
|
|
78
|
3
|
50
|
33
|
|
|
24
|
if(@_ == 1 && ref $_[0] eq 'ARRAY') |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
|
|
0
|
push @{$self->{'columns'}}, map { "$_" } @{$_[0]}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else |
83
|
|
|
|
|
|
|
{ |
84
|
3
|
|
|
|
|
7
|
push @{$self->{'columns'}}, map { "$_" } @_; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
14
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
3
|
|
|
|
|
9
|
return; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
*add_column = \&add_columns; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub delete_columns |
93
|
|
|
|
|
|
|
{ |
94
|
0
|
|
|
0
|
0
|
|
shift->{'columns'} = []; |
95
|
0
|
|
|
|
|
|
return; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |