line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Action::Entry; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1389
|
use utf8; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
20
|
|
4
|
3
|
|
|
3
|
|
117
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
60
|
|
5
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
134
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$Geoffrey::Action::Entry::VERSION = '0.000205'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
16
|
use parent 'Geoffrey::Role::Action'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
19
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _get_sql_abstract { |
12
|
9
|
|
|
9
|
|
19
|
my ($self) = @_; |
13
|
9
|
|
|
|
|
809
|
require SQL::Abstract; |
14
|
9
|
|
66
|
|
|
11662
|
$self->{sql_abstract} //= SQL::Abstract->new; |
15
|
9
|
|
|
|
|
230
|
return $self->{sql_abstract}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub add { |
19
|
10
|
|
|
10
|
1
|
4361
|
my ( $self, $hr_params ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
10
|
100
|
|
|
|
35
|
if ( !$hr_params->{table} ) { |
22
|
2
|
|
|
|
|
506
|
require Geoffrey::Exception::RequiredValue; |
23
|
2
|
|
|
|
|
10
|
Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::add' ); |
24
|
|
|
|
|
|
|
} |
25
|
8
|
100
|
|
|
|
22
|
if ( !$hr_params->{values} ) { |
26
|
1
|
|
|
|
|
42
|
require Geoffrey::Exception::RequiredValue; |
27
|
1
|
|
|
|
|
7
|
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
|
50
|
|
|
|
23
|
$hr_params->{values}->[0], |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
7
|
|
|
|
|
3466
|
return $self->do_prepared( $s_stmt, \@a_bindings ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub alter { |
39
|
4
|
|
|
4
|
1
|
107
|
my ( $self, $s_table_name, $hr_where, $ar_values ) = @_; |
40
|
|
|
|
|
|
|
|
41
|
4
|
100
|
|
|
|
47
|
if ( !$s_table_name ) { |
42
|
1
|
|
|
|
|
6
|
require Geoffrey::Exception::RequiredValue; |
43
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::alter' ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
3
|
100
|
|
|
|
12
|
if ( !$hr_where ) { |
47
|
2
|
|
|
|
|
15
|
require Geoffrey::Exception::RequiredValue; |
48
|
2
|
|
|
|
|
10
|
Geoffrey::Exception::RequiredValue::throw_where_clause( __PACKAGE__ . '::alter' ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
4
|
my ( $s_stmt, @a_bindings ) = $self->_get_sql_abstract->update( $s_table_name, $ar_values->[0], $hr_where ); |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
373
|
return $self->do_prepared( $s_stmt, \@a_bindings ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub drop { |
57
|
2
|
|
|
2
|
1
|
48
|
my ( $self, $hr_params ) = @_; |
58
|
2
|
100
|
|
|
|
8
|
if ( !$hr_params->{table} ) { |
59
|
1
|
|
|
|
|
7
|
require Geoffrey::Exception::RequiredValue; |
60
|
1
|
|
|
|
|
6
|
Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::drop' ); |
61
|
|
|
|
|
|
|
} |
62
|
1
|
50
|
|
|
|
4
|
if ( !$hr_params->{conditions} ) { |
63
|
0
|
|
|
|
|
0
|
require Geoffrey::Exception::RequiredValue; |
64
|
0
|
|
|
|
|
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
|
50
|
|
|
|
4
|
); |
71
|
1
|
|
|
|
|
210
|
return $self->do_prepared( $s_stmt, \@a_bindings ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |