| 1 | package Geoffrey::Changelog::Database; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use 5.024; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Geoffrey::Exception::Database; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | $Geoffrey::Changelog::Database::VERSION = '0.000202'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use parent 'Geoffrey::Role::Changelog'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 15 | 0 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||||||||||
| 16 | 0 | $self->{needs_converter} = 1; | |||||||||||||||||||||||||||
| 17 | 0 | $self->{needs_dbh} = 1; | |||||||||||||||||||||||||||
| 18 | 0 | $self->{generated_sql} = []; | |||||||||||||||||||||||||||
| 19 | 0 | $self = bless $self, $class; | |||||||||||||||||||||||||||
| 20 | 0 | ▶ | $self->_prepare_tables if ($self->converter && $self->dbh); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->converter and $self->dbh
MC/DC0%0/2
$self->converter and $self->dbh
$self->converter
$self->dbh
Truth table0%0/3
A and B
A= $self->converterB= $self->dbh
| |||||||||||||||||||||||||||||
| 21 | 0 | return $self; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub _action_entry { | ||||||||||||||||||||||||||
|
Subroutine
_action_entry: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 25 | 0 | my ($self, $o_action_entry) = @_; | |||||||||||||||||||||||||||
| 26 | 0 | ▶ | $self->{action_entry} = $o_action_entry if $o_action_entry; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | require Geoffrey::Action::Entry; | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | $self->{action_entry} //= Geoffrey::Action::Entry->new(dbh => $self->dbh, converter => $self->converter); | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"action_entry"} //= "Geoffrey::Action::Entry"->new("dbh", $self->dbh, "converter", $self->converter)
MC/DC0%0/2
$self->{"action_entry"} //= "Geoffrey::Action::Entry"->new("dbh", $self->dbh, "converter", $self->converter)
$self->{"action_entry"}
"Geoffrey::Action::Entry"->new("dbh", $self->dbh, "converter", $self->converter)
Truth table0%0/3
A //= B
A= $self->{"action_entry"}B= "Geoffrey::Action::Entry"->new("dbh", $self->dbh, "converter", $self->converter)
| |||||||||||||||||||||||||||||
| 29 | 0 | return $self->{action_entry}; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub _sql_abstract { | ||||||||||||||||||||||||||
|
Subroutine
_sql_abstract: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 33 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 34 | 0 | require SQL::Abstract; | |||||||||||||||||||||||||||
| 35 | 0 | ▶ | $self->{sql_abstract} //= SQL::Abstract->new; | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"sql_abstract"} //= "SQL::Abstract"->new
MC/DC0%0/2
$self->{"sql_abstract"} //= "SQL::Abstract"->new
$self->{"sql_abstract"}
"SQL::Abstract"->new
Truth table0%0/3
A //= B
A= $self->{"sql_abstract"}B= "SQL::Abstract"->new
| |||||||||||||||||||||||||||||
| 36 | 0 | return $self->{sql_abstract}; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub _changlog_entries_table_name { | ||||||||||||||||||||||||||
|
Subroutine
_changlog_entries_table_name: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | $_[0]->{changlog_entries_table} //= 'geoffrey_changlog_entries'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$_[0]{"changlog_entries_table"} //= "geoffrey_changlog_entries"
MC/DC0%0/1
$_[0]{"changlog_entries_table"} //= "geoffrey_changlog_entries"
$_[0]{"changlog_entries_table"}
Truth table0%0/2
A
A= $_[0]{"changlog_entries_table"}
| |||||||||||||||||||||||||||||
| 41 | 0 | return $_[0]->{changlog_entries_table}; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub _changlog_entries_table { | ||||||||||||||||||||||||||
|
Subroutine
_changlog_entries_table: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 45 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 46 | return [ | ||||||||||||||||||||||||||||
| 47 | 0 | {name => 'id', type => 'integer', primarykey => 1, notnull => 1, default => 'autoincrement',}, | |||||||||||||||||||||||||||
| 48 | {name => 'action', type => 'varchar', lenght => 64,}, | ||||||||||||||||||||||||||||
| 49 | {name => 'name', type => 'varchar', lenght => 64,}, | ||||||||||||||||||||||||||||
| 50 | {name => 'template', type => 'varchar', lenght => 64,}, | ||||||||||||||||||||||||||||
| 51 | {name => 'type', type => 'varchar', lenght => 64,}, | ||||||||||||||||||||||||||||
| 52 | {name => 'plain_sql', type => 'text'}, | ||||||||||||||||||||||||||||
| 53 | {name => 'refcolumn', type => 'varchar', lenght => 64,}, | ||||||||||||||||||||||||||||
| 54 | {name => 'reftable', type => 'varchar', lenght => 64,}, | ||||||||||||||||||||||||||||
| 55 | {name => 'columns', type => 'varchar', lenght => 64,}, | ||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||
| 57 | name => 'geoffrey_changelog', | ||||||||||||||||||||||||||||
| 58 | type => 'varchar', | ||||||||||||||||||||||||||||
| 59 | lenght => 64, | ||||||||||||||||||||||||||||
| 60 | notnull => 1, | ||||||||||||||||||||||||||||
| 61 | foreignkey => {reftable => $self->geoffrey_changelogs, refcolumn => 'id'}, | ||||||||||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||||||||||
| 63 | ]; | ||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | ▶ | sub _get_changesets { | ||||||||||||||||||||||||||
|
Subroutine
_get_changesets: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 67 | 0 | my ($self, $hr_params) = @_; | |||||||||||||||||||||||||||
| 68 | 0 | $self->_prepare_tables; | |||||||||||||||||||||||||||
| 69 | my $s_changeset_sql = $self->_sql_abstract->select( | ||||||||||||||||||||||||||||
| 70 | ($self->schema ? $self->schema . q/./ : q//) . $self->geoffrey_changelogs, | ||||||||||||||||||||||||||||
| 71 | qw/*/, | ||||||||||||||||||||||||||||
| 72 | { | ||||||||||||||||||||||||||||
| 73 | ($hr_params->{changeset_id} ? (id => $hr_params->{changeset_id}) : ()), | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | ($hr_params->{not_executed} ? (md5sum => undef) : ()), | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 75 | }); | ||||||||||||||||||||||||||||
| 76 | return $self->dbh->selectall_arrayref( | ||||||||||||||||||||||||||||
| 77 | $s_changeset_sql, | ||||||||||||||||||||||||||||
| 78 | {Slice => {}}, | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | ($hr_params->{changeset_id} ? ($hr_params->{changeset_id}) : ()) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->dbh->selectall_arrayref($s_changeset_sql, {'Slice', {}}, $hr_params->{'changeset_id'} ? $hr_params->{'changeset_id'} : ()) || Geoffrey::Exception::Database::throw_sql_handle($!, $s_changeset_sql)
MC/DC0%0/2
$self->dbh->selectall_arrayref($s_changeset_sql, {'Slice', {}}, $hr_params->{'changeset_id'} ? $hr_params->{'changeset_id'} : ()) || Geoffrey::Exception::Database::throw_sql_handle($!, $s_changeset_sql)
$self->dbh->selectall_arrayref($s_changeset_sql, {'Slice', {}}, $hr_params->{'changeset_id'} ? $hr_params->{'changeset_id'} : ())
Geoffrey::Exception::Database::throw_sql_handle($!, $s_changeset_sql)
Truth table0%0/3
A || B
A= $self->dbh->selectall_arrayref($s_changeset_sql, {'Slice', {}}, $hr_params->{'changeset_id'} ? $hr_params->{'changeset_id'} : ())B= Geoffrey::Exception::Database::throw_sql_handle($!, $s_changeset_sql)
| |||||||||||||||||||||||||||||
| 80 | ) || Geoffrey::Exception::Database::throw_sql_handle($!, $s_changeset_sql); | ||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | ▶ | sub _prepare_tables { | ||||||||||||||||||||||||||
|
Subroutine
_prepare_tables: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 84 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 85 | 0 | require Geoffrey::Action::Table; | |||||||||||||||||||||||||||
| 86 | 0 | my $o_action_able = Geoffrey::Action::Table->new(dbh => $self->dbh, converter => $self->converter); | |||||||||||||||||||||||||||
| 87 | 0 | my $hr_params = $self->converter->get_changelog_table_hashref($self->dbh, $self->schema); | |||||||||||||||||||||||||||
| 88 | 0 | ▶ | if ($hr_params) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 0 | $hr_params->{schema} = $self->schema; | |||||||||||||||||||||||||||
| 90 | 0 | Geoffrey::Action::Table->new(dbh => $self->dbh, converter => $self->converter)->add($hr_params); | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | my $o_statement_handle = $self->dbh->prepare($self->converter->select_get_table); | |||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ($self->schema) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | $o_statement_handle->execute($self->schema, $self->_changlog_entries_table_name) or Carp::confess $!; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | else { | ||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $o_statement_handle->execute($self->_changlog_entries_table_name) or Carp::confess $!; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | 0 | $hr_params = $o_statement_handle->fetchrow_hashref; | |||||||||||||||||||||||||||
| 101 | 0 | ▶ | return $hr_params ? undef : $o_action_able->add({ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | name => $self->_changlog_entries_table_name, | ||||||||||||||||||||||||||||
| 103 | columns => $self->_changlog_entries_table, | ||||||||||||||||||||||||||||
| 104 | schema => $self->schema, | ||||||||||||||||||||||||||||
| 105 | }); | ||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub file_extension { return $_[0]->{file_extension}; } | ||||||||||||||||||||||||||
|
Subroutine
file_extension: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | sub _get_changeset_entries { | ||||||||||||||||||||||||||
|
Subroutine
_get_changeset_entries: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 111 | 0 | my ($self, $hr_unhandeled_changelog) = @_; | |||||||||||||||||||||||||||
| 112 | 0 | ▶ | my $s_table_name = ($self->schema ? $self->schema . q/./ : q//) . $self->_changlog_entries_table_name; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 0 | my $s_entries_sql = $self->_sql_abstract->select($s_table_name, qw/*/, {geoffrey_changelog => {'=', '?'}}); | |||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my $ar_entries = $self->dbh->selectall_arrayref($s_entries_sql, {Slice => {}}, ($hr_unhandeled_changelog->{ID})) | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->dbh->selectall_arrayref($s_entries_sql, {'Slice', {}}, $hr_unhandeled_changelog->{'ID'}) || Geoffrey::Exception::Database::throw_sql_handle($!, $s_entries_sql)
MC/DC0%0/2
$self->dbh->selectall_arrayref($s_entries_sql, {'Slice', {}}, $hr_unhandeled_changelog->{'ID'}) || Geoffrey::Exception::Database::throw_sql_handle($!, $s_entries_sql)
$self->dbh->selectall_arrayref($s_entries_sql, {'Slice', {}}, $hr_unhandeled_changelog->{'ID'})
Geoffrey::Exception::Database::throw_sql_handle($!, $s_entries_sql)
Truth table0%0/3
A || B
A= $self->dbh->selectall_arrayref($s_entries_sql, {'Slice', {}}, $hr_unhandeled_changelog->{'ID'})B= Geoffrey::Exception::Database::throw_sql_handle($!, $s_entries_sql)
| |||||||||||||||||||||||||||||
| 116 | || Geoffrey::Exception::Database::throw_sql_handle($!, $s_entries_sql); | ||||||||||||||||||||||||||||
| 117 | 0 | return $ar_entries; | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub load { | ||||||||||||||||||||||||||
|
Subroutine
load: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 121 | 0 | my ($self, $s_changeset_id) = @_; | |||||||||||||||||||||||||||
| 122 | 0 | ▶ | my $ar_changesets = $self->_get_changesets($s_changeset_id ? ({changeset_id => $s_changeset_id}) : ()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 0 | $_->{entries} = $self->_get_changeset_entries($_) for @{$ar_changesets}; | |||||||||||||||||||||||||||
| 124 | 0 | require Geoffrey::Utils; | |||||||||||||||||||||||||||
| 125 | 0 | Geoffrey::Utils::to_lowercase($_) for @{$ar_changesets}; | |||||||||||||||||||||||||||
| 126 | 0 | ▶ | return ($s_changeset_id && scalar @{$ar_changesets} == 1) ? $ar_changesets->[0] : $ar_changesets; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$s_changeset_id and scalar @{$ar_changesets;} == 1
MC/DC0%0/2
$s_changeset_id and scalar @{$ar_changesets;} == 1
$s_changeset_id
scalar @{$ar_changesets;} == 1
Truth table0%0/3
A and B
A= $s_changeset_idB= scalar @{$ar_changesets;} == 1
| |||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | ▶ | sub load_changeset { | ||||||||||||||||||||||||||
|
Subroutine
load_changeset: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 131 | 0 | my ($self, $s_changeset_id) = @_; | |||||||||||||||||||||||||||
| 132 | 0 | my $ar_changesets = $self->_get_changesets({changeset_id => $s_changeset_id}); | |||||||||||||||||||||||||||
| 133 | 0 | $_->{entries} = $self->_get_changeset_entries($_) for @{$ar_changesets}; | |||||||||||||||||||||||||||
| 134 | 0 | require Geoffrey::Utils; | |||||||||||||||||||||||||||
| 135 | 0 | Geoffrey::Utils::to_lowercase($_) for @{$ar_changesets}; | |||||||||||||||||||||||||||
| 136 | 0 | ▶ | return ($s_changeset_id && scalar @{$ar_changesets} == 1) ? $ar_changesets->[0] : $ar_changesets; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$s_changeset_id and scalar @{$ar_changesets;} == 1
MC/DC0%0/2
$s_changeset_id and scalar @{$ar_changesets;} == 1
$s_changeset_id
scalar @{$ar_changesets;} == 1
Truth table0%0/3
A and B
A= $s_changeset_idB= scalar @{$ar_changesets;} == 1
| |||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub write { | ||||||||||||||||||||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 140 | 0 | my ($self, $s_file, $ur_data) = @_; | |||||||||||||||||||||||||||
| 141 | 0 | return shift->insert(@_); | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 145 | 0 | my ($self, $s_changeset_id) = @_; | |||||||||||||||||||||||||||
| 146 | 0 | my $ar_changesets = $self->_get_changesets({changeset_id => $s_changeset_id, not_executed => 1}); | |||||||||||||||||||||||||||
| 147 | 0 | ▶ | return unless scalar @{$ar_changesets}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 0 | my @a_statements = (); | |||||||||||||||||||||||||||
| 149 | 0 | push @a_statements, | |||||||||||||||||||||||||||
| 150 | $self->_action_entry->drop({ | ||||||||||||||||||||||||||||
| 151 | schema => $self->schema, | ||||||||||||||||||||||||||||
| 152 | table => $self->_changlog_entries_table_name, | ||||||||||||||||||||||||||||
| 153 | conditions => {geoffrey_changelog => $s_changeset_id,}}); | ||||||||||||||||||||||||||||
| 154 | 0 | push @a_statements, | |||||||||||||||||||||||||||
| 155 | $self->_action_entry->drop( | ||||||||||||||||||||||||||||
| 156 | {schema => $self->schema, table => $self->geoffrey_changelogs, conditions => {id => $s_changeset_id,}}); | ||||||||||||||||||||||||||||
| 157 | 0 | return \@a_statements; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub insert { | ||||||||||||||||||||||||||
|
Subroutine
insert: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||
| 161 | 0 | my ($self, $s_file, $ur_data) = @_; | |||||||||||||||||||||||||||
| 162 | 0 | $self->_prepare_tables; | |||||||||||||||||||||||||||
| 163 | 0 | require Ref::Util; | |||||||||||||||||||||||||||
| 164 | 0 | ▶ | return $self->{generated_sql} if Ref::Util::is_hashref($ur_data); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | for my $hr_changeset (@{$ur_data}) { | |||||||||||||||||||||||||||
| 166 | 0 | ▶ | next unless (exists $hr_changeset->{id}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | ▶ | next unless scalar @{$hr_changeset->{entries}}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | push( | ||||||||||||||||||||||||||||
| 170 | 0 | ▶ | @{$self->{generated_sql}}, | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 171 | $self->_action_entry->add({ | ||||||||||||||||||||||||||||
| 172 | schema => $self->schema, | ||||||||||||||||||||||||||||
| 173 | table => $self->geoffrey_changelogs, | ||||||||||||||||||||||||||||
| 174 | values => [{ | ||||||||||||||||||||||||||||
| 175 | id => $hr_changeset->{id}, | ||||||||||||||||||||||||||||
| 176 | filename => __PACKAGE__ . '::' . __LINE__, | ||||||||||||||||||||||||||||
| 177 | created_by => $hr_changeset->{created_by} ? $hr_changeset->{created_by} | ||||||||||||||||||||||||||||
| 178 | : $hr_changeset->{author} ? $hr_changeset->{author} | ||||||||||||||||||||||||||||
| 179 | : undef, | ||||||||||||||||||||||||||||
| 180 | geoffrey_version => $Geoffrey::Changelog::Database::VERSION, | ||||||||||||||||||||||||||||
| 181 | 0 | ($hr_changeset->{comment} ? (comment => $hr_changeset->{comment}) : ()), | |||||||||||||||||||||||||||
| 182 | }]})); | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | for my $hr_entry (@{$hr_changeset->{entries}}) { | |||||||||||||||||||||||||||
| 185 | push( | ||||||||||||||||||||||||||||
| 186 | 0 | ▶ | @{$self->{generated_sql}}, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | $self->_action_entry->add({ | ||||||||||||||||||||||||||||
| 188 | schema => $self->schema, | ||||||||||||||||||||||||||||
| 189 | table => $self->_changlog_entries_table_name, | ||||||||||||||||||||||||||||
| 190 | values => [{ | ||||||||||||||||||||||||||||
| 191 | geoffrey_changelog => $hr_changeset->{id}, | ||||||||||||||||||||||||||||
| 192 | action => $hr_entry->{action}, | ||||||||||||||||||||||||||||
| 193 | name => $hr_entry->{entry_name}, | ||||||||||||||||||||||||||||
| 194 | 0 | (exists $hr_entry->{as} ? (plain_sql => $hr_entry->{as}) : ()), | |||||||||||||||||||||||||||
| 195 | }]})); | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | 0 | return $self->{generated_sql}; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | ## GETTER / SETTER | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub schema { | ||||||||||||||||||||||||||
|
Subroutine
schema: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 204 | 0 | my ($self, $s_schema) = @_; | |||||||||||||||||||||||||||
| 205 | 0 | ▶ | $self->{schema} = $s_schema if $s_schema; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | return $self->{schema}; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub converter { | ||||||||||||||||||||||||||
|
Subroutine
converter: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 210 | 0 | my ($self, $o_converter) = @_; | |||||||||||||||||||||||||||
| 211 | 0 | ▶ | $self->{converter} = $o_converter if $o_converter; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 0 | return $self->{converter}; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | sub dbh { | ||||||||||||||||||||||||||
|
Subroutine
dbh: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 216 | 0 | my ($self, $o_dbh) = @_; | |||||||||||||||||||||||||||
| 217 | 0 | ▶ | $self->{dbh} = $o_dbh if $o_dbh; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | 0 | return $self->{dbh}; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub geoffrey_changelogs { | ||||||||||||||||||||||||||
|
Subroutine
geoffrey_changelogs: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 222 | 0 | my ($self, $s_geoffrey_changelogs) = @_; | |||||||||||||||||||||||||||
| 223 | 0 | ▶ | $self->{geoffrey_changelogs} = $s_geoffrey_changelogs if $s_geoffrey_changelogs; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 224 | 0 | ▶ | $self->{geoffrey_changelogs} //= 'geoffrey_changelogs'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"geoffrey_changelogs"} //= "geoffrey_changelogs"
MC/DC0%0/1
$self->{"geoffrey_changelogs"} //= "geoffrey_changelogs"
$self->{"geoffrey_changelogs"}
Truth table0%0/2
A
A= $self->{"geoffrey_changelogs"}
| |||||||||||||||||||||||||||||
| 225 | 0 | return $self->{geoffrey_changelogs}; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | ## END GETTER / SETTER | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | 2 | 1; # End of Geoffrey::Changelog | |||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | __END__ | ||||||||||||||||||||||||||||