line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Schema::Changelog::Action::Entry; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
DBIx::Schema::Changelog::Action::Sql - Action to insert change or delete entries from tables |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Version 0.7.1 |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.7.1'; |
14
|
|
|
|
|
|
|
|
15
|
5
|
|
|
5
|
|
21
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
183
|
|
16
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
136
|
|
17
|
5
|
|
|
5
|
|
18
|
use Moose; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
34
|
|
18
|
5
|
|
|
5
|
|
29285
|
use SQL::Abstract; |
|
5
|
|
|
|
|
45061
|
|
|
5
|
|
|
|
|
324
|
|
19
|
5
|
|
|
5
|
|
40
|
use Data::Dumper; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
1442
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
with 'DBIx::Schema::Changelog::Action'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has sql_abstract => ( |
24
|
|
|
|
|
|
|
is => 'ro', |
25
|
|
|
|
|
|
|
lazy => 1, |
26
|
|
|
|
|
|
|
isa => 'SQL::Abstract', |
27
|
|
|
|
|
|
|
default => sub { SQL::Abstract->new( array_datatypes => 1 ) }, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=over 4 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=item add |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Insert entry into table |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub add { |
41
|
0
|
|
|
0
|
1
|
|
my ( $self, $params ) = @_; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#'add' => [ |
44
|
|
|
|
|
|
|
# [ 'Euro', 'cent', 3, 'EUR', 'â¬' ], |
45
|
|
|
|
|
|
|
# [ 'Dollar', 'Cent', 3, 'USD', '$' ], |
46
|
|
|
|
|
|
|
# [ 'Swiss fran', 'Rappen', 2, 'CHF', 'CHF' ] |
47
|
|
|
|
|
|
|
#] |
48
|
0
|
|
|
|
|
|
my %data = map { $_ => 1 } @{ $params->{cols} }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my ( $stmt, @bind ) = |
50
|
|
|
|
|
|
|
$self->sql_abstract()->insert( $params->{name}, \%data ); |
51
|
0
|
|
|
|
|
|
my $pp = $self->dbh()->prepare($stmt); |
52
|
0
|
|
|
|
|
|
$pp->execute(@$_) foreach @{ $params->{add} } |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item alter |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Change values from entry in table |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub alter { |
62
|
0
|
|
|
0
|
1
|
|
my ( $self, $params ) = @_; |
63
|
0
|
|
|
|
|
|
print Dumper($params); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item drop |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Delete entry from table |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub drop { |
73
|
0
|
|
|
0
|
1
|
|
my ( $self, $params ) = @_; |
74
|
0
|
|
|
|
|
|
print Dumper($params); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
5
|
|
|
5
|
|
29
|
no Moose; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
48
|
|
78
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Mario Zieschang, C<< <mario.zieschang at combase.de> >> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Copyright 2015 Mario Zieschang. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
95
|
|
|
|
|
|
|
under the terms of the the Artistic License (2.0). You may obtain a |
96
|
|
|
|
|
|
|
copy of the full license at: |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
L<http://www.perlfoundation.org/artistic_license_2_0> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified |
101
|
|
|
|
|
|
|
Versions is governed by this Artistic License. By using, modifying or |
102
|
|
|
|
|
|
|
distributing the Package, you accept this license. Do not use, modify, |
103
|
|
|
|
|
|
|
or distribute the Package, if you do not accept this license. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made |
106
|
|
|
|
|
|
|
by someone other than you, you are nevertheless required to ensure that |
107
|
|
|
|
|
|
|
your Modified Version complies with the requirements of this license. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service |
110
|
|
|
|
|
|
|
mark, trade name, or logo of the Copyright Holder. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge |
113
|
|
|
|
|
|
|
patent license to make, have made, use, offer to sell, sell, import and |
114
|
|
|
|
|
|
|
otherwise transfer the Package with respect to any patent claims |
115
|
|
|
|
|
|
|
licensable by the Copyright Holder that are necessarily infringed by the |
116
|
|
|
|
|
|
|
Package. If you institute patent litigation (including a cross-claim or |
117
|
|
|
|
|
|
|
counterclaim) against any party alleging that the Package constitutes |
118
|
|
|
|
|
|
|
direct or contributory patent infringement, then this Artistic License |
119
|
|
|
|
|
|
|
to you shall terminate on the date that such litigation is filed. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER |
122
|
|
|
|
|
|
|
AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. |
123
|
|
|
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANT ABILITY, FITNESS FOR A PARTICULAR |
124
|
|
|
|
|
|
|
PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY |
125
|
|
|
|
|
|
|
YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR |
126
|
|
|
|
|
|
|
CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR |
127
|
|
|
|
|
|
|
CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, |
128
|
|
|
|
|
|
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |