[Dbix-class] Change in dirty column identification?
Ovid
publiustemp-dbic at yahoo.com
Mon Dec 14 16:50:19 GMT 2009
In DBIx::Class 0.08100 and newer, for DBIx::Class::Row:
sub set_column {
my ($self, $column, $new_value) = @_;
$self->{_orig_ident} ||= $self->ident_condition;
my $old_value = $self->get_column($column);
$self->store_column($column, $new_value);
$self->{_dirty_columns}{$column} = 1
if (defined $old_value xor defined $new_value) || (defined $old_value && $old_value ne $new_value);
# XXX clear out the relation cache for this column
delete $self->{related_resultsets}{$column};
return $new_value;
}
Note that "store_column()" does not return a value. This means that the "dirty" test is against the passed in $new_value. However, we have a component which overrides store_column and, in a couple of special cases, will coerce an empty string to undef and vice versa (long story!). DBIx::Class 0.0813 and earlier used the return value from store_column() (the new value we've set) for the "dirty" test. We've a workaround, but is this a desired change? More specifically, are components not supposed to change the value of data being passed to DBIx::Class::Row::store_column?
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://use.perl.org/~Ovid/journal/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6
More information about the DBIx-Class
mailing list