X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRow.pm;h=805c50b93a79c15fa5bb97fa91232cbdf69e6d12;hb=8c4b6c50e873a2b5993d1bfe0f40763d994b7da4;hp=8a51671e5adf828eabd0a810c682c8db37719557;hpb=7c4de2c37d9577b3579fe6a1e621f95a36f50363;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index 8a51671..805c50b 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -1053,7 +1053,6 @@ sub inflate_result { my $new = { _source_handle => $source_handle, _column_data => $me, - _in_storage => 1 }; bless $new, (ref $class || $class); @@ -1065,14 +1064,25 @@ sub inflate_result { unless $pre_source; if (ref($pre_val->[0]) eq 'ARRAY') { # multi my @pre_objects; - foreach my $pre_rec (@$pre_val) { - unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_} - and defined $pre_rec->[0]{$_} } $pre_source->primary_columns) { - next; + + for my $me_pref (@$pre_val) { + + # the collapser currently *could* return bogus elements with all + # columns set to undef + my $has_def; + for (values %{$me_pref->[0]}) { + if (defined $_) { + $has_def++; + last; + } } - push(@pre_objects, $pre_source->result_class->inflate_result( - $pre_source, @{$pre_rec})); + next unless $has_def; + + push @pre_objects, $pre_source->result_class->inflate_result( + $pre_source, @$me_pref + ); } + $new->related_resultset($pre)->set_cache(\@pre_objects); } elsif (defined $pre_val->[0]) { my $fetched; @@ -1095,6 +1105,8 @@ sub inflate_result { $new->related_resultset($pre)->set_cache([ $fetched ]); } } + + $new->in_storage (1); return $new; } @@ -1320,6 +1332,13 @@ This method can also be used to refresh from storage, retrieving any changes made since the row was last read from storage. Actually implemented in L +Note: If you are using L as your +storage, please kept in mind that if you L on a row that you +just updated or created, you should wrap the entire bit inside a transaction. +Otherwise you run the risk that you insert or update to the master database +but read from a replicant database that has not yet been updated from the +master. This will result in unexpected results. + =cut 1;