call inflate_result on new_result, but not from the CDBI compat layer
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / LiveObjectIndex.pm
index a461a13..d62e325 100644 (file)
@@ -20,9 +20,9 @@ __PACKAGE__->mk_classdata('__nocache' => 0);
 
 sub nocache {
     my $class = shift;
-    
+
     return $class->__nocache(@_) if @_;
-    
+
     return 1 if $Class::DBI::Weaken_Is_Available == 0;
     return $class->__nocache;
 }
@@ -73,10 +73,13 @@ sub insert {
 
 sub inflate_result {
   my ($class, @rest) = @_;
-  my $new = $class->next::method(@rest);
   
-  return $new if $new->nocache;
+  # we don't want to inflate_result on new_result
+  return $rest[3] if(defined $rest[3] && Scalar::Util::blessed $rest[3]);
   
+  my $new = $class->next::method(@rest);
+  return $new if $new->nocache;
+
   if (my $key = $new->ID) {
     #warn "Key $key";
     my $live = $class->live_object_index;