| 1 | package Geoffrey::Action::Constraint::Default; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use utf8; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use 5.016; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 4 | ▶ | use Geoffrey::Utils; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | ▶ | use Geoffrey::Exception::NotSupportedException; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | |||||||||||||
| 10 | 4 | ▶ | use parent 'Geoffrey::Role::Action'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | |||||||||||||
| 12 | 4 | $Geoffrey::Action::Constraint::Default::VERSION = '0.000206'; | |||||||||||
| 13 | |||||||||||||
| 14 | 3 | ▶ | sub add { | ||||||||||
|
Subroutine
add: called CC=4 SCAR=18.5
Pod
documented
| |||||||||||||
| 15 | 3 | my ($self, $params) = @_; | |||||||||||
| 16 | 3 | ▶ | Geoffrey::Exception::RequiredValue::throw_table_name() if !$params->{table}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 17 | 2 | my $sequence = $self->converter->sequence; | |||||||||||
| 18 | 1 | ▶ | if (!$sequence->can('nextval')) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 19 | 1 | Geoffrey::Exception::NotSupportedException::throw_sequence('nextval', $self->converter); | |||||||||||
| 20 | } | ||||||||||||
| 21 | |||||||||||||
| 22 | 0 | my $s_table = $params->{table} =~ s/"//gr; | |||||||||||
| 23 | 0 | $params->{name} =~ s/"//g; | |||||||||||
| 24 | 0 | ▶ | $params->{name} //= qq~seq_$s_table~ . q/_/ . time; | ||||||||||
|
Condition0%0/2
$params->{"name"} //= "seq_$s_table" . '_' . time
MC/DC0%0/1
$params->{"name"} //= "seq_$s_table" . '_' . time
$params->{"name"}
Truth table0%0/2
A
A= $params->{"name"}
| |||||||||||||
| 25 | my $sql = Geoffrey::Utils::replace_spare($sequence->add, | ||||||||||||
| 26 | 0 | [$params->{name}, 1, 1, $Geoffrey::Utils::INT_64BIT_SIGNED, 1, 1]); | |||||||||||
| 27 | 0 | $self->do($sql); | |||||||||||
| 28 | 0 | return Geoffrey::Utils::replace_spare($sequence->nextval, [$params->{name}]); | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 3 | ▶ | sub drop { | ||||||||||
|
Subroutine
drop: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||
| 32 | 3 | my ($self, $name) = @_; | |||||||||||
| 33 | 3 | my $sequence = $self->converter->sequence; | |||||||||||
| 34 | 1 | ▶ | if (!$sequence->can('drop')) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | Geoffrey::Exception::NotSupportedException::throw_sequence('drop', $self->converter); | |||||||||||
| 36 | } | ||||||||||||
| 37 | 1 | return $self->do(Geoffrey::Utils::replace_spare($sequence->drop, [$name])); | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | 3 | ▶ | sub list_from_schema { | ||||||||||
|
Subroutine
list_from_schema: called CC=2 SCAR=12.4
Pod
documented
| |||||||||||||
| 41 | 3 | my ($self, $schema) = @_; | |||||||||||
| 42 | 3 | my $sequence = $self->converter->sequence; | |||||||||||
| 43 | 0 | ▶ | if (!$sequence->can('list')) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 44 | 0 | Geoffrey::Exception::NotSupportedException::throw_sequence('list', $self->converter); | |||||||||||
| 45 | } | ||||||||||||
| 46 | 0 | return $self->converter->sequence_information($self->do_arrayref($sequence->list($schema), [])); | |||||||||||
| 47 | } | ||||||||||||
| 48 | |||||||||||||
| 49 | 4 | 1; | |||||||||||
| 50 | |||||||||||||
| 51 | __END__ | ||||||||||||