| 1 | package Geoffrey::Action::Entry; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 3 | ▶ | use utf8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 3 | $Geoffrey::Action::Entry::VERSION = '0.000206'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 3 | ▶ | use parent 'Geoffrey::Role::Action'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 9 | ▶ | sub _get_sql_abstract { | ||||||||||||||||||
|
Subroutine
_get_sql_abstract: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 12 | 9 | my ($self) = @_; | |||||||||||||||||||
| 13 | 9 | require SQL::Abstract; | |||||||||||||||||||
| 14 | 9 | ▶ | $self->{sql_abstract} //= SQL::Abstract->new; | ||||||||||||||||||
|
Condition66%2/3
$self->{"sql_abstract"} //= "SQL::Abstract"->new
MC/DC0%0/2
$self->{"sql_abstract"} //= "SQL::Abstract"->new
$self->{"sql_abstract"}
"SQL::Abstract"->new
Truth table66%2/3
A //= B
A= $self->{"sql_abstract"}B= "SQL::Abstract"->new
| |||||||||||||||||||||
| 15 | 9 | return $self->{sql_abstract}; | |||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 10 | ▶ | sub add { | ||||||||||||||||||
|
Subroutine
add: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 19 | 10 | my ( $self, $hr_params ) = @_; | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 10 | ▶ | if ( !$hr_params->{table} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 22 | 2 | require Geoffrey::Exception::RequiredValue; | |||||||||||||||||||
| 23 | 2 | Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::add' ); | |||||||||||||||||||
| 24 | } | ||||||||||||||||||||
| 25 | 8 | ▶ | if ( !$hr_params->{values} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 1 | require Geoffrey::Exception::RequiredValue; | |||||||||||||||||||
| 27 | 1 | Geoffrey::Exception::RequiredValue::throw_values( __PACKAGE__ . '::add' ); | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | my ( $s_stmt, @a_bindings ) = $self->_get_sql_abstract->insert( | ||||||||||||||||||||
| 31 | ( $hr_params->{schema} ? $hr_params->{schema} . q/./ : q// ) . $hr_params->{table}, | ||||||||||||||||||||
| 32 | 7 | ▶ | $hr_params->{values}->[0], | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 7 | return $self->do_prepared( $s_stmt, \@a_bindings ); | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 4 | ▶ | sub alter { | ||||||||||||||||||
|
Subroutine
alter: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 39 | 4 | my ( $self, $s_table_name, $hr_where, $ar_values ) = @_; | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 4 | ▶ | if ( !$s_table_name ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 42 | 1 | require Geoffrey::Exception::RequiredValue; | |||||||||||||||||||
| 43 | 1 | Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::alter' ); | |||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 3 | ▶ | if ( !$hr_where ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 47 | 2 | require Geoffrey::Exception::RequiredValue; | |||||||||||||||||||
| 48 | 2 | Geoffrey::Exception::RequiredValue::throw_where_clause( __PACKAGE__ . '::alter' ); | |||||||||||||||||||
| 49 | } | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 1 | my ( $s_stmt, @a_bindings ) = $self->_get_sql_abstract->update( $s_table_name, $ar_values->[0], $hr_where ); | |||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 1 | return $self->do_prepared( $s_stmt, \@a_bindings ); | |||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 2 | ▶ | sub drop { | ||||||||||||||||||
|
Subroutine
drop: called CC=4 SCAR=14.6
Pod
documented
| |||||||||||||||||||||
| 57 | 2 | my ( $self, $hr_params ) = @_; | |||||||||||||||||||
| 58 | 2 | ▶ | if ( !$hr_params->{table} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 59 | 1 | require Geoffrey::Exception::RequiredValue; | |||||||||||||||||||
| 60 | 1 | Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::drop' ); | |||||||||||||||||||
| 61 | } | ||||||||||||||||||||
| 62 | 1 | ▶ | if ( !$hr_params->{conditions} ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 63 | 0 | require Geoffrey::Exception::RequiredValue; | |||||||||||||||||||
| 64 | 0 | Geoffrey::Exception::RequiredValue::throw_where_clause( __PACKAGE__ . '::drop' ); | |||||||||||||||||||
| 65 | } | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | my ( $s_stmt, @a_bindings ) = $self->_get_sql_abstract->delete( | ||||||||||||||||||||
| 68 | ( $hr_params->{schema} ? $hr_params->{schema} . q/./ : q// ) . $hr_params->{table}, | ||||||||||||||||||||
| 69 | $hr_params->{conditions}, | ||||||||||||||||||||
| 70 | 1 | ▶ | ); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 71 | 1 | return $self->do_prepared( $s_stmt, \@a_bindings ); | |||||||||||||||||||
| 72 | } | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 3 | 1; | |||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | __END__ | ||||||||||||||||||||