| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::Changeset::History; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
32561
|
use warnings; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
161
|
|
|
4
|
4
|
|
|
4
|
|
21
|
use strict; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
190
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
23
|
use base qw/DBIx::Changeset/; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
1843
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
26005
|
use Exception::Class::DBI; |
|
|
4
|
|
|
|
|
13761
|
|
|
|
4
|
|
|
|
|
134
|
|
|
9
|
4
|
|
|
4
|
|
2326
|
use DBIx::Changeset::HistoryRecord; |
|
|
4
|
|
|
|
|
15
|
|
|
|
4
|
|
|
|
|
44
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
216
|
use vars qw{$VERSION}; |
|
|
4
|
|
|
|
|
11
|
|
|
|
4
|
|
|
|
|
183
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
|
13
|
4
|
|
|
4
|
|
2559
|
$VERSION = '1.11'; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
DBIx::Changeset::History - Object to query the changeset record log |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Object to query the changeset record log |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Perhaps a little code snippet. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use DBIx::Changeset::History; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $foo = DBIx::Changeset::History->new($opts); |
|
29
|
|
|
|
|
|
|
... |
|
30
|
|
|
|
|
|
|
$foo->retrieve_all(); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my @ATTRS = qw/dbh records current_index pb/; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(@ATTRS); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 METHODS |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 new |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
|
46
|
|
|
|
|
|
|
sub new { |
|
47
|
1
|
|
|
1
|
1
|
4
|
my($proto, $fields) = @_; |
|
48
|
1
|
|
33
|
|
|
9
|
my($class) = ref $proto || $proto; |
|
49
|
|
|
|
|
|
|
|
|
50
|
1
|
50
|
|
|
|
5
|
DBIx::Changeset::Exception::ObjectCreateException->throw(error => 'Missing required db connection fields') unless defined $fields; |
|
51
|
|
|
|
|
|
|
|
|
52
|
1
|
|
|
|
|
6
|
my $self = bless {%$fields}, $class; |
|
53
|
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
12
|
$self->_connect_to_db; |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
0
|
return $self; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 init_history_table |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This method loads the sql for creation of the history table |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
|
64
|
|
|
|
|
|
|
sub init_history_table { |
|
65
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
0
|
$self->_connect_to_db() unless defined $self->dbh(); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
### get the table create query |
|
70
|
0
|
|
|
|
|
0
|
my $q = $self->pb->query('create_changeset_history'); |
|
71
|
|
|
|
|
|
|
### execute it |
|
72
|
0
|
|
|
|
|
0
|
$q->execute(); |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
0
|
$q->finish(); |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
0
|
return; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 retrieve_all |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Get a list of the history records from the database. |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub retrieve_all { |
|
86
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
0
|
$self->_connect_to_db() unless defined $self->dbh(); |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
0
|
my $q = $self->pb()->query('get_all_changeset_history'); |
|
91
|
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
0
|
my @records; |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
0
|
while(my $row = $q->fetchrow_hashref() ) { |
|
95
|
0
|
|
|
|
|
0
|
push @records, $row; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
0
|
$q->finish(); |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
0
|
$self->records(\@records); |
|
101
|
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
0
|
return; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 retrieve |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub retrieve { |
|
110
|
0
|
|
|
0
|
1
|
0
|
my ($self, $uid) = @_; |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
0
|
return; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 next |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
|
118
|
|
|
|
|
|
|
sub next { |
|
119
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
120
|
0
|
0
|
|
|
|
0
|
if ( not defined $self->current_index ) { |
|
121
|
0
|
|
|
|
|
0
|
$self->current_index(0); |
|
122
|
|
|
|
|
|
|
} else { |
|
123
|
0
|
|
|
|
|
0
|
$self->current_index($self->current_index + 1); |
|
124
|
|
|
|
|
|
|
} |
|
125
|
0
|
|
|
|
|
0
|
my $db_entry = $self->records->[$self->current_index]; |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
0
|
my $hrec = DBIx::Changeset::HistoryRecord->new({ |
|
128
|
|
|
|
|
|
|
history_db_dsn => $self->history_db_dsn, |
|
129
|
|
|
|
|
|
|
history_db_user => $self->history_db_user, |
|
130
|
|
|
|
|
|
|
history_db_password => $self->history_db_password, |
|
131
|
0
|
|
|
|
|
0
|
%{$db_entry}, |
|
132
|
|
|
|
|
|
|
}); |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
0
|
return $hrec; |
|
135
|
|
|
|
|
|
|
} |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 add_history_record |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
|
140
|
|
|
|
|
|
|
sub add_history_record { |
|
141
|
0
|
|
|
0
|
1
|
0
|
my ($self,$record) = @_; |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
0
|
my $hrec = DBIx::Changeset::HistoryRecord->new({history_db_dsn => $self->history_db_dsn, history_db_user => $self->history_db_user, history_db_password => $self->history_db_password}); |
|
144
|
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
0
|
$hrec->write($record); |
|
146
|
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
0
|
return $hrec; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 total |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
|
153
|
|
|
|
|
|
|
sub total { |
|
154
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
155
|
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
0
|
return scalar(@{$self->records}); |
|
|
0
|
|
|
|
|
0
|
|
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 reset |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |
|
162
|
|
|
|
|
|
|
sub reset { |
|
163
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
164
|
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
0
|
$self->current_index(undef); |
|
166
|
0
|
|
|
|
|
0
|
return; |
|
167
|
|
|
|
|
|
|
} |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
sub DESTROY { |
|
170
|
1
|
|
|
1
|
|
2076
|
my $self = shift; |
|
171
|
|
|
|
|
|
|
|
|
172
|
1
|
50
|
|
|
|
8
|
if ( defined $self->dbh ) { |
|
173
|
0
|
|
|
|
|
0
|
$self->dbh->disconnect(); |
|
174
|
|
|
|
|
|
|
} |
|
175
|
|
|
|
|
|
|
|
|
176
|
1
|
|
|
|
|
35
|
return; |
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Copyright 2004-2008 Grox Pty Ltd. |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
184
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
The full text of the license can be found in the LICENSE file included with this module. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
1; # End of DBIx::Changeset |