Cleanup in resultset, made storage prepare_cached for non-select statements
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / InflateColumn.pm
index 01d9e33..25995ab 100644 (file)
@@ -2,6 +2,7 @@ package DBIx::Class::InflateColumn;
 
 use strict;
 use warnings;
+use base qw/DBIx::Class::Row/;
 
 sub inflate_column {
   my ($self, $col, $attrs) = @_;
@@ -45,24 +46,29 @@ sub get_inflated_column {
 
 sub set_inflated_column {
   my ($self, $col, @rest) = @_;
-  my $ret = $self->store_inflated_column($col, @rest);
-  $self->{_dirty_columns}{$col} = 1;
+  my $ret = $self->_inflated_column_op('set', $col, @rest);
   return $ret;
 }
 
 sub store_inflated_column {
-  my ($self, $col, $obj) = @_;
+  my ($self, $col, @rest) = @_;
+  my $ret = $self->_inflated_column_op('store', $col, @rest);
+  return $ret;
+}
+
+sub _inflated_column_op {
+  my ($self, $op, $col, $obj) = @_;
+  my $meth = "${op}_column";
   unless (ref $obj) {
     delete $self->{_inflated_column}{$col};
-    return $self->store_column($col, $obj);
+    return $self->$meth($col, $obj);
   }
 
   my $deflated = $self->_deflated_column($col, $obj);
            # Do this now so we don't store if it's invalid
 
   $self->{_inflated_column}{$col} = $obj;
-  #warn "Storing $obj: ".($obj->_ident_values)[0];
-  $self->store_column($col, $deflated);
+  $self->$meth($col, $deflated);
   return $obj;
 }
 
@@ -75,7 +81,7 @@ sub new {
       $attrs->{$key} = $class->_deflated_column($key, $attrs->{$key});
     }
   }
-  return $class->NEXT::ACTUAL::new($attrs, @rest);
+  return $class->next::method($attrs, @rest);
 }
 
 1;