use warnings;
use base 'DBIx::Class::Row';
-use DBIx::Class::_Util 'is_literal_value';
+use SQL::Abstract 'is_literal_value';
use namespace::clean;
=head1 NAME
sub _inflated_column {
my ($self, $col, $value) = @_;
- return $value unless defined $value; # NULL is NULL is NULL
- my $info = $self->column_info($col)
+ return $value if (
+ ! defined $value # NULL is NULL is NULL
+ or
+ is_literal_value($value) #that would be a not-yet-reloaded literal update
+ );
+
+ my $info = $self->result_source->column_info($col)
or $self->throw_exception("No column info for $col");
return $value unless exists $info->{_inflate_info};
is_literal_value($value)
);
- my $info = $self->column_info($col) or
+ my $info = $self->result_source->column_info($col) or
$self->throw_exception("No column info for $col");
return $value unless exists $info->{_inflate_info};
my ($self, $col) = @_;
$self->throw_exception("$col is not an inflated column")
- unless exists $self->column_info($col)->{_inflate_info};
+ unless exists $self->result_source->column_info($col)->{_inflate_info};
# we take care of keeping things in sync
return $self->{_inflated_column}{$col}
my $val = $self->get_column($col);
- return $val if is_literal_value($val); #that would be a not-yet-reloaded literal update
-
return $self->{_inflated_column}{$col} = $self->_inflated_column($col, $val);
}
sub set_inflated_column {
my ($self, $col, $value) = @_;
- $self->set_column($col, $self->_deflated_column($col, $value));
-
- if (length ref $value and ! is_literal_value($value) ) {
- $self->{_inflated_column}{$col} = $value;
- } else {
+ # pass through deflated stuff
+ if (! length ref $value or is_literal_value($value)) {
+ $self->set_column($col, $value);
delete $self->{_inflated_column}{$col};
}
+ # need to call set_column with the deflate cycle so that
+ # relationship caches are nuked if any
+ # also does the compare-for-dirtyness and change tracking dance
+ else {
+ $self->set_column($col, $self->_deflated_column($col, $value));
+ $self->{_inflated_column}{$col} = $value;
+ }
+
return $value;
}
sub store_inflated_column {
my ($self, $col, $value) = @_;
- if (is_literal_value($value)) {
+ if (! length ref $value or is_literal_value($value)) {
delete $self->{_inflated_column}{$col};
$self->store_column($col => $value);
}
=back
-=head1 AUTHOR
-
-Matt S. Trout <mst@shadowcatsystems.co.uk>
-
-=head1 CONTRIBUTORS
-
-Daniel Westermann-Clark <danieltwc@cpan.org> (documentation)
+=head1 FURTHER QUESTIONS?
-Jess Robinson <cpan@desert-island.demon.co.uk>
+Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
-=head1 LICENSE
+=head1 COPYRIGHT AND LICENSE
-You may distribute this code under the same terms as Perl itself.
+This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
+by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
+redistribute it and/or modify it under the same terms as the
+L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.
=cut