line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package IMDB::Local::DB::BaseObject; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
11
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
6
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
13
|
|
7
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
80
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
IMDB::Local::DB::BaseObject - handy wrapper for objects from the database |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Version 0.01 |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=cut |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 new |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
1
|
|
271
|
use IMDB::Local::DB::BaseObjectAccessor; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
31
|
1
|
|
|
1
|
|
23
|
use base qw(IMDB::Local::DB::BaseObjectAccessor); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
58
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use Class::MethodMaker |
34
|
1
|
|
|
|
|
9
|
[ scalar=> [qw/imdbdb db_table db_key db_key2 db_key3/], |
35
|
1
|
|
|
1
|
|
4
|
]; |
|
1
|
|
|
|
|
0
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub initHandle |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
0
|
|
my ($self, $table, @keys)=@_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#print STDERR "init $self, $table, $keys[0]\n"; |
42
|
|
|
|
|
|
|
# if no imdbdb handle was given in new() call, then use last handle created |
43
|
0
|
0
|
|
|
|
|
if ( !defined($self->imdbdb) ) { |
44
|
0
|
|
|
|
|
|
carp "imdbdb handle missing"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ( !defined($self->imdbdb->column_info($table)) ) { |
48
|
0
|
|
|
|
|
|
die "unable to locate table $table"; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->db_table($table); |
52
|
0
|
|
|
|
|
|
$self->db_key($keys[0]); |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if ( scalar(@keys) > 1 ) { |
55
|
0
|
|
|
|
|
|
$self->db_key2($keys[1]); |
56
|
0
|
0
|
|
|
|
|
if ( scalar(@keys) > 2 ) { |
57
|
0
|
|
|
|
|
|
$self->db_key3($keys[2]); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
if ( !$self->db_columns_count() ) { |
62
|
0
|
|
|
|
|
|
$self->db_columns_reset(); |
63
|
0
|
|
|
|
|
|
for my $t (@{$self->imdbdb->column_info($table)}) { |
|
0
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
if ( $self->can('db_ignoredColumns') ) { |
65
|
0
|
|
|
|
|
|
my $ignore=0; |
66
|
0
|
|
|
|
|
|
for my $k ($self->db_ignoredColumns) { |
67
|
0
|
0
|
|
|
|
|
if ( $k eq $t->{COLUMN_NAME} ) { |
68
|
0
|
|
|
|
|
|
$ignore=1; |
69
|
0
|
|
|
|
|
|
last; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
0
|
0
|
|
|
|
|
next if ( $ignore ); |
73
|
|
|
|
|
|
|
} |
74
|
0
|
|
|
|
|
|
$self->db_columns_push($t->{COLUMN_NAME}); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
0
|
|
|
|
|
|
$self->add_accessors($self->db_columns); |
78
|
0
|
|
|
|
|
|
return; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _add_accessors |
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
0
|
|
|
my $self=shift; |
84
|
0
|
|
|
|
|
|
for (@_) { |
85
|
0
|
|
|
|
|
|
carp("added $_"); |
86
|
|
|
|
|
|
|
} |
87
|
0
|
|
|
|
|
|
$self->SUPER::add_accessors(@_); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub populate($$) |
91
|
|
|
|
|
|
|
{ |
92
|
0
|
|
|
0
|
0
|
|
my ($self, $hash)=@_; |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
for my $k (keys %$hash) { |
95
|
|
|
|
|
|
|
#print "setting $k:".$hash->{$k}."\n"; |
96
|
0
|
|
|
|
|
|
$self->set($k, $hash->{$k}); |
97
|
|
|
|
|
|
|
} |
98
|
0
|
|
|
|
|
|
return(1); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub populateUsingKeys |
102
|
|
|
|
|
|
|
{ |
103
|
0
|
|
|
0
|
0
|
|
my ($self, @keys)=@_; |
104
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
if ( !defined($self->db_key) ) { |
106
|
0
|
|
|
|
|
|
die "invalid usage, missing db_key for $self"; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
0
|
0
|
|
|
|
|
if ( !@keys ) { |
110
|
0
|
|
|
|
|
|
die "no key(s)"; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key2) ) { |
114
|
0
|
0
|
|
|
|
|
if ( scalar(@keys) < 2 ) { |
115
|
0
|
|
|
|
|
|
carp "new called without ".$self->db_key2()." value given"; |
116
|
|
|
|
|
|
|
} |
117
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key3) ) { |
118
|
0
|
0
|
|
|
|
|
if ( scalar(@keys) < 3 ) { |
119
|
0
|
|
|
|
|
|
carp "new called without ".$self->db_key3()." value given"; |
120
|
|
|
|
|
|
|
} |
121
|
0
|
|
|
|
|
|
$self->populateFromColumns(sprintf("%s='%s' AND %s='%s'", $self->db_key, $keys[0], $self->db_key2, $keys[1], $self->db_key3, $keys[2])); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
else { |
124
|
0
|
|
|
|
|
|
$self->populateFromColumns(sprintf("%s='%s' AND %s='%s'", $self->db_key, $keys[0], $self->db_key2, $keys[1])); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
else { |
128
|
0
|
|
|
|
|
|
$self->populateFromColumns(sprintf("%s='%s'", $self->db_key, $keys[0])); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub populateUsingKey($$) |
133
|
|
|
|
|
|
|
{ |
134
|
0
|
|
|
0
|
0
|
|
my ($self, $key)=@_; |
135
|
0
|
|
|
|
|
|
return $self->populateUsingKeys($key); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub populateFromColumns($$) |
139
|
|
|
|
|
|
|
{ |
140
|
0
|
|
|
0
|
0
|
|
my ($self, $where)=@_; |
141
|
|
|
|
|
|
|
|
142
|
0
|
0
|
|
|
|
|
if ( !defined($self->db_table) ) { |
143
|
0
|
|
|
|
|
|
die "invalid usage, missing db_table for $self"; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
my $query="SELECT ".join(',', $self->db_columns)." from ".$self->db_table; |
147
|
0
|
0
|
|
|
|
|
if ( defined($where) ) { |
148
|
0
|
|
|
|
|
|
$query.=' WHERE '.$where; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
#print STDERR "populating: $query\n"; |
151
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
my $dbh=$self->imdbdb->dbh(); |
153
|
0
|
|
|
|
|
|
my $ref=$dbh->selectrow_hashref($query); |
154
|
0
|
0
|
|
|
|
|
if ( !$ref ) { |
155
|
0
|
|
|
|
|
|
print STDERR "populating failed on: $query\n"; |
156
|
0
|
|
|
|
|
|
return(undef); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
# if ( $self->can('db_ignoredColumns') ) { |
160
|
|
|
|
|
|
|
# #print STDERR "ignoring columns\n"; |
161
|
|
|
|
|
|
|
# for my $k ($self->db_ignoredColumns) { |
162
|
|
|
|
|
|
|
# if ( $ref->{$k} ) { |
163
|
|
|
|
|
|
|
# #print STDERR "ignoring column $k\n"; |
164
|
|
|
|
|
|
|
# delete($ref->{$k}); |
165
|
|
|
|
|
|
|
# } |
166
|
|
|
|
|
|
|
# } |
167
|
|
|
|
|
|
|
# } |
168
|
|
|
|
|
|
|
#$self->add_accessors(keys %$ref); |
169
|
0
|
|
|
|
|
|
$self->populate($ref); |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub _className($) |
173
|
|
|
|
|
|
|
{ |
174
|
0
|
|
|
0
|
|
|
my ($self)=@_; |
175
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
$self=~m/(IMDB::Local::[^=]+)/o; |
177
|
0
|
|
|
|
|
|
return($1); |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub toText($) |
181
|
|
|
|
|
|
|
{ |
182
|
0
|
|
|
0
|
0
|
|
my ($self)=@_; |
183
|
|
|
|
|
|
|
|
184
|
0
|
|
|
|
|
|
my $text=''; |
185
|
|
|
|
|
|
|
|
186
|
0
|
|
|
|
|
|
$text.="class: ".$self->_className()."\n"; |
187
|
0
|
|
|
|
|
|
if ( 1 ) { |
188
|
0
|
|
|
|
|
|
for my $field (sort $self->get_accessors()) { |
189
|
0
|
|
|
|
|
|
my $v=$self->$field(); |
190
|
0
|
0
|
|
|
|
|
$v='undef' if (!defined($v)); |
191
|
0
|
|
|
|
|
|
$text.="\t$field: $v\n"; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
else { |
195
|
|
|
|
|
|
|
require Data::Dumper; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
my $D=new Data::Dumper([$self]); |
198
|
|
|
|
|
|
|
$D->Indent(1); |
199
|
|
|
|
|
|
|
my $d=$D->Dump(); |
200
|
|
|
|
|
|
|
$d=~s/\n\s*\'__FIELDS__\' => \[[^\]]+\]//ogs; |
201
|
|
|
|
|
|
|
#$d=~s/\'([^\']+)\' => \'([^\']+)\'/$1:$2/ogs; |
202
|
|
|
|
|
|
|
#while ($d=~s/\n /\n /) {}; |
203
|
|
|
|
|
|
|
$text.="$d\n"; |
204
|
|
|
|
|
|
|
} |
205
|
0
|
|
|
|
|
|
return($text); |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub _updateInDB |
209
|
|
|
|
|
|
|
{ |
210
|
0
|
|
|
0
|
|
|
my $self=shift; |
211
|
0
|
|
|
|
|
|
my $args={@_}; |
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
my $stmt="UPDATE ".$self->db_table." SET "; |
214
|
0
|
|
|
|
|
|
for my $key (keys %{$args}) { |
|
0
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
my $value=$args->{$key}; |
216
|
0
|
0
|
|
|
|
|
if ( !defined($value) ) { |
217
|
0
|
|
|
|
|
|
$stmt.="$key=NULL, "; |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
else { |
220
|
0
|
|
|
|
|
|
$stmt.="$key='$value', "; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
} |
223
|
0
|
|
|
|
|
|
$stmt=~s/, $//; |
224
|
|
|
|
|
|
|
|
225
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key2) ) { |
226
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key3) ) { |
227
|
0
|
|
|
|
|
|
$stmt.=sprintf("WHERE %s='%s' AND %s='%s' AND %s='%s'", $self->db_key, $self->get($self->db_key), |
228
|
|
|
|
|
|
|
$self->db_key2, $self->get($self->db_key2), |
229
|
|
|
|
|
|
|
$self->db_key3, $self->get($self->db_key3)); |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
else { |
232
|
0
|
|
|
|
|
|
$stmt.=sprintf("WHERE %s='%s' AND %s='%s'", $self->db_key, $self->get($self->db_key), |
233
|
|
|
|
|
|
|
$self->db_key2, $self->get($self->db_key2)); |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
else { |
237
|
0
|
|
|
|
|
|
$stmt.=sprintf("WHERE %s='%s'", $self->db_key, $self->get($self->db_key)); |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
0
|
|
|
|
|
|
my $dbh=$self->imdbdb->dbh(); |
241
|
|
|
|
|
|
|
#print STDERR "invoking: args=".$args."\n"; |
242
|
|
|
|
|
|
|
#print STDERR "invoking: args=".%{$args}."\n"; |
243
|
|
|
|
|
|
|
#print STDERR "invoking: ".$stmt."\n"; |
244
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
|
$dbh->do($stmt); |
246
|
0
|
0
|
|
|
|
|
if ( $dbh->err() ) { |
247
|
0
|
|
|
|
|
|
return(0); |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
# update our fields so they match |
251
|
0
|
|
|
|
|
|
for my $key (keys %{$args}) { |
|
0
|
|
|
|
|
|
|
252
|
0
|
|
|
|
|
|
my $value=$args->{$key}; |
253
|
0
|
|
|
|
|
|
$self->$key($value); |
254
|
|
|
|
|
|
|
} |
255
|
0
|
|
|
|
|
|
return(1); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub update($@) |
259
|
|
|
|
|
|
|
{ |
260
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
261
|
0
|
|
|
|
|
|
my $args={@_}; |
262
|
0
|
|
|
|
|
|
my %updates; |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
for my $key (keys %{$args}) { |
|
0
|
|
|
|
|
|
|
265
|
0
|
|
|
|
|
|
my $value=$args->{$key}; |
266
|
0
|
|
|
|
|
|
my $cur=$self->get($key); |
267
|
|
|
|
|
|
|
|
268
|
0
|
0
|
0
|
|
|
|
if ( defined($cur) != defined($value) ) { |
|
|
0
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
$updates{$key}=$value; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
# either both undefined or both defined |
272
|
|
|
|
|
|
|
elsif ( defined($value) && $cur ne $value ) { |
273
|
0
|
|
|
|
|
|
$updates{$key}=$value; |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
} |
276
|
0
|
0
|
|
|
|
|
if ( %updates ) { |
277
|
0
|
|
|
|
|
|
return $self->_updateInDB(%updates); |
278
|
|
|
|
|
|
|
} |
279
|
0
|
|
|
|
|
|
return(0); |
280
|
|
|
|
|
|
|
} |
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub newFromDB($) |
283
|
|
|
|
|
|
|
{ |
284
|
0
|
|
|
0
|
0
|
|
my ($self)=@_; |
285
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
|
my $class=$self->_className(); |
287
|
|
|
|
|
|
|
|
288
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key2) ) { |
289
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key3) ) { |
290
|
0
|
|
|
|
|
|
return new $class(imdbdb=>$self->imdbdb(), |
291
|
|
|
|
|
|
|
$self->db_key()=>$self->get($self->db_key()), |
292
|
|
|
|
|
|
|
$self->db_key2()=>$self->get($self->db_key2()), |
293
|
|
|
|
|
|
|
$self->db_key3()=>$self->get($self->db_key3())); |
294
|
|
|
|
|
|
|
} |
295
|
|
|
|
|
|
|
else { |
296
|
0
|
|
|
|
|
|
return new $class(imdbdb=>$self->imdbdb(), |
297
|
|
|
|
|
|
|
$self->db_key()=>$self->get($self->db_key()), |
298
|
|
|
|
|
|
|
$self->db_key2()=>$self->get($self->db_key2())); |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
} |
301
|
|
|
|
|
|
|
else { |
302
|
0
|
|
|
|
|
|
return new $class(imdbdb=>$self->imdbdb(), |
303
|
|
|
|
|
|
|
$self->db_key()=>$self->get($self->db_key())); |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub delete($) |
308
|
|
|
|
|
|
|
{ |
309
|
0
|
|
|
0
|
0
|
|
my ($self)=@_; |
310
|
|
|
|
|
|
|
|
311
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key2) ) { |
312
|
0
|
0
|
|
|
|
|
if ( defined($self->db_key3) ) { |
313
|
0
|
|
|
|
|
|
$self->imdbdb->execute("DELETE from ".$self->db_table()." WHERE ". |
314
|
|
|
|
|
|
|
$self->db_key()."='".$self->get($self->db_key())."' AND ". |
315
|
|
|
|
|
|
|
$self->db_key2()."='".$self->get($self->db_key2())."' AND ". |
316
|
|
|
|
|
|
|
$self->db_key3()."='".$self->get($self->db_key3())."'"); |
317
|
|
|
|
|
|
|
} |
318
|
|
|
|
|
|
|
else { |
319
|
0
|
|
|
|
|
|
$self->imdbdb->execute("DELETE from ".$self->db_table()." WHERE ". |
320
|
|
|
|
|
|
|
$self->db_key()."='".$self->get($self->db_key())."' AND ". |
321
|
|
|
|
|
|
|
$self->db_key2()."='".$self->get($self->db_key2())."'"); |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
else { |
325
|
0
|
|
|
|
|
|
$self->imdbdb->execute("DELETE from ".$self->db_table()." WHERE ". |
326
|
|
|
|
|
|
|
$self->db_key()."='".$self->get($self->db_key())."'"); |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
sub saveChanges($) |
331
|
|
|
|
|
|
|
{ |
332
|
0
|
|
|
0
|
0
|
|
my ($self)=@_; |
333
|
|
|
|
|
|
|
|
334
|
0
|
|
|
|
|
|
my $clon=$self->newFromDB(); |
335
|
0
|
|
|
|
|
|
my %updates; |
336
|
|
|
|
|
|
|
|
337
|
0
|
|
|
|
|
|
for my $field ($self->get_accessors()) { |
338
|
0
|
0
|
0
|
|
|
|
if ( defined($self->get($field)) != defined($clon->get($field)) ) { |
|
|
0
|
|
|
|
|
|
339
|
0
|
|
|
|
|
|
$updates{$field}=$self->get($field); |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
# either both undefined or both defined |
342
|
|
|
|
|
|
|
elsif ( defined($self->get($field)) && $self->get($field) ne $clon->get($field) ) { |
343
|
0
|
|
|
|
|
|
$updates{$field}=$self->get($field); |
344
|
|
|
|
|
|
|
} |
345
|
|
|
|
|
|
|
} |
346
|
0
|
0
|
|
|
|
|
if ( %updates ) { |
347
|
0
|
|
|
|
|
|
return $self->_updateInDB(%updates); |
348
|
|
|
|
|
|
|
} |
349
|
0
|
|
|
|
|
|
return(0); |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
1; |