[Dbix-class] Change in dirty column identification?

Peter Rabbitson rabbit+dbic at rabbit.us
Fri Jan 8 16:50:55 GMT 2010


Ovid wrote:
> 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?
> 

This has been resolved by [1]. Btw any word on branches/prefetch_pager? Iirc there is something that you had but didn't commit.

[1] http://dev.catalyst.perl.org/svnweb/bast/revision?rev=8253



More information about the DBIx-Class mailing list