line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geoffrey::Action::Entry; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1500
|
use utf8; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
21
|
|
4
|
3
|
|
|
3
|
|
103
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
62
|
|
5
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
162
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$Geoffrey::Action::Entry::VERSION = '0.000204'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
19
|
use parent 'Geoffrey::Role::Action'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
19
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _get_sql_abstract { |
12
|
9
|
|
|
9
|
|
22
|
my ($self) = @_; |
13
|
9
|
|
|
|
|
834
|
require SQL::Abstract; |
14
|
9
|
|
66
|
|
|
11285
|
$self->{sql_abstract} //= SQL::Abstract->new; |
15
|
9
|
|
|
|
|
246
|
return $self->{sql_abstract}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub add { |
19
|
10
|
|
|
10
|
1
|
4406
|
my ( $self, $hr_params ) = @_; |
20
|
|
|
|
|
|
|
|
21
|
10
|
100
|
|
|
|
36
|
if ( !$hr_params->{table} ) { |
22
|
2
|
|
|
|
|
517
|
require Geoffrey::Exception::RequiredValue; |
23
|
2
|
|
|
|
|
12
|
Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::add' ); |
24
|
|
|
|
|
|
|
} |
25
|
8
|
100
|
|
|
|
31
|
if ( !$hr_params->{values} ) { |
26
|
1
|
|
|
|
|
48
|
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
|
|
|
|
30
|
$hr_params->{values}->[0], |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
7
|
|
|
|
|
3656
|
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
|
|
|
|
12
|
if ( !$s_table_name ) { |
42
|
1
|
|
|
|
|
7
|
require Geoffrey::Exception::RequiredValue; |
43
|
1
|
|
|
|
|
9
|
Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::alter' ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
3
|
100
|
|
|
|
11
|
if ( !$hr_where ) { |
47
|
2
|
|
|
|
|
11
|
require Geoffrey::Exception::RequiredValue; |
48
|
2
|
|
|
|
|
13
|
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
|
|
|
|
|
379
|
return $self->do_prepared( $s_stmt, \@a_bindings ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub drop { |
57
|
2
|
|
|
2
|
1
|
49
|
my ( $self, $hr_params ) = @_; |
58
|
2
|
100
|
|
|
|
7
|
if ( !$hr_params->{table} ) { |
59
|
1
|
|
|
|
|
7
|
require Geoffrey::Exception::RequiredValue; |
60
|
1
|
|
|
|
|
5
|
Geoffrey::Exception::RequiredValue::throw_table_name( __PACKAGE__ . '::drop' ); |
61
|
|
|
|
|
|
|
} |
62
|
1
|
50
|
|
|
|
5
|
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
|
|
|
|
3
|
); |
71
|
1
|
|
|
|
|
212
|
return $self->do_prepared( $s_stmt, \@a_bindings ); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |