line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
213713
|
use utf8; |
|
5
|
|
|
|
|
79
|
|
|
5
|
|
|
|
|
26
|
|
4
|
5
|
|
|
5
|
|
199
|
use 5.016; |
|
5
|
|
|
|
|
18
|
|
5
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
94
|
|
6
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
127
|
|
7
|
5
|
|
|
5
|
|
2251
|
use Readonly; |
|
5
|
|
|
|
|
16139
|
|
|
5
|
|
|
|
|
252
|
|
8
|
5
|
|
|
5
|
|
2449
|
use Geoffrey::Action::Table; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
205
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$Geoffrey::VERSION = '0.000205'; |
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
35
|
use parent 'Geoffrey::Role::Core'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
23
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Readonly::Scalar my $IDX_DATABASE_DRIVER => 18; #ok |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
6
|
|
|
6
|
1
|
42596
|
my $class = shift; |
18
|
6
|
|
|
|
|
43
|
my $self = $class->SUPER::new(@_); |
19
|
3
|
|
|
|
|
7
|
bless $self, $class; |
20
|
3
|
|
|
|
|
20
|
$self->converter->check_version($self->dbh->get_info($IDX_DATABASE_DRIVER)); |
21
|
3
|
|
|
|
|
18
|
$self->_prepare_tables; |
22
|
3
|
|
|
|
|
19
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _prepare_tables { |
26
|
3
|
|
|
3
|
|
9
|
my ($self) = @_; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
13
|
my $o_action_table = Geoffrey::Action::Table->new(dbh => $self->dbh, converter => $self->converter); |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
16
|
my $hr_changelog_table = $self->converter->get_changelog_table_hashref($self->dbh, $self->schema); |
31
|
3
|
100
|
|
|
|
27
|
$o_action_table->add($hr_changelog_table) if $hr_changelog_table; |
32
|
3
|
|
|
|
|
160
|
return $hr_changelog_table; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub reader { |
36
|
2
|
|
|
2
|
1
|
1305
|
my $self = shift; |
37
|
2
|
|
|
|
|
1334
|
require Geoffrey::Read; |
38
|
2
|
|
33
|
|
|
27
|
$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
|
|
|
|
|
14
|
return $self->{reader}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub writer { |
48
|
31
|
|
|
31
|
1
|
3742
|
my $self = shift; |
49
|
31
|
|
|
|
|
1249
|
require Geoffrey::Write; |
50
|
31
|
|
66
|
|
|
91
|
$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
|
|
|
|
|
140
|
return $self->{writer}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub read { |
60
|
1
|
|
|
1
|
1
|
675
|
my ($self, $s_changelog_root) = @_; |
61
|
1
|
|
|
|
|
5
|
return $self->reader->run($s_changelog_root); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub write { |
65
|
1
|
|
|
1
|
1
|
5
|
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
|
53
|
my ($self, $s_changeset_id) = @_; |
71
|
2
|
|
|
|
|
13
|
return $self->changelog_io->delete($s_changeset_id); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub insert { |
75
|
1
|
|
|
1
|
1
|
62
|
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
|
46
|
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
|
47
|
my ($self, $s_changeset_id, $s_file) = @_; |
87
|
1
|
50
|
|
|
|
4
|
if (!$s_changeset_id) { |
88
|
1
|
|
|
|
|
524
|
require Geoffrey::Exception::RequiredValue; |
89
|
1
|
|
|
|
|
6
|
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__ |