line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Action::Constraint::Default; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
707
|
use utf8; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
27
|
|
4
|
4
|
|
|
4
|
|
161
|
use 5.016; |
|
4
|
|
|
|
|
19
|
|
5
|
4
|
|
|
4
|
|
19
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
80
|
|
6
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
110
|
|
7
|
4
|
|
|
4
|
|
451
|
use Geoffrey::Utils; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
139
|
|
8
|
4
|
|
|
4
|
|
25
|
use Geoffrey::Exception::NotSupportedException; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
98
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
20
|
use parent 'Geoffrey::Role::Action'; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
31
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$Geoffrey::Action::Constraint::Default::VERSION = '0.000204'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub add { |
15
|
3
|
|
|
3
|
1
|
57
|
my ($self, $params) = @_; |
16
|
3
|
100
|
|
|
|
16
|
Geoffrey::Exception::RequiredValue::throw_table_name() if !$params->{table}; |
17
|
2
|
|
|
|
|
8
|
my $sequence = $self->converter->sequence; |
18
|
1
|
50
|
|
|
|
8
|
if (!$sequence->can('nextval')) { |
19
|
1
|
|
|
|
|
15
|
Geoffrey::Exception::NotSupportedException::throw_sequence('nextval', $self->converter); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
my $s_table = $params->{table} =~ s/"//gr; |
23
|
0
|
|
|
|
|
0
|
$params->{name} =~ s/"//g; |
24
|
0
|
|
0
|
|
|
0
|
$params->{name} //= qq~seq_$s_table~ . q/_/ . time; |
25
|
|
|
|
|
|
|
my $sql = Geoffrey::Utils::replace_spare($sequence->add, |
26
|
0
|
|
|
|
|
0
|
[$params->{name}, 1, 1, $Geoffrey::Utils::INT_64BIT_SIGNED, 1, 1]); |
27
|
0
|
|
|
|
|
0
|
$self->do($sql); |
28
|
0
|
|
|
|
|
0
|
return Geoffrey::Utils::replace_spare($sequence->nextval, [$params->{name}]); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub drop { |
32
|
3
|
|
|
3
|
1
|
3557
|
my ($self, $name) = @_; |
33
|
3
|
|
|
|
|
11
|
my $sequence = $self->converter->sequence; |
34
|
1
|
50
|
|
|
|
8
|
if (!$sequence->can('drop')) { |
35
|
0
|
|
|
|
|
0
|
Geoffrey::Exception::NotSupportedException::throw_sequence('drop', $self->converter); |
36
|
|
|
|
|
|
|
} |
37
|
1
|
|
|
|
|
6
|
return $self->do(Geoffrey::Utils::replace_spare($sequence->drop, [$name])); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub list_from_schema { |
41
|
3
|
|
|
3
|
1
|
1837
|
my ($self, $schema) = @_; |
42
|
3
|
|
|
|
|
19
|
my $sequence = $self->converter->sequence; |
43
|
0
|
0
|
|
|
|
|
if (!$sequence->can('list')) { |
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
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |