line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ODS::Storage::Base; |
2
|
|
|
|
|
|
|
|
3
|
72
|
|
|
72
|
|
41423
|
use YAOO; |
|
72
|
|
|
|
|
203
|
|
|
72
|
|
|
|
|
623
|
|
4
|
|
|
|
|
|
|
|
5
|
72
|
|
|
72
|
|
54338
|
use ODS::Iterator; |
|
72
|
|
|
|
|
156
|
|
|
72
|
|
|
|
|
26610
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
auto_build; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has table => isa(object); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has serialize_class => isa(object); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub connect { |
14
|
142
|
|
|
142
|
0
|
1356
|
my ($self, %params) = @_; |
15
|
142
|
|
|
|
|
1201
|
$self = $self->new(%params); |
16
|
142
|
|
|
|
|
34641
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub into_rows { |
20
|
1765
|
|
|
1765
|
0
|
95385
|
my ($self, $data, $inflated) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1765
|
100
|
66
|
|
|
8628
|
$data = $self->parse_data_format($data) |
23
|
|
|
|
|
|
|
if (not ref $data and $self->can('parse_data_format')); |
24
|
|
|
|
|
|
|
|
25
|
1765
|
100
|
|
|
|
9886
|
if (ref $data eq 'ARRAY') { |
|
|
100
|
|
|
|
|
|
26
|
46
|
|
|
|
|
157
|
my @rows; |
27
|
46
|
|
|
|
|
125
|
for my $row ( @{ $data } ) { |
|
46
|
|
|
|
|
290
|
|
28
|
922
|
|
50
|
|
|
6012
|
push @rows, $self->table->row_class->new( |
29
|
|
|
|
|
|
|
table => $self->table, |
30
|
|
|
|
|
|
|
data => $row, |
31
|
|
|
|
|
|
|
inflated => $inflated || 0, |
32
|
|
|
|
|
|
|
serialize_class => $self->serialize_class |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
46
|
|
|
|
|
421
|
$self->table->rows(\@rows); |
36
|
|
|
|
|
|
|
|
37
|
46
|
|
|
|
|
51023
|
return ODS::Iterator->new(table => $self->table); |
38
|
|
|
|
|
|
|
} elsif (ref $data eq 'HASH') { |
39
|
1718
|
|
50
|
|
|
7451
|
return $self->table->row_class->new( |
40
|
|
|
|
|
|
|
table => $self->table, |
41
|
|
|
|
|
|
|
data => $data, |
42
|
|
|
|
|
|
|
inflated => $inflated || 0, |
43
|
|
|
|
|
|
|
serialize_class => $self->serialize_class |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
5
|
return undef; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub into_storage { |
51
|
1728
|
|
|
1728
|
0
|
5242
|
my ($self, $all) = @_; |
52
|
|
|
|
|
|
|
|
53
|
1728
|
|
|
|
|
3096
|
my $data; |
54
|
1728
|
100
|
66
|
|
|
15854
|
if ($all && !ref $all) { |
|
|
50
|
|
|
|
|
|
55
|
12
|
|
|
|
|
18
|
for my $row (@{ $self->table->rows }) { |
|
12
|
|
|
|
|
29
|
|
56
|
44
|
|
|
|
|
188
|
my $val = $row->store_row(); |
57
|
44
|
|
|
|
|
50
|
push @{$data}, $val; |
|
44
|
|
|
|
|
99
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} elsif ($all) { |
60
|
1716
|
|
|
|
|
8404
|
$data = $all->store_row(); |
61
|
|
|
|
|
|
|
} else { |
62
|
0
|
|
|
|
|
0
|
$data = $self->table->rows->[-1]->store_row(); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
1728
|
50
|
33
|
|
|
23249
|
$data = $self->stringify_data_format($data) |
66
|
|
|
|
|
|
|
if (ref $data and $self->can('stringify_data_format')); |
67
|
|
|
|
|
|
|
|
68
|
1728
|
|
|
|
|
12262
|
return $data; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|