line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
206313
|
use utf8; |
|
5
|
|
|
|
|
84
|
|
|
5
|
|
|
|
|
26
|
|
4
|
5
|
|
|
5
|
|
210
|
use 5.016; |
|
5
|
|
|
|
|
18
|
|
5
|
5
|
|
|
5
|
|
24
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
92
|
|
6
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
129
|
|
7
|
5
|
|
|
5
|
|
2110
|
use Readonly; |
|
5
|
|
|
|
|
15466
|
|
|
5
|
|
|
|
|
279
|
|
8
|
5
|
|
|
5
|
|
2399
|
use Geoffrey::Action::Table; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
226
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$Geoffrey::VERSION = '0.000204'; |
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
52
|
use parent 'Geoffrey::Role::Core'; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
22
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Readonly::Scalar my $IDX_DATABASE_DRIVER => 18; #ok |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
6
|
|
|
6
|
1
|
43420
|
my $class = shift; |
18
|
6
|
|
|
|
|
71
|
my $self = $class->SUPER::new(@_); |
19
|
3
|
|
|
|
|
9
|
bless $self, $class; |
20
|
3
|
|
|
|
|
36
|
$self->converter->check_version($self->dbh->get_info($IDX_DATABASE_DRIVER)); |
21
|
3
|
|
|
|
|
20
|
$self->_prepare_tables; |
22
|
3
|
|
|
|
|
19
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _prepare_tables { |
26
|
3
|
|
|
3
|
|
12
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
12
|
my $o_action_table = Geoffrey::Action::Table->new(dbh => $self->dbh, converter => $self->converter); |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
17
|
my $hr_changelog_table = $self->converter->get_changelog_table_hashref($self->dbh, $self->schema); |
31
|
3
|
100
|
|
|
|
30
|
$o_action_table->add($hr_changelog_table) if $hr_changelog_table; |
32
|
3
|
|
|
|
|
209
|
return $hr_changelog_table; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub reader { |
36
|
2
|
|
|
2
|
1
|
989
|
my $self = shift; |
37
|
2
|
|
|
|
|
1292
|
require Geoffrey::Read; |
38
|
2
|
|
33
|
|
|
28
|
$self->{reader} //= Geoffrey::Read->new( |
39
|
|
|
|
|
|
|
converter => $self->converter, |
40
|
|
|
|
|
|
|
dbh => $self->dbh, |
41
|
|
|
|
|
|
|
io_name => $self->io_name, |
42
|
|
|
|
|
|
|
schema => $self->schema, |
43
|
|
|
|
|
|
|
); |
44
|
2
|
|
|
|
|
15
|
return $self->{reader}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub writer { |
48
|
31
|
|
|
31
|
1
|
4007
|
my $self = shift; |
49
|
31
|
|
|
|
|
1136
|
require Geoffrey::Write; |
50
|
31
|
|
66
|
|
|
95
|
$self->{writer} //= Geoffrey::Write->new( |
51
|
|
|
|
|
|
|
converter => $self->converter, |
52
|
|
|
|
|
|
|
dbh => $self->dbh, |
53
|
|
|
|
|
|
|
io_name => $self->io_name, |
54
|
|
|
|
|
|
|
schema => $self->schema, |
55
|
|
|
|
|
|
|
); |
56
|
31
|
|
|
|
|
127
|
return $self->{writer}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub read { |
60
|
1
|
|
|
1
|
1
|
928
|
my ($self, $s_changelog_root) = @_; |
61
|
1
|
|
|
|
|
6
|
return $self->reader->run($s_changelog_root); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub write { |
65
|
1
|
|
|
1
|
1
|
4
|
my ($self, $s_changelog_root, $s_schema, $dump) = @_; |
66
|
1
|
|
|
|
|
4
|
return $self->writer->run($s_changelog_root, $s_schema, $dump); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub delete { |
70
|
2
|
|
|
2
|
1
|
57
|
my ($self, $s_changeset_id) = @_; |
71
|
2
|
|
|
|
|
15
|
return $self->changelog_io->delete($s_changeset_id); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub insert { |
75
|
1
|
|
|
1
|
1
|
68
|
my ($self, $s_file, $hr_changeset) = @_; |
76
|
1
|
|
|
|
|
5
|
return $self->changelog_io->insert($s_file, $hr_changeset); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub rewrite { |
80
|
1
|
|
|
1
|
1
|
47
|
my ($self, $hr_changeset) = @_; |
81
|
1
|
50
|
|
|
|
5
|
return unless $hr_changeset->{id}; |
82
|
1
|
0
|
|
|
|
4
|
return $self->delete($hr_changeset->{id}) ? $self->insert(q//, [$hr_changeset]) : 0; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub load_changeset { |
86
|
1
|
|
|
1
|
1
|
50
|
my ($self, $s_changeset_id, $s_file) = @_; |
87
|
1
|
50
|
|
|
|
5
|
if (!$s_changeset_id) { |
88
|
1
|
|
|
|
|
532
|
require Geoffrey::Exception::RequiredValue; |
89
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_id(); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
return $self->changelog_io->load_changeset($s_changeset_id, $s_file); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
__END__ |