line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Model::Row; |
2
|
73
|
|
|
73
|
|
444
|
use strict; |
|
73
|
|
|
|
|
168
|
|
|
73
|
|
|
|
|
8528
|
|
3
|
73
|
|
|
73
|
|
385
|
use warnings; |
|
73
|
|
|
|
|
162
|
|
|
73
|
|
|
|
|
1722
|
|
4
|
|
|
|
|
|
|
|
5
|
73
|
|
|
73
|
|
397
|
use Carp (); |
|
73
|
|
|
|
|
145
|
|
|
73
|
|
|
|
|
26941
|
|
6
|
|
|
|
|
|
|
$Carp::Internal{(__PACKAGE__)}++; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
1560
|
|
|
1560
|
0
|
4749
|
my($class, $model, $columns) = @_; |
10
|
1560
|
|
100
|
|
|
14936
|
$columns ||= {}; |
11
|
1560
|
|
|
|
|
40880
|
bless { |
12
|
|
|
|
|
|
|
model => $model, |
13
|
1560
|
|
|
|
|
2740
|
column_values => { %{ $columns } }, |
14
|
|
|
|
|
|
|
alias_values => +{}, |
15
|
|
|
|
|
|
|
changed_cols => +{}, |
16
|
|
|
|
|
|
|
original_cols => +{}, |
17
|
|
|
|
|
|
|
}, $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub update { |
21
|
29
|
|
|
29
|
1
|
527
|
my $self = shift; |
22
|
29
|
|
|
|
|
322
|
$self->{model}->update($self, @_); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub delete { |
26
|
36
|
|
|
36
|
1
|
11749
|
my $self = shift; |
27
|
36
|
|
|
|
|
524
|
$self->{model}->delete($self, @_); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_column { |
31
|
0
|
|
|
0
|
0
|
0
|
my($self, $name) = @_; |
32
|
0
|
|
|
|
|
0
|
$self->{column_values}->{$name}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
sub get_columns { |
35
|
89
|
|
|
89
|
0
|
181
|
my $self = shift; |
36
|
89
|
|
|
|
|
357
|
my $schema = $self->{model}->_get_schema_by_row($self); |
37
|
89
|
|
|
|
|
205
|
my $columns = +{}; |
38
|
89
|
|
|
|
|
187
|
for my $name (keys %{ $schema->{column} }) { |
|
89
|
|
|
|
|
363
|
|
39
|
180
|
|
|
|
|
627
|
$columns->{$name} = $self->{column_values}->{$name}; |
40
|
|
|
|
|
|
|
} |
41
|
89
|
|
|
|
|
315
|
$columns; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub get_original_column { |
45
|
80
|
|
|
80
|
0
|
10538
|
my($self, $name) = @_; |
46
|
80
|
100
|
|
|
|
758
|
$self->{original_cols}->{$name} || $self->{column_values}->{$name}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub get_changed_columns { |
50
|
82
|
|
|
82
|
0
|
161
|
my $self = shift; |
51
|
82
|
|
|
|
|
1230
|
+{ %{ $self->{changed_cols} } }; |
|
82
|
|
|
|
|
9511
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
0
|
|
sub get_model { $_[0]->{model} } |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Data::Model::Row - Data::Model's Row class |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 update |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
update is executed for instance record. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
It works by schema in which primary key exists. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 delete |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
delete is executed for instance record. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
It works by schema in which primary key exists. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SEE ALSO |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Kazuhiro Osawa Eyappo shibuya plE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 LICENSE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
87
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|